Java Code Examples for br.net.fabiozumbi12.RedProtect.Bukkit.Region#getPrior()
The following examples show how to use
br.net.fabiozumbi12.RedProtect.Bukkit.Region#getPrior() .
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: RedProtectUtil.java From RedProtect with GNU General Public License v3.0 | 6 votes |
public int getUpdatedPrior(Region region) { int regionarea = region.getArea(); int prior = region.getPrior(); Region topRegion = RedProtect.get().rm.getTopRegion(region.getWorld(), region.getCenterX(), region.getCenterY(), region.getCenterZ()); Region lowRegion = RedProtect.get().rm.getLowRegion(region.getWorld(), region.getCenterX(), region.getCenterY(), region.getCenterZ()); if ((topRegion != null && topRegion.getID().equals(region.getID())) || (lowRegion != null && lowRegion.getID().equals(region.getID()))) { return prior; } if (lowRegion != null) { if (regionarea > lowRegion.getArea()) { prior = lowRegion.getPrior() - 1; } else if (regionarea < lowRegion.getArea() && regionarea < topRegion.getArea()) { prior = topRegion.getPrior() + 1; } else if (regionarea < topRegion.getArea()) { prior = topRegion.getPrior() + 1; } } return prior; }
Example 2
Source File: RedProtectUtil.java From RedProtect with GNU General Public License v3.0 | 6 votes |
public int simuleTotalRegionSize(String player, Region r2) { int total = 0; int regs = 0; for (Location loc : r2.get4Points(r2.getCenterY())) { Map<Integer, Region> pregs = RedProtect.get().rm.getGroupRegion(loc); pregs.remove(r2.getPrior()); Region other; if (pregs.size() > 0) { other = pregs.get(Collections.max(pregs.keySet())); } else { continue; } if (!r2.getID().equals(other.getID()) && r2.getPrior() > other.getPrior() && other.isLeader(player)) { regs++; } } if (regs != 4) { total += r2.getArea(); } return total; }
Example 3
Source File: WorldMySQLRegionManager.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@Override public Region getTopRegion(int x, int y, int z) { Map<Integer, Region> regionlist = new HashMap<>(); int max = 0; for (Region r : this.getRegions(x, y, z)) { if (x <= r.getMaxMbrX() && x >= r.getMinMbrX() && y <= r.getMaxY() && y >= r.getMinY() && z <= r.getMaxMbrZ() && z >= r.getMinMbrZ()) { if (regionlist.containsKey(r.getPrior())) { Region reg1 = regionlist.get(r.getPrior()); int Prior = r.getPrior(); if (reg1.getArea() >= r.getArea()) { r.setPrior(Prior + 1); } else { reg1.setPrior(Prior + 1); } } regionlist.put(r.getPrior(), r); } } if (regionlist.size() > 0) { max = Collections.max(regionlist.keySet()); } return regionlist.get(max); }
Example 4
Source File: WorldMySQLRegionManager.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@Override public Region getLowRegion(int x, int y, int z) { Map<Integer, Region> regionlist = new HashMap<>(); int min = 0; for (Region r : this.getRegions(x, y, z)) { if (x <= r.getMaxMbrX() && x >= r.getMinMbrX() && y <= r.getMaxY() && y >= r.getMinY() && z <= r.getMaxMbrZ() && z >= r.getMinMbrZ()) { if (regionlist.containsKey(r.getPrior())) { Region reg1 = regionlist.get(r.getPrior()); int Prior = r.getPrior(); if (reg1.getArea() >= r.getArea()) { r.setPrior(Prior + 1); } else { reg1.setPrior(Prior + 1); } } regionlist.put(r.getPrior(), r); } } if (regionlist.size() > 0) { min = Collections.min(regionlist.keySet()); } return regionlist.get(min); }
Example 5
Source File: WorldMySQLRegionManager.java From RedProtect with GNU General Public License v3.0 | 6 votes |
public Map<Integer, Region> getGroupRegion(int x, int y, int z) { Map<Integer, Region> regionlist = new HashMap<>(); for (Region r : this.getRegions(x, y, z)) { if (x <= r.getMaxMbrX() && x >= r.getMinMbrX() && y <= r.getMaxY() && y >= r.getMinY() && z <= r.getMaxMbrZ() && z >= r.getMinMbrZ()) { if (regionlist.containsKey(r.getPrior())) { Region reg1 = regionlist.get(r.getPrior()); int Prior = r.getPrior(); if (reg1.getArea() >= r.getArea()) { r.setPrior(Prior + 1); } else { reg1.setPrior(Prior + 1); } } regionlist.put(r.getPrior(), r); } } return regionlist; }
Example 6
Source File: WorldFlatFileRegionManager.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@Override public Region getTopRegion(int x, int y, int z) { Map<Integer, Region> regionlist = new HashMap<>(); int max = 0; for (Region r : regions.values()) { if (x <= r.getMaxMbrX() && x >= r.getMinMbrX() && y <= r.getMaxY() && y >= r.getMinY() && z <= r.getMaxMbrZ() && z >= r.getMinMbrZ()) { if (regionlist.containsKey(r.getPrior())) { Region reg1 = regionlist.get(r.getPrior()); int Prior = r.getPrior(); if (reg1.getArea() >= r.getArea()) { r.setPrior(Prior + 1); } else { reg1.setPrior(Prior + 1); } } regionlist.put(r.getPrior(), r); } } if (regionlist.size() > 0) { max = Collections.max(regionlist.keySet()); } return regionlist.get(max); }
Example 7
Source File: WorldFlatFileRegionManager.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@Override public Region getLowRegion(int x, int y, int z) { Map<Integer, Region> regionlist = new HashMap<>(); int min = 0; for (Region r : regions.values()) { if (x <= r.getMaxMbrX() && x >= r.getMinMbrX() && y <= r.getMaxY() && y >= r.getMinY() && z <= r.getMaxMbrZ() && z >= r.getMinMbrZ()) { if (regionlist.containsKey(r.getPrior())) { Region reg1 = regionlist.get(r.getPrior()); int Prior = r.getPrior(); if (reg1.getArea() >= r.getArea()) { r.setPrior(Prior + 1); } else { reg1.setPrior(Prior + 1); } } regionlist.put(r.getPrior(), r); } } if (regionlist.size() > 0) { min = Collections.min(regionlist.keySet()); } return regionlist.get(min); }
Example 8
Source File: WorldFlatFileRegionManager.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@Override public Map<Integer, Region> getGroupRegion(int x, int y, int z) { Map<Integer, Region> regionlist = new HashMap<>(); for (Region r : regions.values()) { if (x <= r.getMaxMbrX() && x >= r.getMinMbrX() && y <= r.getMaxY() && y >= r.getMinY() && z <= r.getMaxMbrZ() && z >= r.getMinMbrZ()) { if (regionlist.containsKey(r.getPrior())) { Region reg1 = regionlist.get(r.getPrior()); int Prior = r.getPrior(); if (reg1.getArea() >= r.getArea()) { r.setPrior(Prior + 1); } else { reg1.setPrior(Prior + 1); } } regionlist.put(r.getPrior(), r); } } return regionlist; }
Example 9
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; }