Skip to content

Commit

Permalink
FIX: region announcements in all worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinWieczorek committed Feb 23, 2016
1 parent ca6633a commit 65c8aac
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/java/co/marcin/novaguilds/manager/RegionManager.java
Expand Up @@ -50,17 +50,21 @@ public class RegionManager {
private static final NovaGuilds plugin = NovaGuilds.getInstance();

//getters
public static NovaRegion get(Location l) {
int x = l.getBlockX();
int z = l.getBlockZ();
public static NovaRegion get(Location location) {
int x = location.getBlockX();
int z = location.getBlockZ();

for(NovaRegion r : plugin.getRegionManager().getRegions()) {
Location c1 = r.getCorner(0);
Location c2 = r.getCorner(1);
for(NovaRegion region : plugin.getRegionManager().getRegions()) {
if(!location.getWorld().equals(region.getWorld())) {
continue;
}

Location c1 = region.getCorner(0);
Location c2 = region.getCorner(1);

if((x >= c1.getBlockX() && x <= c2.getBlockX()) || (x <= c1.getBlockX() && x >= c2.getBlockX())) {
if((z >= c1.getBlockZ() && z <= c2.getBlockZ()) || (z <= c1.getBlockZ() && z >= c2.getBlockZ())) {
return r;
return region;
}
}
}
Expand Down

0 comments on commit 65c8aac

Please sign in to comment.