Exemplo n.º 1
0
  public void deleteRegion(Player player, String[] args) {
    if (args.length != 2) {
      player.sendMessage(ChatColor.RED + "Wrong usage. /pr help");
      return;
    }

    String id = "icp_" + player.getName() + "_" + args[1];

    World world = player.getWorld();
    LocalPlayer localPlayer = plugin.wrapPlayer(player);

    RegionManager mgr = plugin.getGlobalRegionManager().get(world);
    ProtectedRegion region = mgr.getRegion(id);

    if (region == null) {
      player.sendMessage(ChatColor.RED + "Could not find a region by that name.");
      return;
    }

    if (region.isOwner(localPlayer)) {
      mgr.removeRegion(id);

      player.sendMessage(ChatColor.YELLOW + "Region " + args[1] + " removed.");

      try {
        mgr.save();
      } catch (IOException e) {
        player.sendMessage(
            ChatColor.RED + "(shouldn't happen) Failed to write regions file: " + e.getMessage());
      }
    }
  }
Exemplo n.º 2
0
  public void deleteCuboid() {
    WioskiFile wioskiFile = plugin.getWioskiFile();
    WorldGuardPlugin wgp = WorldGuard.getWorldGuard(plugin);
    World w = Bukkit.getServer().getWorld(world);
    RegionManager regionManager = wgp.getRegionManager(w);

    String prefix = Config.getPrefix();
    regionManager.removeRegion(prefix + getAkronim());
  }