Add "/ncp version" command.

This commit is contained in:
asofold 2013-01-25 20:41:38 +01:00
parent ed09b58074
commit ed56c3458f
4 changed files with 41 additions and 1 deletions

View File

@ -30,6 +30,7 @@ import fr.neatmonster.nocheatplus.command.admin.ExemptCommand;
import fr.neatmonster.nocheatplus.command.admin.ExemptionsCommand;
import fr.neatmonster.nocheatplus.command.admin.InfoCommand;
import fr.neatmonster.nocheatplus.command.admin.LagCommand;
import fr.neatmonster.nocheatplus.command.admin.NCPVersionCommand;
import fr.neatmonster.nocheatplus.command.admin.ReloadCommand;
import fr.neatmonster.nocheatplus.command.admin.RemovePlayerCommand;
import fr.neatmonster.nocheatplus.command.admin.UnexemptCommand;
@ -110,6 +111,7 @@ public class CommandHandler implements TabExecutor {
new KickCommand(plugin),
new KickListCommand(plugin),
new LagCommand(plugin),
new NCPVersionCommand(plugin),
new ReloadCommand(plugin, notifyReload),
new RemovePlayerCommand(plugin),
new TellCommand(plugin),

View File

@ -0,0 +1,34 @@
package fr.neatmonster.nocheatplus.command.admin;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import fr.neatmonster.nocheatplus.NoCheatPlus;
import fr.neatmonster.nocheatplus.command.NCPCommand;
import fr.neatmonster.nocheatplus.compat.MCAccess;
import fr.neatmonster.nocheatplus.permissions.Permissions;
public class NCPVersionCommand extends NCPCommand{
public NCPVersionCommand(NoCheatPlus plugin) {
super(plugin, "version", Permissions.ADMINISTRATION_VERSION, new String[]{"versions", "ver"});
}
@Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
MCAccess mc = NoCheatPlus.getMCAccess();
sender.sendMessage(new String[]{
"---- Version information ----",
"#### Server ####",
Bukkit.getServer().getVersion(),
"#### NoCheatPlus ####",
"Plugin: " + plugin.getDescription().getVersion(),
"MCAccess: " + mc.getMCVersion() + " / " + mc.getServerVersionTag(),
});
return true;
}
}

View File

@ -43,6 +43,7 @@ public class Permissions {
public static final String ADMINISTRATION_TELL = ADMINISTRATION + ".tell";
public static final String ADMINISTRATION_TEMPKICK = ADMINISTRATION + ".tempkick";
public static final String ADMINISTRATION_UNKICK = ADMINISTRATION + ".unkick";
public static final String ADMINISTRATION_VERSION = ADMINISTRATION + ".version";
// Debug permission, for player spam (not in plugin.yml, currently).
public static final String ADMINISTRATION_DEBUG = ADMINISTRATION + ".debug";

View File

@ -15,7 +15,8 @@ commands:
# permissions: nocheatplus.admin.(...)
usage: |
Administrative commands overview:
/<command> reload: reload NoCheatPlus configuration
/<command> version: Show version information.
/<command> reload: reload the configuration
/<command> lag: Lag related info [expect changes]
/<command> info (player): Display the violations of a player
/<command> removeplayer (player) [(check type)]: Remove data
@ -61,6 +62,8 @@ permissions:
description: Allow use of the ncp tempkick command.
nocheatplus.admin.unkick:
description: Allow use of the ncp unkick command.
nocheatplus.admin.version:
description: Allow use of the ncp version command.
nocheatplus.admin.removeplayer:
description: Allow use of the ncp removeplayer command.
nocheatplus.admin.commands: