This commit is contained in:
Wilee999 2013-05-16 11:45:21 -07:00
parent e29a820398
commit ba834b6b92
2 changed files with 51 additions and 29 deletions

View File

@ -0,0 +1,51 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
@CommandParameters(description = "Show all commands for all server plugins.", usage = "/<command>")
public class Command_cmdlist extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
List<String> commands = new ArrayList<String>();
for (Plugin p : server.getPluginManager().getPlugins())
{
try
{
PluginDescriptionFile desc = p.getDescription();
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) desc.getCommands();
if (map != null)
{
for (Entry<String, Map<String, Object>> entry : map.entrySet())
{
String command_name = (String) entry.getKey();
commands.add(command_name);
}
}
}
catch (Throwable ex)
{
}
}
Collections.sort(commands);
sender.sendMessage(StringUtils.join(commands, ","));
return true;
}
}

View File

@ -1,29 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH)
@CommandParameters(description = "Senioradmin command - Purge everything! (except for bans).", usage = "/<command>")
public class Command_spurgeall extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
server.dispatchCommand(sender, "rd");
server.dispatchCommand(sender, "potion clearall");
server.dispatchCommand(sender, "uall");
server.dispatchCommand(sender, "denick");
server.dispatchCommand(sender, "mute purge");
server.dispatchCommand(sender, "fr purge");
server.dispatchCommand(sender, "mp");
server.dispatchCommand(sender, "blockcmd");
server.dispatchCommand(sender, "halt purge");
server.dispatchCommand(sender, "lockup purge");
//If I'm missing any, lemme know. Or just add it yourself.
return true;
}
}