Compare commits

..

4 Commits

Author SHA1 Message Date
YouHaveTrouble 350f50588e remove stray log 2023-11-05 22:06:18 +01:00
YouHaveTrouble 9a5820bbd6 bump version 2023-11-05 22:04:35 +01:00
YouHaveTrouble 3c31081b42 do not correct the command input
in case some mongoloid plugin decides to not filter out the / and rawdog the message into Player#performCommand
2023-11-05 22:04:29 +01:00
YouHaveTrouble 75b91a70d3 fix resetting config 2023-06-09 19:20:57 +02:00
6 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.8.0</version> <version>2.8.2</version>
</parent> </parent>
<artifactId>Bukkit</artifactId> <artifactId>Bukkit</artifactId>
@@ -21,10 +21,6 @@ public class PlayerCommandPreProcessListener implements Listener {
String caseSensitiveLabel = CommandUtil.getCommandLabel(event.getMessage()); String caseSensitiveLabel = CommandUtil.getCommandLabel(event.getMessage());
String label = caseSensitiveLabel.toLowerCase(); String label = caseSensitiveLabel.toLowerCase();
String fullCommand = event.getMessage().substring(label.length()+1);
fullCommand = "/"+label+fullCommand;
event.setMessage(fullCommand);
BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences(); BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences();
ConfigCache config = CommandWhitelistBukkit.getConfigCache(); ConfigCache config = CommandWhitelistBukkit.getConfigCache();
@@ -36,8 +32,9 @@ public class PlayerCommandPreProcessListener implements Listener {
} }
HashSet<String> bannedSubCommands = CommandWhitelistBukkit.getSuggestions(player); HashSet<String> bannedSubCommands = CommandWhitelistBukkit.getSuggestions(player);
String messageWithoutSlash = event.getMessage().startsWith("/") ? event.getMessage().substring(1) : event.getMessage();
for (String bannedSubCommand : bannedSubCommands) { for (String bannedSubCommand : bannedSubCommands) {
if (event.getMessage().toLowerCase().substring(1).startsWith(bannedSubCommand)) { if (messageWithoutSlash.startsWith(bannedSubCommand)) {
event.setCancelled(true); event.setCancelled(true);
audiences.player(player).sendMessage(CWCommand.miniMessage.deserialize(config.prefix + config.subcommand_denied)); audiences.player(player).sendMessage(CWCommand.miniMessage.deserialize(config.prefix + config.subcommand_denied));
return; return;
+2 -2
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.8.0</version> <version>2.8.2</version>
</parent> </parent>
<artifactId>Common</artifactId> <artifactId>Common</artifactId>
@@ -76,7 +76,7 @@
<dependency> <dependency>
<groupId>com.github.thatsmusic99</groupId> <groupId>com.github.thatsmusic99</groupId>
<artifactId>ConfigurationMaster-API</artifactId> <artifactId>ConfigurationMaster-API</artifactId>
<version>v2.0.0-BETA-6</version> <version>v2.0.0-BETA-7</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.8.0</version> <version>2.8.2</version>
</parent> </parent>
<artifactId>Velocity</artifactId> <artifactId>Velocity</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.8.0</version> <version>2.8.2</version>
</parent> </parent>
<artifactId>Waterfall</artifactId> <artifactId>Waterfall</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.8.0</version> <version>2.8.2</version>
<modules> <modules>
<module>CommandWhitelistCommon</module> <module>CommandWhitelistCommon</module>
<module>CommandWhitelistBukkit</module> <module>CommandWhitelistBukkit</module>