mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-30 20:37:52 +01:00
New command to read collected player data
This commit is contained in:
parent
015f369e0a
commit
8dbfc3893c
@ -15,6 +15,7 @@ commands:
|
||||
/<command> permlist player [permission] - to list the NoCheat relevant permissions of the player, optionally only those starting with [permission]
|
||||
/<command> reload - to reload NoCheats configuration file(s), without reloading the plugin itself
|
||||
/<command> performance - to show some performance data of NoCheat
|
||||
/<command> playerinfo playername - show the collected data NoCheat collected about a player
|
||||
|
||||
permissions:
|
||||
nocheat:
|
||||
@ -31,6 +32,8 @@ permissions:
|
||||
description: allow use of the "nocheat reload" command
|
||||
nocheat.admin.performance:
|
||||
description: allow use of the "nocheat performance" command
|
||||
nocheat.admin.playerinfo:
|
||||
description: allow use of the "nocheat playerinfo" command
|
||||
nocheat.checks:
|
||||
description: Allow the player to bypass all checks
|
||||
children:
|
||||
|
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cc.co.evenprime.bukkit</groupId>
|
||||
<artifactId>NoCheat</artifactId>
|
||||
<version>2.19a</version>
|
||||
<version>2.20</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>NoCheat</name>
|
||||
<properties>
|
||||
|
@ -4,6 +4,8 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -39,9 +41,36 @@ public class CommandHandler {
|
||||
return handlePerformanceCommand(plugin, sender);
|
||||
}
|
||||
|
||||
else if(args[0].equalsIgnoreCase("playerinfo") && args.length >= 2) {
|
||||
// performance command was used
|
||||
return handlePlayerInfoCommand(plugin, sender, args);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean handlePlayerInfoCommand(NoCheat plugin, CommandSender sender, String[] args) {
|
||||
// Does the sender have permission?
|
||||
if(sender instanceof Player && !sender.hasPermission(Permissions.ADMIN_PLAYERINFO)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Map<String, Object> map = plugin.getPlayerData(args[1]);
|
||||
String filter = "";
|
||||
|
||||
if(args.length > 2) {
|
||||
filter = args[2];
|
||||
}
|
||||
|
||||
sender.sendMessage("PlayerInfo for " + args[1]);
|
||||
for(Entry<String, Object> entry : map.entrySet()) {
|
||||
if(entry.getKey().contains(filter)) {
|
||||
sender.sendMessage(entry.getKey() + ": " + entry.getValue());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean handlePermlistCommand(NoCheat plugin, CommandSender sender, String[] args) {
|
||||
// Does the sender have permission to use it?
|
||||
if(sender instanceof Player && !sender.hasPermission(Permissions.ADMIN_PERMLIST)) {
|
||||
|
@ -43,6 +43,7 @@ public class Permissions {
|
||||
public static final String ADMIN_PERMLIST = ADMIN + ".permlist";
|
||||
public static final String ADMIN_RELOAD = ADMIN + ".reload";
|
||||
public static final String ADMIN_PERFORMANCE = ADMIN + ".performance";
|
||||
public static final String ADMIN_PLAYERINFO = ADMIN + ".playerinfo";
|
||||
|
||||
private Permissions() {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user