fix legacy mode event registration

This commit is contained in:
YouHaveTrouble
2021-03-15 15:01:17 +01:00
parent 42bfaa2efb
commit 6a4a27e7b3
@@ -28,15 +28,15 @@ public class CommandWhitelist extends JavaPlugin {
Plugin protocollib = getServer().getPluginManager().getPlugin("ProtocolLib");
getServer().getPluginManager().registerEvents(new PlayerCommandSendListener(), this);
if (!isLegacy) {
if (!getConfigCache().isUseProtocolLib() || protocollib == null || !protocollib.isEnabled()) {
getServer().getPluginManager().registerEvents(new PlayerCommandPreProcessListener(), this);
getServer().getPluginManager().registerEvents(new PlayerCommandSendListener(), this);
} else {
PacketCommandSendListener.protocol(this);
getLogger().info(ChatColor.AQUA+"Using ProtocolLib for command filter!");
}
getServer().getPluginManager().registerEvents(new TabCompleteBlockerListener(), this);
} else {
getLogger().info(ChatColor.AQUA+"Running in legacy mode...");
if (protocollib != null) {
@@ -46,8 +46,6 @@ public class CommandWhitelist extends JavaPlugin {
}
}
getServer().getPluginManager().registerEvents(new TabCompleteBlockerListener(), this);
getCommand("commandwhitelist").setExecutor(new MainCommand());
getCommand("commandwhitelist").setTabCompleter(new MainCommand());