Compare commits

..

9 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
YouHaveTrouble 6b31e7c76c bump version 2023-06-09 11:04:04 +02:00
YouHaveTrouble 1ea3f3f550 update config dependency 2023-06-09 11:03:45 +02:00
YouHaveTrouble 00f7d292fa Merge pull request #70 from DaJokni/1.20
Update ConfigurationMaster-API to add 1.20 support
2023-06-07 23:52:43 +02:00
DaJokni 653cd0e242 Change protocollib version to 5.0.0, because snapshot no longer exists 2023-06-07 22:29:20 +03:00
DaJokni 6b1763a260 Update ConfigurationMaster-API to add 1.20 support 2023-06-07 22:27:15 +03:00
8 changed files with 25 additions and 18 deletions
+2 -2
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.7.0</version>
<version>2.8.2</version>
</parent>
<artifactId>Bukkit</artifactId>
@@ -110,7 +110,7 @@
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.0.0-SNAPSHOT</version>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -21,10 +21,6 @@ public class PlayerCommandPreProcessListener implements Listener {
String caseSensitiveLabel = CommandUtil.getCommandLabel(event.getMessage());
String label = caseSensitiveLabel.toLowerCase();
String fullCommand = event.getMessage().substring(label.length()+1);
fullCommand = "/"+label+fullCommand;
event.setMessage(fullCommand);
BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences();
ConfigCache config = CommandWhitelistBukkit.getConfigCache();
@@ -36,8 +32,9 @@ public class PlayerCommandPreProcessListener implements Listener {
}
HashSet<String> bannedSubCommands = CommandWhitelistBukkit.getSuggestions(player);
String messageWithoutSlash = event.getMessage().startsWith("/") ? event.getMessage().substring(1) : event.getMessage();
for (String bannedSubCommand : bannedSubCommands) {
if (event.getMessage().toLowerCase().substring(1).startsWith(bannedSubCommand)) {
if (messageWithoutSlash.startsWith(bannedSubCommand)) {
event.setCancelled(true);
audiences.player(player).sendMessage(CWCommand.miniMessage.deserialize(config.prefix + config.subcommand_denied));
return;
+2 -2
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.7.0</version>
<version>2.8.2</version>
</parent>
<artifactId>Common</artifactId>
@@ -76,7 +76,7 @@
<dependency>
<groupId>com.github.thatsmusic99</groupId>
<artifactId>ConfigurationMaster-API</artifactId>
<version>v2.0.0-BETA-1</version>
<version>v2.0.0-BETA-7</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -84,11 +84,12 @@ public class CommandUtil {
return false;
}
ConfigFile dumpFile = ConfigFile.loadConfig(file);
dumpFile.set("commands", serverCommands);
try {
ConfigFile dumpFile = ConfigFile.loadConfig(file);
dumpFile.set("commands", serverCommands);
dumpFile.save();
} catch (IOException e) {
} catch (Exception e) {
return false;
}
return true;
@@ -24,13 +24,22 @@ public class ConfigCache {
this.canDoProtocolLib = canDoProtocolLib;
this.logger = logger;
reloadConfig();
try {
reloadConfig();
} catch (Exception e) {
e.printStackTrace();
}
}
public boolean reloadConfig() {
createFiles();
config = ConfigFile.loadConfig(configFile);
try {
config = ConfigFile.loadConfig(configFile);
} catch (Exception e) {
e.printStackTrace();
return false;
}
config.addDefault("messages.prefix", "CommandWhitelist > ");
config.addDefault("messages.command_denied", "No such command.");
@@ -106,7 +115,7 @@ public class ConfigCache {
try {
config.save();
return true;
} catch (IOException e) {
} catch (Exception e) {
return false;
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.7.0</version>
<version>2.8.2</version>
</parent>
<artifactId>Velocity</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.7.0</version>
<version>2.8.2</version>
</parent>
<artifactId>Waterfall</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.7.0</version>
<version>2.8.2</version>
<modules>
<module>CommandWhitelistCommon</module>
<module>CommandWhitelistBukkit</module>