Compare commits

..

2 Commits

Author SHA1 Message Date
YouHaveTrouble 66e6bff28e no idea how they managed to dispatch player command without / but ok 2021-05-07 00:43:54 +02:00
YouHaveTrouble 332e98f4a0 add fancy server counters 2021-03-30 16:34:34 +02:00
3 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>eu.endermite</groupId> <groupId>eu.endermite</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>1.7.3</version> <version>1.7.4</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>CommandWhitelist</name> <name>CommandWhitelist</name>
+3
View File
@@ -1,6 +1,9 @@
Command Whitelist is a plugin that allows you to control Command Whitelist is a plugin that allows you to control
precisely what commands players can see and use. precisely what commands players can see and use.
<img src="https://img.shields.io/bstats/servers/8705?label=Spigot%20servers%20using%20CommandWhitelist&style=for-the-badge">
<img src="https://img.shields.io/bstats/servers/8704?label=Proxy%20servers%20using%20CommandWhitelist&style=for-the-badge">
<h3>Plugin Features</h3> <h3>Plugin Features</h3>
<ul> <ul>
@@ -19,16 +19,18 @@ public class PlayerCommandPreProcessListener implements Listener {
if (player.hasPermission("commandwhitelist.bypass")) if (player.hasPermission("commandwhitelist.bypass"))
return; return;
String command = event.getMessage().toLowerCase(); String command = event.getMessage().toLowerCase();
if (command.startsWith("/"))
command = command.substring(1);
for (Map.Entry<String, List<String>> s : CommandWhitelist.getConfigCache().getPermList().entrySet()) { for (Map.Entry<String, List<String>> s : CommandWhitelist.getConfigCache().getPermList().entrySet()) {
if (!player.hasPermission("commandwhitelist.commands." + s.getKey())) if (!player.hasPermission("commandwhitelist.commands." + s.getKey()))
continue; continue;
for (String comm : s.getValue()) { for (String comm : s.getValue()) {
comm = comm.toLowerCase(); comm = comm.toLowerCase();
if (command.equalsIgnoreCase("/" + comm) || command.startsWith("/" + comm + " ")) { if (command.equalsIgnoreCase(comm) || command.startsWith(comm + " ")) {
String rawCmd = event.getMessage(); String rawCmd = event.getMessage();
List<String> bannedSubCommands = CommandsList.getSuggestions(player); List<String> bannedSubCommands = CommandsList.getSuggestions(player);
for (String bannedSubCommand : bannedSubCommands) { for (String bannedSubCommand : bannedSubCommands) {
if (rawCmd.startsWith("/"+bannedSubCommand)) { if (rawCmd.startsWith(bannedSubCommand)) {
event.setCancelled(true); event.setCancelled(true);
ConfigCache config = CommandWhitelist.getConfigCache(); ConfigCache config = CommandWhitelist.getConfigCache();
player.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getPrefix() + RandomStuff.getMessage(config.getCommandDeniedList(), config.getSubCommandDenied()))); player.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getPrefix() + RandomStuff.getMessage(config.getCommandDeniedList(), config.getSubCommandDenied())));