Add region limit override permission.

This commit is contained in:
Moo0 2011-06-20 17:22:33 +01:00
parent 6496bbd87f
commit 3b4c58b721

View File

@ -237,10 +237,12 @@ public static void claim(CommandContext args, WorldGuardPlugin plugin,
WorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld()); WorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld());
RegionManager mgr = plugin.getGlobalRegionManager().get(sel.getWorld()); RegionManager mgr = plugin.getGlobalRegionManager().get(sel.getWorld());
// Check whether the player has created too many regions if (!plugin.hasPermission(sender, "worldguard.region.unlimited")) {
if (wcfg.maxRegionCountPerPlayer >= 0 // Check whether the player has created too many regions
&& mgr.getRegionCountOfPlayer(localPlayer) >= wcfg.maxRegionCountPerPlayer) { if (wcfg.maxRegionCountPerPlayer >= 0
throw new CommandException("You own too many regions, delete one first to claim a new one."); && mgr.getRegionCountOfPlayer(localPlayer) >= wcfg.maxRegionCountPerPlayer) {
throw new CommandException("You own too many regions, delete one first to claim a new one.");
}
} }
ProtectedRegion existing = mgr.getRegion(id); ProtectedRegion existing = mgr.getRegion(id);
@ -289,11 +291,13 @@ public static void claim(CommandContext args, WorldGuardPlugin plugin,
} }
}*/ }*/
if (region.volume() > wcfg.maxClaimVolume) { if (!plugin.hasPermission(sender, "worldguard.region.unlimited")) {
player.sendMessage(ChatColor.RED + "This region is to large to claim."); if (region.volume() > wcfg.maxClaimVolume) {
player.sendMessage(ChatColor.RED + player.sendMessage(ChatColor.RED + "This region is too large to claim.");
"Max. volume: " + wcfg.maxClaimVolume + ", your volume: " + region.volume()); player.sendMessage(ChatColor.RED +
return; "Max. volume: " + wcfg.maxClaimVolume + ", your volume: " + region.volume());
return;
}
} }
region.getOwners().addPlayer(player.getName()); region.getOwners().addPlayer(player.getName());