diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java index e155f03bd..6a0a3ce7d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java @@ -38,7 +38,6 @@ import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; -import org.jetbrains.annotations.Range; import javax.annotation.Nonnull; import java.util.Random; @@ -72,8 +71,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator { Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ)); try { ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() { - @Override public void setBiome(@Range(from = 0, to = 15) int x, - @Range(from = 0, to = 15) int z, @Nonnull Biome biome) { + @Override public void setBiome(int x, int z, @Nonnull Biome biome) { result.setBiome(x, z, BukkitAdapter.adapt(biome)); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitChunkCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitChunkCoordinator.java index 3f15fc6f3..3ab6e31c0 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitChunkCoordinator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitChunkCoordinator.java @@ -97,9 +97,6 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator { this.bukkitWorld = Bukkit.getWorld(world.getName()); } - /** - * Start the coordinator instance - */ @Override public void start() { // Request initial batch this.requestBatch(); @@ -195,20 +192,10 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator { chunk.removePluginChunkTicket(this.plugin); } - /** - * Get the amount of remaining chunks (at the time of the method call) - * - * @return Snapshot view of remaining chunk count - */ @Override public int getRemainingChunks() { return this.expectedSize.get(); } - /** - * Get the amount of requested chunks - * - * @return Requested chunk count - */ @Override public int getTotalChunks() { return this.totalSize; } diff --git a/Core/src/main/java/com/plotsquared/core/queue/ChunkCoordinator.java b/Core/src/main/java/com/plotsquared/core/queue/ChunkCoordinator.java index ca89c5579..28ed3dc74 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/ChunkCoordinator.java +++ b/Core/src/main/java/com/plotsquared/core/queue/ChunkCoordinator.java @@ -39,9 +39,24 @@ public abstract class ChunkCoordinator implements PlotSquaredTask { // Do nothing } + /** + * Starts the chunk coordinator. This will usually (implementation-specific-permitting) mark chunks to be loaded in batches, + * then add them to a queue and apply tickets once loaded to prevent unloading. A repeating task will then iterate over loaded + * chunks, access them with a Consumer(BlockVector2) and remove the ticket once work has been completed on it. + */ public abstract void start(); + /** + * Get the amount of remaining chunks (at the time of the method call) + * + * @return Snapshot view of remaining chunk count + */ public abstract int getRemainingChunks(); + /** + * Get the amount of requested chunks + * + * @return Requested chunk count + */ public abstract int getTotalChunks(); } diff --git a/Core/src/main/java/com/plotsquared/core/util/ChunkUtil.java b/Core/src/main/java/com/plotsquared/core/util/ChunkUtil.java index c602b1691..31535d9fe 100644 --- a/Core/src/main/java/com/plotsquared/core/util/ChunkUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/ChunkUtil.java @@ -28,7 +28,6 @@ package com.plotsquared.core.util; import com.plotsquared.core.location.Location; import com.sk89q.worldedit.math.BlockVector2; import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.Range; import javax.annotation.Nonnull; @@ -84,8 +83,7 @@ public class ChunkUtil { * @param z Relative z coordinate * @return J value for xyz position in Array[4096]. */ - public static int getJ(@Range(from = 0, to = 15) int x, @Range(from = 0, to = 255) int y, - @Range(from = 0, to = 15) int z) { + public static int getJ(int x, int y, int z) { return CACHE_J[y][x][z]; } @@ -95,7 +93,7 @@ public class ChunkUtil { * @param j Position in the xyz Array[4096]. * @return x coordinate within the chunk */ - public static int getX(@Range(from = 0, to = 4095) int j) { + public static int getX(int j) { return x_loc[j]; } @@ -106,7 +104,7 @@ public class ChunkUtil { * @param j Position in the xyz Array[4096]. * @return x coordinate within the chunk */ - public static int getY(@Range(from = 0, to = 15) int i, @Range(from = 0, to = 4095) int j) { + public static int getY(int i, int j) { return y_loc[i][j]; } @@ -116,7 +114,7 @@ public class ChunkUtil { * @param j Position in the xyz Array[4096]. * @return z coordinate within the chunk */ - public static int getZ(@Range(from = 0, to = 4095) int j) { + public static int getZ(int j) { return z_loc[j]; }