mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-05-15 15:31:17 +00:00
47 lines
1.5 KiB
Java
47 lines
1.5 KiB
Java
package me.StevenLawson.TotalFreedomMod.commands;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.plugin.Plugin;
|
|
import org.bukkit.plugin.PluginDescriptionFile;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
|
|
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
|
public class Command_cmdlist extends FreedomCommand {
|
|
@Override
|
|
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
|
List<String> commands = new ArrayList<String>();
|
|
|
|
for (Plugin targetPlugin : server.getPluginManager().getPlugins()) {
|
|
try {
|
|
PluginDescriptionFile desc = targetPlugin.getDescription();
|
|
Map<String, Map<String, Object>> map = desc.getCommands();
|
|
|
|
if (map != null)
|
|
{
|
|
for (Entry<String, Map<String, Object>> entry : map.entrySet())
|
|
{
|
|
String command_name = entry.getKey();
|
|
commands.add(command_name);
|
|
}
|
|
}
|
|
}
|
|
catch (Throwable ex)
|
|
{
|
|
}
|
|
}
|
|
|
|
Collections.sort(commands);
|
|
|
|
sender.sendMessage(StringUtils.join(commands, ","));
|
|
|
|
return true;
|
|
}
|
|
}
|