mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-11 22:16:57 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 350f50588e | |||
| 9a5820bbd6 | |||
| 3c31081b42 |
@@ -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.1</version>
|
<version>2.8.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Bukkit</artifactId>
|
<artifactId>Bukkit</artifactId>
|
||||||
|
|||||||
+2
-5
@@ -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;
|
||||||
|
|||||||
@@ -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.1</version>
|
<version>2.8.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Common</artifactId>
|
<artifactId>Common</artifactId>
|
||||||
|
|||||||
@@ -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.1</version>
|
<version>2.8.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Velocity</artifactId>
|
<artifactId>Velocity</artifactId>
|
||||||
|
|||||||
@@ -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.1</version>
|
<version>2.8.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Waterfall</artifactId>
|
<artifactId>Waterfall</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.8.1</version>
|
<version>2.8.2</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>CommandWhitelistCommon</module>
|
<module>CommandWhitelistCommon</module>
|
||||||
<module>CommandWhitelistBukkit</module>
|
<module>CommandWhitelistBukkit</module>
|
||||||
|
|||||||
Reference in New Issue
Block a user