From c68d3e8e2fff9eb61e4a57592d08881b7dd718ba Mon Sep 17 00:00:00 2001 From: cnr Date: Tue, 8 Sep 2015 13:12:11 -0500 Subject: [PATCH] Remove MPluginSecretServerListener. Fixes #414 --- .../java/com/massivecraft/factions/P.java | 3 +-- .../massivecraft/factions/zcore/MPlugin.java | 5 +--- .../zcore/MPluginSecretServerListener.java | 27 ------------------- 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 src/main/java/com/massivecraft/factions/zcore/MPluginSecretServerListener.java diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java index aae8688e..b370d920 100644 --- a/src/main/java/com/massivecraft/factions/P.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -182,8 +182,7 @@ public class P extends MPlugin { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] split) { - // if bare command at this point, it has already been handled by MPlugin's command listeners - if (split == null || split.length == 0) { + if (split.length == 0) { return handleCommand(sender, "/f help", false); } diff --git a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java index 91490680..47812cc1 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java @@ -50,7 +50,6 @@ public abstract class MPlugin extends JavaPlugin { // Listeners private MPluginSecretPlayerListener mPluginSecretPlayerListener; - private MPluginSecretServerListener mPluginSecretServerListener; // Our stored base commands private List> baseCommands = new ArrayList>(); @@ -98,11 +97,9 @@ public abstract class MPlugin extends JavaPlugin { } catch (ClassCastException ex) { } - // Create and register listeners + // Create and register player command listener this.mPluginSecretPlayerListener = new MPluginSecretPlayerListener(this); - this.mPluginSecretServerListener = new MPluginSecretServerListener(this); getServer().getPluginManager().registerEvents(this.mPluginSecretPlayerListener, this); - getServer().getPluginManager().registerEvents(this.mPluginSecretServerListener, this); // Register recurring tasks if (saveTask == null && Conf.saveToFileEveryXMinutes > 0.0) { diff --git a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretServerListener.java b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretServerListener.java deleted file mode 100644 index c57209e7..00000000 --- a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretServerListener.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.massivecraft.factions.zcore; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.server.ServerCommandEvent; - -public class MPluginSecretServerListener implements Listener { - - private MPlugin p; - - public MPluginSecretServerListener(MPlugin p) { - this.p = p; - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onServerCommand(ServerCommandEvent event) { - if (event.getCommand().length() == 0) { - return; - } - - if (p.handleCommand(event.getSender(), event.getCommand())) { - event.setCommand(p.refCommand); - } - } - -}