public static int getNbOwnedPlot(final UUID uuid, final World w) { int nbfound = 0; if (AthionCore.getPlots(w) != null) { for (final AthionPlot plot : AthionCore.getPlots(w).values()) { if ((plot.ownerId != null) && plot.ownerId.equals(uuid)) { nbfound++; } } } return nbfound; }
public static void refreshPlotChunks(final World w, final AthionPlot plot) { final int bottomX = AthionCore.bottomX(plot.id, w); final int topX = AthionCore.topX(plot.id, w); final int bottomZ = AthionCore.bottomZ(plot.id, w); final int topZ = AthionCore.topZ(plot.id, w); final int minChunkX = (int) Math.floor((double) bottomX / 16); final int maxChunkX = (int) Math.floor((double) topX / 16); final int minChunkZ = (int) Math.floor((double) bottomZ / 16); final int maxChunkZ = (int) Math.floor((double) topZ / 16); for (int x = minChunkX; x <= maxChunkX; x++) { for (int z = minChunkZ; z <= maxChunkZ; z++) { w.refreshChunk(x, z); } } }
public static void setBiome( final World w, final String id, final AthionPlot plot, final Biome b) { final int bottomX = AthionCore.bottomX(plot.id, w) - 1; final int topX = AthionCore.topX(plot.id, w) + 1; final int bottomZ = AthionCore.bottomZ(plot.id, w) - 1; final int topZ = AthionCore.topZ(plot.id, w) + 1; for (int x = bottomX; x <= topX; x++) { for (int z = bottomZ; z <= topZ; z++) { w.getBlockAt(x, 0, z).setBiome(b); } } plot.biome = b; refreshPlotChunks(w, plot); AthionSQL.updatePlot(getIdX(id), getIdZ(id), plot.world, "biome", b.name()); }
public static boolean isBlockInPlot(final AthionPlot plot, final Location blocklocation) { final World w = blocklocation.getWorld(); final int lowestX = Math.min(AthionCore.bottomX(plot.id, w), AthionCore.topX(plot.id, w)); final int highestX = Math.max(AthionCore.bottomX(plot.id, w), AthionCore.topX(plot.id, w)); final int lowestZ = Math.min(AthionCore.bottomZ(plot.id, w), AthionCore.topZ(plot.id, w)); final int highestZ = Math.max(AthionCore.bottomZ(plot.id, w), AthionCore.topZ(plot.id, w)); return (blocklocation.getBlockX() >= lowestX) && (blocklocation.getBlockX() <= highestX) && (blocklocation.getBlockZ() >= lowestZ) && (blocklocation.getBlockZ() <= highestZ); }
public static Location getPlotHome(final World w, final AthionPlot plot) { final AthionMaps pmi = getMap(w); if (pmi != null) { final Location loc = new Location( w, bottomX(plot.id, w) + ((topX(plot.id, w) - AthionCore.bottomX(plot.id, w)) / 2), pmi.RoadHeight + 2, bottomZ(plot.id, w) - 2); final int y = w.getHighestBlockYAt(loc); if ((y > 1) || (y < 255)) { loc.setY(y); } return loc; } else { return w.getSpawnLocation(); } }
public static Location getBottom(final World w, final AthionPlot plot) { return new Location(w, AthionCore.bottomX(plot.id, w), 0, AthionCore.bottomZ(plot.id, w)); }
public static Location getTop(final World w, final AthionPlot plot) { return new Location( w, AthionCore.topX(plot.id, w), w.getMaxHeight(), AthionCore.topZ(plot.id, w)); }