New Setting

This commit is contained in:
RayzsYT committed 2024-05-16 21:44:11 +02:00
1 parent 67ca635312
commit 3531e2111a
4 files changed
+28

No files matched your search

@@ -31,6 +31,11 @@ public class BukkitBlockCommandListener implements Listener {
if(rawCommand.equals("/")) return;
if(Storage.isPluginsCommand(command) && Storage.USE_CUSTOM_PLUGINS && !PermissionUtil.hasBypassPermission(player, command)) {
for (String line : Storage.CUSTOM_PLUGINS) MessageTranslator.send(player, line.replace("%command%", rawCommand.replaceFirst("/", "")));
return;
}
if((Storage.TURN_BLACKLIST_TO_WHITELIST)) {
if(Storage.isCommandBlockedPrecise(command)) return;
if(PermissionUtil.hasBypassPermission(player, command)) return;
@@ -25,6 +25,11 @@ public class BungeeBlockCommandListener implements Listener {
if(rawCommand.equals("/")) return;
if(Storage.isPluginsCommand(command) && Storage.USE_CUSTOM_PLUGINS && !PermissionUtil.hasBypassPermission(player, command)) {
for (String line : Storage.CUSTOM_PLUGINS) MessageTranslator.send(player, line.replace("%command%", rawCommand.replaceFirst("/", "")));
return;
}
if(Storage.TURN_BLACKLIST_TO_WHITELIST) {
if(Storage.isCommandBlockedPrecise(command)) return;
if(PermissionUtil.hasBypassPermission(player, command)) return;
@@ -28,6 +28,11 @@ public class VelocityBlockCommandListener {
Player player = (Player) commandSource;
String command = event.getCommand();
if(Storage.isPluginsCommand(command) && Storage.USE_CUSTOM_PLUGINS && !PermissionUtil.hasBypassPermission(player, command)) {
for (String line : Storage.CUSTOM_PLUGINS) MessageTranslator.send(player, line.replace("%command%", command.replaceFirst("/", "")));
return;
}
if(Storage.TURN_BLACKLIST_TO_WHITELIST) {
if(Storage.isCommandBlockedPrecise(command)) return;
if(PermissionUtil.hasBypassPermission(player, command)) return;
@@ -187,4 +187,17 @@ public class Storage {
}
return false;
}
public static boolean isPluginsCommand(String command) {
String[] split;
if(command.contains(" ")) {
split = command.split(" ");
if(split.length > 0) command = split[0];
command = command.split(" ")[0];
}
for (String blockedCommand : Arrays.asList("pl", "plugins", "bukkit:pl", "bukkit:plugins")) {
if(blockedCommand.equals(command.toLowerCase())) return true;
}
return false;
}
}