mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Move comments to ChunkCoordinator, remove Range annotations
This commit is contained in:
parent
3288721259
commit
97b1a60ae8
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user