From 5938a4987eae78a3efa43d07b0c066e506613f4f Mon Sep 17 00:00:00 2001 From: drtshock Date: Sat, 12 Jul 2014 15:50:56 -0500 Subject: [PATCH] Make bare /f command show help. Just making the plugin think they actually executed the help command because the help pages are built inside of that class and I'd rather not worry about moving them out of there or easily accessible. --- .../java/com/massivecraft/factions/P.java | 3 +-- .../factions/zcore/FCommandHandler.java | 20 ------------------- .../massivecraft/factions/zcore/MPlugin.java | 2 -- 3 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 src/main/java/com/massivecraft/factions/zcore/FCommandHandler.java diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java index 06626acc..8fa9cb64 100644 --- a/src/main/java/com/massivecraft/factions/P.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -169,14 +169,13 @@ public class P extends MPlugin { @Override public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly) { return sender instanceof Player && FactionsPlayerListener.preventCommand(commandString, (Player) sender) || super.handleCommand(sender, commandString, testOnly); - } @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) { - return true; + return handleCommand(sender, "/f help", false); } // otherwise, needs to be handled; presumably another plugin directly ran the command diff --git a/src/main/java/com/massivecraft/factions/zcore/FCommandHandler.java b/src/main/java/com/massivecraft/factions/zcore/FCommandHandler.java deleted file mode 100644 index e12ffa69..00000000 --- a/src/main/java/com/massivecraft/factions/zcore/FCommandHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.massivecraft.factions.zcore; - -import com.massivecraft.factions.P; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -public class FCommandHandler implements CommandExecutor { - - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (P.p.handleCommand(sender, cmd.getName() + args)) { - if (P.p.logPlayerCommands()) { - Bukkit.getLogger().info("[PLAYER_COMMAND] " + sender.getName() + ": " + cmd.getName() + args); - } - } - return false; - } -} diff --git a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java index 4dddf039..598ab1e0 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java @@ -94,8 +94,6 @@ public abstract class MPlugin extends JavaPlugin { this.mPluginSecretServerListener = new MPluginSecretServerListener(this); getServer().getPluginManager().registerEvents(this.mPluginSecretPlayerListener, this); getServer().getPluginManager().registerEvents(this.mPluginSecretServerListener, this); - getCommand("factions").setExecutor(new FCommandHandler()); - // Register recurring tasks if (saveTask == null && Conf.saveToFileEveryXMinutes > 0.0) {