diff --git a/shared/src/main/java/me/xginko/aef/commands/BukkitCommandWrap.java b/shared/src/main/java/me/xginko/aef/commands/BukkitCommandWrap.java index d68a5355..b7a2e07d 100644 --- a/shared/src/main/java/me/xginko/aef/commands/BukkitCommandWrap.java +++ b/shared/src/main/java/me/xginko/aef/commands/BukkitCommandWrap.java @@ -10,7 +10,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -25,9 +24,8 @@ public final class BukkitCommandWrap { private final boolean nmsVersioning; private String nmsVersion; private Class minecraftServerClass; - private Method aMethod, getServerMethod, registerMethod, syncCommandsMethod, removeCommandMethod; + private Method getServerMethod, syncCommandsMethod, removeCommandMethod; private Field bField, vanillaCommandDispatcherField, commandMapField, knownCommandsField; - private Constructor bukkitcommandWrapperConstructor; public BukkitCommandWrap() { String prefix = getCraftBukkitPrefix(); @@ -264,58 +262,4 @@ private boolean resolveBField() { } } - private boolean resolveRegisterCommandMethod() { - if (this.registerMethod != null) return true; - try { - this.registerMethod = Class.forName(getCraftBukkitPrefix("command.BukkitCommandWrapper")) - .getMethod("register", CommandDispatcher.class, String.class); - this.registerMethod.setAccessible(true); - return true; - } catch (NoSuchMethodException | ClassNotFoundException e) { - e.printStackTrace(); - return false; - } - } - - private Object getAInstance(Object commandDispatcher) { - try { - return this.aMethod.invoke(commandDispatcher); - } catch (IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - - private @Nullable Object getCommandWrapper(Command command) { - try { - return this.bukkitcommandWrapperConstructor.newInstance(Bukkit.getServer(), command); - } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - - private boolean resolveBukkitCmdWrapperConstructor() { - if (this.bukkitcommandWrapperConstructor != null) return true; - try { - this.bukkitcommandWrapperConstructor = Class.forName(getCraftBukkitPrefix("command.BukkitCommandWrapper")).getDeclaredConstructor(Class.forName("org.bukkit.craftbukkit." + this.nmsVersion + ".CraftServer"), Command.class); - this.bukkitcommandWrapperConstructor.setAccessible(true); - return true; - } catch (NoSuchMethodException | ClassNotFoundException e) { - e.printStackTrace(); - return false; - } - } - - private boolean resolveAMethod(Object commandDispatcher) { - if (this.aMethod != null) return true; - try { - this.aMethod = commandDispatcher.getClass().getDeclaredMethod("a"); - this.aMethod.setAccessible(true); - return true; - } catch (NoSuchMethodException e) { - e.printStackTrace(); - return false; - } - } }