82327c1d |
1 | /* |
2 | * Decompiled with CFR 0.151. |
3 | * |
4 | * Could not load the following classes: |
5 | * org.gotti.wurmunlimited.modloader.ReflectionUtil |
6 | */ |
7 | package net.encode.wurmesp.util; |
8 | |
9 | import java.lang.reflect.Field; |
10 | import java.util.logging.Level; |
11 | import java.util.logging.Logger; |
12 | import net.encode.wurmesp.feature.hook.Hook; |
13 | import org.gotti.wurmunlimited.modloader.ReflectionUtil; |
14 | |
15 | public class ReUtils { |
16 | @SuppressWarnings("unchecked") |
17 | public static <T> T getField(Object proxy, String fieldname) { |
18 | Class<?> cls = proxy.getClass(); |
19 | Object returnedObject = null; |
20 | try { |
21 | Field field = ReflectionUtil.getField(cls, (String)fieldname); |
22 | returnedObject = ReflectionUtil.getPrivateField((Object)proxy, (Field)field); |
23 | } |
24 | catch (ClassCastException | IllegalAccessException | IllegalArgumentException | NoSuchFieldException ex) { |
25 | Logger.getLogger(Hook.class.getName()).log(Level.SEVERE, null, ex); |
26 | } |
27 | return (T)returnedObject; |
28 | } |
29 | } |
30 | |