mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 19:55:17 +01:00
Removed code smells.
This commit is contained in:
parent
5c46265771
commit
93c3d3ce47
@ -5,6 +5,9 @@ package world.bentobox.bentobox;
|
|||||||
* @author tastybento
|
* @author tastybento
|
||||||
*/
|
*/
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
|
private Constants() {}
|
||||||
|
|
||||||
// The spawn command (Essentials spawn for example)
|
// The spawn command (Essentials spawn for example)
|
||||||
public static final String SPAWNCOMMAND = "spawn";
|
public static final String SPAWNCOMMAND = "spawn";
|
||||||
}
|
}
|
@ -103,25 +103,23 @@ public class AddonClassLoader extends URLClassLoader {
|
|||||||
* @return Class - class if found
|
* @return Class - class if found
|
||||||
*/
|
*/
|
||||||
public Class<?> findClass(String name, boolean checkGlobal) {
|
public Class<?> findClass(String name, boolean checkGlobal) {
|
||||||
if (name.startsWith("us.tastybento.")) {
|
if (name.startsWith("world.bentobox.")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Class<?> result = classes.get(name);
|
|
||||||
if (result == null) {
|
Class<?> result = classes.computeIfAbsent(name, k -> {
|
||||||
if (checkGlobal) {
|
if (checkGlobal && loader.getClassByName(name) != null) {
|
||||||
result = loader.getClassByName(name);
|
return loader.getClassByName(name);
|
||||||
}
|
} else {
|
||||||
if (result == null) {
|
|
||||||
try {
|
try {
|
||||||
result = super.findClass(name);
|
return super.findClass(name);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (result != null) {
|
|
||||||
loader.setClass(name, result);
|
|
||||||
}
|
|
||||||
classes.put(name, result);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
if (result != null) {
|
||||||
|
loader.setClass(name, result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user