mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 350f50588e | |||
| 9a5820bbd6 | |||
| 3c31081b42 | |||
| 75b91a70d3 | |||
| 6b31e7c76c | |||
| 1ea3f3f550 | |||
| 00f7d292fa | |||
| 653cd0e242 | |||
| 6b1763a260 |
@@ -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>
|
||||
|
||||
+2
-5
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
+3
-2
@@ -84,11 +84,12 @@ public class CommandUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
ConfigFile dumpFile = ConfigFile.loadConfig(file);
|
||||
dumpFile.set("commands", serverCommands);
|
||||
try {
|
||||
dumpFile.save();
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
+10
-1
@@ -24,13 +24,22 @@ public class ConfigCache {
|
||||
this.canDoProtocolLib = canDoProtocolLib;
|
||||
this.logger = logger;
|
||||
|
||||
try {
|
||||
reloadConfig();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean reloadConfig() {
|
||||
|
||||
createFiles();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user