From 153ad5f98393a56a3ef92837fc12082b54bf596b Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Sat, 8 Oct 2022 20:12:08 +0200 Subject: [PATCH] fix errors when using regex expressions in executing command --- CommandWhitelistBukkit/pom.xml | 2 +- .../bukkit/listeners/PlayerCommandPreProcessListener.java | 6 +++++- CommandWhitelistCommon/pom.xml | 2 +- CommandWhitelistVelocity/pom.xml | 2 +- CommandWhitelistWaterfall/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CommandWhitelistBukkit/pom.xml b/CommandWhitelistBukkit/pom.xml index 3366061..f553060 100644 --- a/CommandWhitelistBukkit/pom.xml +++ b/CommandWhitelistBukkit/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.5.2 + 2.5.3 Bukkit diff --git a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/PlayerCommandPreProcessListener.java b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/PlayerCommandPreProcessListener.java index 7953958..82fbad7 100644 --- a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/PlayerCommandPreProcessListener.java +++ b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/PlayerCommandPreProcessListener.java @@ -20,7 +20,11 @@ public void PlayerCommandSendEvent(org.bukkit.event.player.PlayerCommandPreproce if (player.hasPermission(CWPermission.BYPASS.permission())) return; String caseSensitiveLabel = CommandUtil.getCommandLabel(event.getMessage()); String label = caseSensitiveLabel.toLowerCase(); - event.setMessage(event.getMessage().replaceFirst(caseSensitiveLabel, label)); + + String fullCommand = event.getMessage().substring(label.length()+1); + fullCommand = "/"+label+fullCommand; + + event.setMessage(fullCommand); BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences(); ConfigCache config = CommandWhitelistBukkit.getConfigCache(); diff --git a/CommandWhitelistCommon/pom.xml b/CommandWhitelistCommon/pom.xml index 99506d3..edf56a7 100644 --- a/CommandWhitelistCommon/pom.xml +++ b/CommandWhitelistCommon/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.5.2 + 2.5.3 Common diff --git a/CommandWhitelistVelocity/pom.xml b/CommandWhitelistVelocity/pom.xml index 5cf8ac3..db65f96 100644 --- a/CommandWhitelistVelocity/pom.xml +++ b/CommandWhitelistVelocity/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.5.2 + 2.5.3 Velocity diff --git a/CommandWhitelistWaterfall/pom.xml b/CommandWhitelistWaterfall/pom.xml index 45cbb42..70c1bb1 100644 --- a/CommandWhitelistWaterfall/pom.xml +++ b/CommandWhitelistWaterfall/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.5.2 + 2.5.3 Waterfall diff --git a/pom.xml b/pom.xml index 62b40ea..0ff1bd3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.5.2 + 2.5.3 CommandWhitelistCommon CommandWhitelistBukkit