@@ -27,7 +27,6 @@ public class SkriptReflection {
27
27
private static Field LOCAL_VARIABLES ;
28
28
private static Field VARIABLES_MAP_HASHMAP ;
29
29
private static Field VARIABLES_MAP_TREEMAP ;
30
- private static Field LOG_HANDLERS ;
31
30
private static Constructor VARIABLES_MAP ;
32
31
33
32
static {
@@ -62,9 +61,12 @@ public class SkriptReflection {
62
61
try {
63
62
_FIELD = SkriptLogger .class .getDeclaredField ("handlers" );
64
63
_FIELD .setAccessible (true );
64
+ JavaReflection .removeFinalModifier (_FIELD );
65
65
HANDLERS = _FIELD ;
66
66
} catch (NoSuchFieldException e ) {
67
67
Skript .warning ("Skript's handlers field could not be resolved. Some Skript warnings may not be available." );
68
+ } catch (IllegalAccessException e ) {
69
+ e .printStackTrace ();
68
70
}
69
71
70
72
try {
@@ -94,17 +96,6 @@ public class SkriptReflection {
94
96
Skript .warning ("Skript's tree map field could not be resolved." );
95
97
}
96
98
97
- try {
98
- _FIELD = SkriptLogger .class .getDeclaredField ("handlers" );
99
- _FIELD .setAccessible (true );
100
- JavaReflection .removeFinalModifier (_FIELD );
101
- LOG_HANDLERS = _FIELD ;
102
- } catch (NoSuchFieldException e ) {
103
- Skript .warning ("Skript's log handlers field could not be resolved." );
104
- } catch (IllegalAccessException e ) {
105
- e .printStackTrace ();
106
- }
107
-
108
99
try {
109
100
_CONSTRUCTOR = variablesMap .getDeclaredConstructor ();
110
101
_CONSTRUCTOR .setAccessible (true );
@@ -200,7 +191,7 @@ public static void copyVariablesMap(Event from, Event to) {
200
191
201
192
public static void replaceSkriptLogger () {
202
193
try {
203
- LOG_HANDLERS .set (null , new InsertingHandlerList (new NoMissingAndOrLogger ()));
194
+ HANDLERS .set (null , new InsertingHandlerList (new NoMissingAndOrLogger ()));
204
195
} catch (IllegalAccessException e ) {
205
196
e .printStackTrace ();
206
197
}
0 commit comments