mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a707068e2 |
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.10.0</version>
|
||||
<version>2.11.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Bukkit</artifactId>
|
||||
|
||||
+7
@@ -34,7 +34,14 @@ public class PlayerCommandPreProcessListener implements Listener {
|
||||
messageWithoutSlash,
|
||||
config.prefix + CommandWhitelistBukkit.getCommandDeniedMessage(label)
|
||||
);
|
||||
switch (config.messageType) {
|
||||
case CHAT:
|
||||
audiences.player(player).sendMessage(message);
|
||||
break;
|
||||
case ACTIONBAR:
|
||||
audiences.player(player).sendActionBar(message);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.10.0</version>
|
||||
<version>2.11.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Common</artifactId>
|
||||
|
||||
+13
@@ -17,6 +17,7 @@ public class ConfigCache {
|
||||
public String prefix, command_denied, no_permission, no_such_subcommand, config_reloaded, added_to_whitelist,
|
||||
removed_from_whitelist, group_doesnt_exist, subcommand_denied;
|
||||
public boolean useProtocolLib = false;
|
||||
public MessageType messageType = MessageType.CHAT;
|
||||
public boolean debug = false;
|
||||
|
||||
public ConfigCache(File configFile, boolean canDoProtocolLib, Object logger) {
|
||||
@@ -56,6 +57,8 @@ public class ConfigCache {
|
||||
if (canDoProtocolLib)
|
||||
config.addDefault("use_protocollib", false, "Do not enable if you don't have issues with aliased commands.\nThis requires server restart to take effect.");
|
||||
|
||||
config.addDefault("message_type", MessageType.CHAT.toString(), "Valid message types are CHAT and ACTIONBAR. Does nothing on velocity.");
|
||||
|
||||
if (config.isNew()) {
|
||||
List<String> exampleCommands = new ArrayList<>();
|
||||
exampleCommands.add("example");
|
||||
@@ -102,6 +105,16 @@ public class ConfigCache {
|
||||
group_doesnt_exist = config.getString("messages.group_doesnt_exist");
|
||||
useProtocolLib = config.getBoolean("use_protocollib");
|
||||
debug = config.getBoolean("debug", false);
|
||||
try {
|
||||
String chatTypeId = config.getString("message_type");
|
||||
if (chatTypeId == null) {
|
||||
warn("Invalid message type. Using CHAT.");
|
||||
} else {
|
||||
messageType = MessageType.valueOf(chatTypeId.toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
warn("Invalid message type. Using CHAT.");
|
||||
}
|
||||
|
||||
ConfigSection groupSection = config.getConfigSection("groups");
|
||||
for (String key : groupSection.getKeys(false)) {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package eu.endermite.commandwhitelist.common;
|
||||
|
||||
public enum MessageType {
|
||||
|
||||
CHAT, ACTIONBAR
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.10.0</version>
|
||||
<version>2.11.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Velocity</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.10.0</version>
|
||||
<version>2.11.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Waterfall</artifactId>
|
||||
|
||||
+7
@@ -38,7 +38,14 @@ public class BungeeChatEventListener implements Listener {
|
||||
command,
|
||||
configCache.prefix + CommandWhitelistWaterfall.getCommandDeniedMessage(label)
|
||||
);
|
||||
switch (configCache.messageType) {
|
||||
case CHAT:
|
||||
audiences.player(player).sendMessage(message);
|
||||
break;
|
||||
case ACTIONBAR:
|
||||
audiences.player(player).sendActionBar(message);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user