Compare commits

..

1 Commits

Author SHA1 Message Date
YouHaveTrouble 67ca2c2458 lowercase command label 2022-09-28 13:33:03 +02:00
7 changed files with 13 additions and 9 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.5.0</version> <version>2.5.1</version>
</parent> </parent>
<artifactId>Bukkit</artifactId> <artifactId>Bukkit</artifactId>
@@ -17,7 +17,9 @@ public class PlayerCommandPreProcessListener implements Listener {
public void PlayerCommandSendEvent(org.bukkit.event.player.PlayerCommandPreprocessEvent event) { public void PlayerCommandSendEvent(org.bukkit.event.player.PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.hasPermission("commandwhitelist.bypass")) return; if (player.hasPermission("commandwhitelist.bypass")) return;
String label = CommandUtil.getCommandLabel(event.getMessage().toLowerCase()); String caseSensitiveLabel = CommandUtil.getCommandLabel(event.getMessage());
String label = caseSensitiveLabel.toLowerCase();
event.setMessage(event.getMessage().replaceFirst(caseSensitiveLabel, label));
BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences(); BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences();
ConfigCache config = CommandWhitelistBukkit.getConfigCache(); ConfigCache config = CommandWhitelistBukkit.getConfigCache();
@@ -34,9 +34,11 @@ public class PacketCommandPreProcessListener {
if (!string.startsWith("/")) return; if (!string.startsWith("/")) return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.hasPermission(CWPermission.BYPASS.permission())) return; if (player.hasPermission(CWPermission.BYPASS.permission())) return;
ConfigCache config = CommandWhitelistBukkit.getConfigCache(); ConfigCache config = CommandWhitelistBukkit.getConfigCache();
String label = CommandUtil.getCommandLabel(string.toLowerCase()); String caseSensitiveLabel = CommandUtil.getCommandLabel(string);
String label = caseSensitiveLabel.toLowerCase();
packet.getStrings().write(0, string.replaceFirst(caseSensitiveLabel, label));
HashSet<String> commands = CommandWhitelistBukkit.getCommands(player); HashSet<String> commands = CommandWhitelistBukkit.getCommands(player);
BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences(); BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences();
if (!commands.contains(label)) { if (!commands.contains(label)) {
+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.5.0</version> <version>2.5.1</version>
</parent> </parent>
<artifactId>Common</artifactId> <artifactId>Common</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.5.0</version> <version>2.5.1</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.5.0</version> <version>2.5.1</version>
</parent> </parent>
<artifactId>Waterfall</artifactId> <artifactId>Waterfall</artifactId>
+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.5.0</version> <version>2.5.1</version>
<modules> <modules>
<module>CommandWhitelistCommon</module> <module>CommandWhitelistCommon</module>
<module>CommandWhitelistBukkit</module> <module>CommandWhitelistBukkit</module>
@@ -46,7 +46,7 @@
</goals> </goals>
<configuration> <configuration>
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
<finalName>${project.name}-${project.parent.version}</finalName> <finalName>${project.name}-${project.version}</finalName>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>