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,7 +101,9 @@ public void onPlayerQuit(PlayerEvent event) {
Player player = event.getPlayer();
plugin.invinciblePlayers.remove(player.getName());
plugin.amphibiousPlayers.remove(player.getName());
plugin.blacklist.forgetPlayer(plugin.wrapPlayer(player));
if (plugin.blacklist != null) {
plugin.blacklist.forgetPlayer(plugin.wrapPlayer(player));
}
}
/**
@ -406,11 +408,13 @@ private void handleRegionCommand(Player player, String action, String[] args) {
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.");
return;
}
region.getOwners().addPlayer(player.getName());
plugin.regionManager.addRegion(id, region);
plugin.regionLoader.save(plugin.regionManager);
player.sendMessage(ChatColor.YELLOW + "Region saved as " + id + ".");
@ -666,8 +670,8 @@ private void handleRegionCommand(Player player, String action, String[] args) {
+ e.getMessage());
}
} else if (action.equalsIgnoreCase("load")) {
if (!canUseRegionCommand(player, "/regiondelete")) {
player.sendMessage(ChatColor.RED + "You don't have the /regiondelete permission.");
if (!canUseRegionCommand(player, "/regionload")) {
player.sendMessage(ChatColor.RED + "You don't have the /regionload permission.");
return;
}

View File

@ -285,7 +285,7 @@ boolean inGroup(Player player, String group) {
}
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) {

View File

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