Skip to content

Commit

Permalink
Remove reflection and annotation caller for nms
Browse files Browse the repository at this point in the history
  • Loading branch information
EpiCanard committed Aug 7, 2024
1 parent 0c11882 commit 1ffd47a
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 1,066 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public GlobalMarketChest() {
this.nms = initNms();

GlobalMarketChest.plugin = this;
Version.initVersion(Utils.getFullVersion());
}

@Override
Expand All @@ -90,7 +89,7 @@ public void onEnable() {
try {
this.configLoader.loadFiles();
} catch (CantLoadConfigException e) {
this.getLogger().log(Level.SEVERE, e.getMessage());
LoggerUtils.error(e.getMessage());
this.disable();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ public void onInteract(PlayerInteractEvent event) {
}

public static WorldListener of() {
if (Version.isEqualsTo(Version.V1_12)) {
return new V1_12();
}
return new V1_X();
return Utils.getVersion().equals("1.12") ? new V1_12() : new V1_X();
}

private static class V1_12 extends WorldListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public Boolean isDamaged_Latest(ItemStack item) {
* @return
*/
public Boolean isDamaged(ItemStack item) {
return Version.isEqualsTo(Version.V1_12) ? isDamaged_1_12(item) : isDamaged_Latest(item);
return Utils.getVersion().equals("1.12") ? isDamaged_1_12(item) : isDamaged_Latest(item);
}

/**
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,5 @@ public static Object invokeMethod(Object object, String method, Object... args)
return null;
}

/**
* Define if the current object has the specified method
*
* @param object the object on which call the method
* @param method the method name to calle
* @param args all the arguments that must be send to the method
* @return return a boolean
*/
public static Boolean hasMethod(Object object, String method, Object... args) {
try {
object.getClass().getMethod(method, fromObjectToClass(args));
return true;
} catch (NoSuchMethodException e) {
return false;
}
}

private ReflectionUtils() {}
}
Loading

0 comments on commit 1ffd47a

Please sign in to comment.