From a898be349ce95cbaa3f07eb3c8607f9ef07b7d0b Mon Sep 17 00:00:00 2001 From: 502647092 Date: Wed, 30 Sep 2015 19:54:35 +0800 Subject: [PATCH] fix res command error... Signed-off-by: 502647092 --- .../com/bekvon/bukkit/residence/ResidenceMain.java | 3 +++ .../bukkit/residence/commandmain/CommandRes.java | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/bekvon/bukkit/residence/ResidenceMain.java b/src/main/java/com/bekvon/bukkit/residence/ResidenceMain.java index 4db8d5b..2f5176b 100644 --- a/src/main/java/com/bekvon/bukkit/residence/ResidenceMain.java +++ b/src/main/java/com/bekvon/bukkit/residence/ResidenceMain.java @@ -335,6 +335,9 @@ public class ResidenceMain extends JavaPlugin { if (cevent.isCancelled()) { return true; } + if (args.length == 0) { + return hdmcnd.onCommand(sender, command, label, new String[] { "?" }); + } return hdmcnd.onCommand(sender, command, label, args); } diff --git a/src/main/java/com/bekvon/bukkit/residence/commandmain/CommandRes.java b/src/main/java/com/bekvon/bukkit/residence/commandmain/CommandRes.java index 1b55474..953eed5 100644 --- a/src/main/java/com/bekvon/bukkit/residence/commandmain/CommandRes.java +++ b/src/main/java/com/bekvon/bukkit/residence/commandmain/CommandRes.java @@ -50,9 +50,10 @@ import com.bekvon.bukkit.residence.commandsub.CommandUnStuck; import com.bekvon.bukkit.residence.commandsub.CommandVersion; import cn.citycraft.PluginHelper.commands.BaseCommand; +import cn.citycraft.PluginHelper.commands.DefaultCommand; import cn.citycraft.PluginHelper.commands.HandlerSubCommand; -public class CommandRes extends BaseCommand { +public class CommandRes extends BaseCommand implements DefaultCommand { HandlerSubCommand hdsubcmd; ResidenceMain plugin; @@ -104,9 +105,16 @@ public class CommandRes extends BaseCommand { hdsubcmd.registerCommand(new CommandUnStuck(plugin)); hdsubcmd.registerCommand(new CommandVersion(plugin)); + hdsubcmd.setDefaultCommand(this); + plugin.getCommand("residence").setTabCompleter(hdsubcmd); } + @Override + public void defaultexecute(final CommandSender sender, final Command command, final String label) throws CommandException { + commandHelp(new String[] { "?" }, true, sender); + } + @Override public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException { boolean resadmin = false;