Adding formal... command support :/

This commit is contained in:
Ne0n x3r0 2013-01-02 12:32:36 -08:00
parent 2fb62f22c0
commit 2bb1978e2b
3 changed files with 35 additions and 15 deletions

View File

@ -22,7 +22,7 @@ public class BetterAlias extends JavaPlugin{
pm.registerEvents(new BetterAliasPlayerListener(this,aliasManager), this);
//Register commands
//getCommand("ba").setExecutor(new BetterAliasCommandExecutor(this));
getCommand("bareload").setExecutor(new BetterAliasCommandExecutor(this));
log("[BetterAlias] Enabled");

View File

@ -0,0 +1,34 @@
package com.gmail.Ne0nx3r0;
import com.gmail.Ne0nx3r0.AliasManager.AliasManager;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
class BetterAliasCommandExecutor implements CommandExecutor {
private final BetterAlias plugin;
public BetterAliasCommandExecutor(BetterAlias plugin)
{
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender cs, Command cmnd, String string, String[] strings)
{
if(cs.isOp() || cs.hasPermission("BetterAlias.reload"))
{
BetterAlias.aliasManager = new AliasManager(BetterAlias.self);
cs.sendMessage(ChatColor.GOLD+"BetterAlias reloaded!");
}
else
{
cs.sendMessage(ChatColor.RED+"You do not have permission to use /bareload (node: BetterAlias.reload)");
}
return true;
}
}

View File

@ -96,19 +96,5 @@ class BetterAliasPlayerListener implements Listener{
e.setCancelled(true);
}
}
if(cmd[0].equalsIgnoreCase("bareload"))
{
if(e.getPlayer().isOp() || e.getPlayer().hasPermission("BetterAlias.reload"))
{
BetterAlias.aliasManager = new AliasManager(BetterAlias.self);
e.getPlayer().sendMessage(ChatColor.GOLD+"BetterAlias reloaded!");
}
else
{
e.getPlayer().sendMessage(ChatColor.RED+"You do not have permission to use /bareload (node: BetterAlias.reload)");
}
}
}
}