mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Implement #141 - ability to specify multiple commands (use ; as dilemeter)
This commit is contained in:
1 parent
3acfe39489
commit
a89fc97863
3 files changed
+10
-4
No files matched your search
@@ -1055,8 +1055,9 @@ public class Backend {
|
||||
event = event.replaceAll("&player", name).replaceAll("&world", player.getWorld().getName());
|
||||
|
||||
if (event.startsWith("COMMAND[")) {
|
||||
String command = event.replaceAll("COMMAND\\[", "").replaceAll("]", "");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
for(String cmd : Utilities.getCommands(event)) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||
}
|
||||
} else if (event.equalsIgnoreCase("KICK")) {
|
||||
String msg = kick <= magic.CHAT_BAN_LEVEL ? ChatColor.RED + lang.getChatKickReason() + " (" + kick + "/" + magic.CHAT_BAN_LEVEL + ")" : ChatColor.RED + lang.getChatBanReason();
|
||||
player.kickPlayer(msg);
|
||||
|
||||
@@ -132,8 +132,9 @@ public class UserManager {
|
||||
public void execute(User user, String event) {
|
||||
final String name = user.getName();
|
||||
if (event.startsWith("COMMAND[")) {
|
||||
String command = event.replaceAll("COMMAND\\[", "").replaceAll("]", "").replaceAll("&player", name).replaceAll("&world", user.getPlayer().getWorld().getName());
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
for(String cmd : Utilities.getCommands(event)) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||
}
|
||||
} else if (event.equalsIgnoreCase("KICK")) {
|
||||
user.getPlayer().kickPlayer(RED + lang.getKickReason());
|
||||
String msg = RED + lang.getKickBroadcast().replaceAll("&player", name);
|
||||
|
||||
@@ -211,6 +211,10 @@ public final class Utilities {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String [] getCommands(String command) {
|
||||
return command.replaceAll("COMMAND\\[", "").replaceAll("]", "").split(";");
|
||||
}
|
||||
|
||||
static {
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_ROSE);
|
||||
|
||||
Reference in new issue
Block a user