Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
0
  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);
      }
    }
  }
Ejemplo n.º 3
0
  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());
  }
Ejemplo n.º 4
0
 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));
 }