File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,9 @@ public boolean equals(Object obj) {
146
146
private static String SUPER_CLASS = "com/comphenix/protocol/reflect/StructureModifier" ;
147
147
private static String COMPILED_CLASS = PACKAGE_NAME + "/CompiledStructureModifier" ;
148
148
private static String FIELD_EXCEPTION_CLASS = "com/comphenix/protocol/reflect/FieldAccessException" ;
149
-
149
+
150
+ public static boolean attemptClassLoad = false ;
151
+
150
152
/**
151
153
* Construct a structure compiler.
152
154
* @param loader - main class loader.
@@ -163,26 +165,32 @@ public boolean equals(Object obj) {
163
165
*/
164
166
public <TField > boolean lookupClassLoader (StructureModifier <TField > source ) {
165
167
StructureKey key = new StructureKey (source );
166
-
168
+
167
169
// See if there's a need to lookup the class name
168
170
if (compiledCache .containsKey (key )) {
169
171
return true ;
170
172
}
171
-
173
+
174
+ if (! attemptClassLoad ) {
175
+ return false ;
176
+ }
177
+
178
+ // This causes a ton of lag and doesn't seem to work
179
+
172
180
try {
173
181
String className = getCompiledName (source );
174
-
182
+
175
183
// This class might have been generated before. Try to load it.
176
184
Class <?> before = loader .loadClass (PACKAGE_NAME .replace ('/' , '.' ) + "." + className );
177
-
185
+
178
186
if (before != null ) {
179
187
compiledCache .put (key , before );
180
188
return true ;
181
189
}
182
190
} catch (ClassNotFoundException e ) {
183
191
// That's ok.
184
192
}
185
-
193
+
186
194
// We need to compile the class
187
195
return false ;
188
196
}
You can’t perform that action at this time.
0 commit comments