Skip to content

Commit

Permalink
Fixed cannot find symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
XDPXI committed Nov 27, 2024
1 parent 18e14bf commit 24993b4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/dev/xdpxi/xdlib/plugin/xdlib.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,23 @@ private void setConfig() {
public void onDisable() {
getLogger().info("[XDLib] - Disabled!");
}

private boolean isCommandAvailable(String name) {
try {
return getServer().getPluginCommand(name) != null;
} catch (Exception e) {
return false;
}
}

private void unregisterCommand(String name) {
try {
Field commandMapField = getServer().getClass().getDeclaredField("commandMap");
commandMapField.setAccessible(true);
CommandMap commandMap = (CommandMap) commandMapField.get(getServer());
commandMap.getCommand(name).unregister(commandMap);
} catch (Exception e) {
getLogger().warning("Failed to unregister command: " + name);
}
}
}

0 comments on commit 24993b4

Please sign in to comment.