package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.world.ArenaSection; import de.steamwar.bausystem.world.Welt; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class CommandProtect implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(!(sender instanceof Player)) return false; Player player = (Player) sender; if(!Welt.hasPermission(player, Permission.worldedit)){ player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Boden schützen"); return false; } for(ArenaSection section : BauSystem.getSections()){ if(section.inRegion(player.getLocation()) && section.hasProtection()){ section.protect(); player.sendMessage(BauSystem.PREFIX + "§7Boden geschützt"); return false; } } player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner (M)WG-Region"); return false; } }