mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-04 23:07:44 +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> 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> reload - to reload NoCheats configuration file(s), without reloading the plugin itself
|
||||||
/<command> performance - to show some performance data of NoCheat
|
/<command> performance - to show some performance data of NoCheat
|
||||||
|
/<command> playerinfo playername - show the collected data NoCheat collected about a player
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
nocheat:
|
nocheat:
|
||||||
@ -31,6 +32,8 @@ permissions:
|
|||||||
description: allow use of the "nocheat reload" command
|
description: allow use of the "nocheat reload" command
|
||||||
nocheat.admin.performance:
|
nocheat.admin.performance:
|
||||||
description: allow use of the "nocheat performance" command
|
description: allow use of the "nocheat performance" command
|
||||||
|
nocheat.admin.playerinfo:
|
||||||
|
description: allow use of the "nocheat playerinfo" command
|
||||||
nocheat.checks:
|
nocheat.checks:
|
||||||
description: Allow the player to bypass all checks
|
description: Allow the player to bypass all checks
|
||||||
children:
|
children:
|
||||||
|
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>cc.co.evenprime.bukkit</groupId>
|
<groupId>cc.co.evenprime.bukkit</groupId>
|
||||||
<artifactId>NoCheat</artifactId>
|
<artifactId>NoCheat</artifactId>
|
||||||
<version>2.19a</version>
|
<version>2.20</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>NoCheat</name>
|
<name>NoCheat</name>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -4,6 +4,8 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -39,9 +41,36 @@ public class CommandHandler {
|
|||||||
return handlePerformanceCommand(plugin, sender);
|
return handlePerformanceCommand(plugin, sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(args[0].equalsIgnoreCase("playerinfo") && args.length >= 2) {
|
||||||
|
// performance command was used
|
||||||
|
return handlePlayerInfoCommand(plugin, sender, args);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
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) {
|
private static boolean handlePermlistCommand(NoCheat plugin, CommandSender sender, String[] args) {
|
||||||
// Does the sender have permission to use it?
|
// Does the sender have permission to use it?
|
||||||
if(sender instanceof Player && !sender.hasPermission(Permissions.ADMIN_PERMLIST)) {
|
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_PERMLIST = ADMIN + ".permlist";
|
||||||
public static final String ADMIN_RELOAD = ADMIN + ".reload";
|
public static final String ADMIN_RELOAD = ADMIN + ".reload";
|
||||||
public static final String ADMIN_PERFORMANCE = ADMIN + ".performance";
|
public static final String ADMIN_PERFORMANCE = ADMIN + ".performance";
|
||||||
|
public static final String ADMIN_PLAYERINFO = ADMIN + ".playerinfo";
|
||||||
|
|
||||||
private Permissions() {}
|
private Permissions() {}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user