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.
This commit is contained in:
drtshock 2014-07-12 15:50:56 -05:00
parent 2db15f6447
commit 5938a4987e
3 changed files with 1 additions and 24 deletions

View File

@ -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

View File

@ -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;
}
}

View File

@ -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) {