Add hook versions to the "ncp version" command.

This commit is contained in:
asofold 2013-06-22 17:13:54 +02:00
parent bba028baec
commit c25b774721

View File

@ -1,5 +1,10 @@
package fr.neatmonster.nocheatplus.command.admin;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -8,7 +13,10 @@ import org.bukkit.plugin.java.JavaPlugin;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.command.BaseCommand;
import fr.neatmonster.nocheatplus.compat.MCAccess;
import fr.neatmonster.nocheatplus.hooks.NCPHook;
import fr.neatmonster.nocheatplus.hooks.NCPHookManager;
import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
public class NCPVersionCommand extends BaseCommand{
@ -27,8 +35,16 @@ public class NCPVersionCommand extends BaseCommand{
"#### NoCheatPlus ####",
"Plugin: " + access.getDescription().getVersion(),
"MCAccess: " + mc.getMCVersion() + " / " + mc.getServerVersionTag(),
});
final Collection<NCPHook> hooks = NCPHookManager.getAllHooks();
if (!hooks.isEmpty()){
final List<String> fullNames = new LinkedList<String>();
for (final NCPHook hook : hooks){
fullNames.add(hook.getHookName() + " " + hook.getHookVersion());
}
Collections.sort(fullNames, String.CASE_INSENSITIVE_ORDER);
sender.sendMessage("Hooks: " + StringUtil.join(fullNames, " | "));
}
return true;
}