Fixed various issues with regions.

This commit is contained in:
sk89q 2011-01-16 11:54:03 -08:00
parent 5db7f124ac
commit 30d9978412
3 changed files with 11 additions and 7 deletions

View File

@ -101,8 +101,10 @@ public void onPlayerQuit(PlayerEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
plugin.invinciblePlayers.remove(player.getName()); plugin.invinciblePlayers.remove(player.getName());
plugin.amphibiousPlayers.remove(player.getName()); plugin.amphibiousPlayers.remove(player.getName());
if (plugin.blacklist != null) {
plugin.blacklist.forgetPlayer(plugin.wrapPlayer(player)); plugin.blacklist.forgetPlayer(plugin.wrapPlayer(player));
} }
}
/** /**
* Called when a player uses an item * Called when a player uses an item
@ -406,11 +408,13 @@ private void handleRegionCommand(Player player, String action, String[] args) {
ProtectedRegion region = new ProtectedCuboidRegion(min, max); ProtectedRegion region = new ProtectedCuboidRegion(min, max);
if (!plugin.regionManager.overlapsUnownedRegion(region, plugin.wrapPlayer(player))) { if (plugin.regionManager.overlapsUnownedRegion(region, plugin.wrapPlayer(player))) {
player.sendMessage(ChatColor.RED + "This region overlaps with someone else's region."); player.sendMessage(ChatColor.RED + "This region overlaps with someone else's region.");
return; return;
} }
region.getOwners().addPlayer(player.getName());
plugin.regionManager.addRegion(id, region); plugin.regionManager.addRegion(id, region);
plugin.regionLoader.save(plugin.regionManager); plugin.regionLoader.save(plugin.regionManager);
player.sendMessage(ChatColor.YELLOW + "Region saved as " + id + "."); player.sendMessage(ChatColor.YELLOW + "Region saved as " + id + ".");
@ -666,8 +670,8 @@ private void handleRegionCommand(Player player, String action, String[] args) {
+ e.getMessage()); + e.getMessage());
} }
} else if (action.equalsIgnoreCase("load")) { } else if (action.equalsIgnoreCase("load")) {
if (!canUseRegionCommand(player, "/regiondelete")) { if (!canUseRegionCommand(player, "/regionload")) {
player.sendMessage(ChatColor.RED + "You don't have the /regiondelete permission."); player.sendMessage(ChatColor.RED + "You don't have the /regionload permission.");
return; return;
} }

View File

@ -285,7 +285,7 @@ boolean inGroup(Player player, String group) {
} }
boolean hasPermission(Player player, String perm) { boolean hasPermission(Player player, String perm) {
return perm.equals("/regionclaim"); return perm.equals("/regionclaim") || perm.equals("/regionload") || perm.equals("/regionsave");
} }
List<String> getGroups(Player player) { List<String> getGroups(Player player) {

View File

@ -142,9 +142,9 @@ public static boolean intersects(ProtectedRegion region1, ProtectedRegion region
ProtectedCuboidRegion r1 = (ProtectedCuboidRegion)region1; ProtectedCuboidRegion r1 = (ProtectedCuboidRegion)region1;
ProtectedCuboidRegion r2 = (ProtectedCuboidRegion)region2; ProtectedCuboidRegion r2 = (ProtectedCuboidRegion)region2;
BlockVector min1 = r1.getMinimumPoint(); BlockVector min1 = r1.getMinimumPoint();
BlockVector max1 = r1.getMinimumPoint(); BlockVector max1 = r1.getMaximumPoint();
BlockVector min2 = r2.getMinimumPoint(); BlockVector min2 = r2.getMinimumPoint();
BlockVector max2 = r2.getMinimumPoint(); BlockVector max2 = r2.getMaximumPoint();
return !(min1.getBlockX() > max2.getBlockX() return !(min1.getBlockX() > max2.getBlockX()
|| min1.getBlockY() > max2.getBlockY() || min1.getBlockY() > max2.getBlockY()