Java Code Examples for br.net.fabiozumbi12.RedProtect.Bukkit.Region#canDelete()
The following examples show how to use
br.net.fabiozumbi12.RedProtect.Bukkit.Region#canDelete() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandHandlers.java From RedProtect with GNU General Public License v3.0 | 5 votes |
public static void handleDeleteName(Player p, String rname, String world) { Region r = RedProtect.get().rm.getRegion(rname, p.getWorld().getName()); if (!world.equals("")) { if (Bukkit.getWorld(world) != null) { r = RedProtect.get().rm.getRegion(rname, world); } else { RedProtect.get().lang.sendMessage(p, "cmdmanager.region.invalidworld"); return; } } if (RedProtect.get().ph.hasRegionPermLeader(p, "delete", r)) { if (r == null) { RedProtect.get().lang.sendMessage(p, RedProtect.get().lang.get("cmdmanager.region.doesntexist") + ": " + rname); return; } int claims = RedProtect.get().config.configRoot().region_settings.can_delete_first_home_after_claims; if (!r.canDelete() && (claims == -1 || RedProtect.get().rm.getPlayerRegions(p.getUniqueId().toString(), p.getWorld().getName()) < claims) && !p.hasPermission("redprotect.bypass")) { if (claims != -1) { RedProtect.get().lang.sendMessage(p, RedProtect.get().lang.get("cmdmanager.region.cantdeletefirst-claims").replace("{claims}", "" + claims)); } else { RedProtect.get().lang.sendMessage(p, RedProtect.get().lang.get("cmdmanager.region.cantdeletefirst")); } return; } DeleteRegionEvent event = new DeleteRegionEvent(r, p); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { return; } RedProtect.get().rm.remove(r, r.getWorld()); RedProtect.get().lang.sendMessage(p, RedProtect.get().lang.get("cmdmanager.region.deleted") + " " + rname); RedProtect.get().logger.addLog("(World " + world + ") Player " + p.getName() + " REMOVED region " + rname); } else { RedProtect.get().lang.sendMessage(p, "no.permission"); } }
Example 2
Source File: RegionManager.java From RedProtect with GNU General Public License v3.0 | 5 votes |
public Region renameRegion(String newName, Region old) { Region newr = new Region(newName, old.getAdmins(), old.getMembers(), old.getLeaders(), new int[]{old.getMinMbrX(), old.getMinMbrX(), old.getMaxMbrX(), old.getMaxMbrX()}, new int[]{old.getMinMbrZ(), old.getMinMbrZ(), old.getMaxMbrZ(), old.getMaxMbrZ()}, old.getMinY(), old.getMaxY(), old.getPrior(), old.getWorld(), old.getDate(), old.getFlags(), old.getWelcome(), old.getValue(), old.getTPPoint(), old.canDelete(), old.canPurge()); this.add(newr, newr.getWorld()); this.remove(old, old.getWorld()); return newr; }
Example 3
Source File: CommandHandlers.java From RedProtect with GNU General Public License v3.0 | 4 votes |
public static void handleDelete(Player p) { Region r = RedProtect.get().rm.getTopRegion(p.getLocation()); if (RedProtect.get().ph.hasRegionPermLeader(p, "delete", r)) { if (r == null) { RedProtect.get().lang.sendMessage(p, "cmdmanager.region.todo.that"); return; } int claims = RedProtect.get().config.configRoot().region_settings.can_delete_first_home_after_claims; if (!r.canDelete() && (claims == -1 || RedProtect.get().rm.getPlayerRegions(p.getUniqueId().toString(), p.getWorld().getName()) < claims) && !p.hasPermission("redprotect.bypass")) { if (claims != -1) { RedProtect.get().lang.sendMessage(p, RedProtect.get().lang.get("cmdmanager.region.cantdeletefirst-claims").replace("{claims}", "" + claims)); } else { RedProtect.get().lang.sendMessage(p, RedProtect.get().lang.get("cmdmanager.region.cantdeletefirst")); } return; } DeleteRegionEvent event = new DeleteRegionEvent(r, p); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { return; } String rname = r.getName(); String w = r.getWorld(); RedProtect.get().rm.remove(r, w); RedProtect.get().lang.sendMessage(p, RedProtect.get().lang.get("cmdmanager.region.deleted") + " " + rname); RedProtect.get().logger.addLog("(World " + w + ") Player " + p.getName() + " REMOVED region " + rname); // Handle money if (RedProtect.get().config.ecoRoot().claim_cost_per_block.enable && RedProtect.get().hooks.vault && !p.hasPermission("redprotect.eco.bypass")) { long reco = r.getArea() * RedProtect.get().config.ecoRoot().claim_cost_per_block.cost_per_block; if (!RedProtect.get().config.ecoRoot().claim_cost_per_block.y_is_free) { reco = reco * Math.abs(r.getMaxY() - r.getMinY()); } if (reco > 0) { RedProtect.get().economy.depositPlayer(p, reco); p.sendMessage(RedProtect.get().lang.get("economy.region.deleted").replace("{price}", RedProtect.get().config.ecoRoot().economy_symbol + reco + " " + RedProtect.get().config.ecoRoot().economy_name)); } } } else { RedProtect.get().lang.sendMessage(p, "no.permission"); } }