mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-09-06 06:38:14 +00:00
Lombok implementation removal. I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!! Thank you!!
51 lines
1.6 KiB
Java
51 lines
1.6 KiB
Java
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
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 = Rank.NON_OP, source = SourceType.BOTH)
|
|
@CommandParameters(description = "Show all commands for all server plugins.", usage = "/<command>", aliases = "cmdlist")
|
|
public class Command_commandlist extends FreedomCommand
|
|
{
|
|
|
|
@Override
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
{
|
|
List<String> commands = new ArrayList<>();
|
|
|
|
for (Plugin targetPlugin : server.getPluginManager().getPlugins())
|
|
{
|
|
try
|
|
{
|
|
PluginDescriptionFile desc = targetPlugin.getDescription();
|
|
Map<String, Map<String, Object>> map = desc.getCommands();
|
|
|
|
for (Entry<String, Map<String, Object>> entry : map.entrySet())
|
|
{
|
|
String command_name = entry.getKey();
|
|
commands.add(command_name);
|
|
}
|
|
}
|
|
catch (Throwable ignored)
|
|
{
|
|
}
|
|
}
|
|
|
|
Collections.sort(commands);
|
|
|
|
sender.sendMessage(StringUtils.join(commands, ", "));
|
|
|
|
return true;
|
|
}
|
|
}
|