fix
This commit is contained in:
@@ -69,21 +69,40 @@ public class EventCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void handleBuild(CommandSender sender, String[] args) {
|
||||
if (args.length < 2) {
|
||||
if (args == null || args.length < 2) {
|
||||
sender.sendMessage(ChatColor.RED + "Použití: /event build <on/off>");
|
||||
return;
|
||||
}
|
||||
|
||||
String command = args[1].toLowerCase();
|
||||
if (command.equals("on")) {
|
||||
if ("on".equals(command)) { // Bezpečnější porovnání řetězců
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "rg flag __global__ build -w EVENT allow");
|
||||
sender.sendMessage(ChatColor.GREEN + "Build mód byl zapnut!");
|
||||
} else if (command.equals("off")) {
|
||||
} else if ("off".equals(command)) {
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "rg flag __global__ build -w EVENT deny");
|
||||
sender.sendMessage(ChatColor.RED + "Build mód byl vypnut!");
|
||||
}
|
||||
}
|
||||
|
||||
private void handleTeleport(CommandSender sender, String[] args) {
|
||||
if (args == null || args.length < 3) {
|
||||
sender.sendMessage(ChatColor.RED + "Použití: /event teleport <hráč> <cíl>");
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = Bukkit.getPlayer(args[1]);
|
||||
Player target = Bukkit.getPlayer(args[2]);
|
||||
|
||||
if (player == null || target == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Jeden nebo oba hráči nejsou online!");
|
||||
return;
|
||||
}
|
||||
|
||||
player.teleport(target.getLocation());
|
||||
sender.sendMessage(ChatColor.GREEN + String.format("Hráč %s byl teleportován k hráči %s!",
|
||||
player.getName(), target.getName()));
|
||||
}
|
||||
|
||||
private void handlePvP(CommandSender sender, String[] args) {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(ChatColor.RED + "Použití: /event pvp <on/off>");
|
||||
@@ -163,22 +182,4 @@ public class EventCommand implements CommandExecutor {
|
||||
target.setFoodLevel(20);
|
||||
sender.sendMessage(ChatColor.GREEN + "Hráč " + target.getName() + " byl vyléčen!");
|
||||
}
|
||||
|
||||
private void handleTeleport(CommandSender sender, String[] args) {
|
||||
if (args.length < 3) {
|
||||
sender.sendMessage(ChatColor.RED + "Použití: /event teleport <hráč> <cíl>");
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = Bukkit.getPlayer(args[1]);
|
||||
Player target = Bukkit.getPlayer(args[2]);
|
||||
|
||||
if (player == null || target == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Jeden nebo oba hráči nejsou online!");
|
||||
return;
|
||||
}
|
||||
|
||||
player.teleport(target.getLocation());
|
||||
sender.sendMessage(ChatColor.GREEN + "Hráč " + player.getName() + " byl teleportován k hráči " + target.getName() + "!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user