mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2025-07-26 15:33:45 +00:00
misc fixes
This commit is contained in:
parent
6075de6460
commit
e0970dcdd2
9 changed files with 21 additions and 47 deletions
|
@ -665,44 +665,6 @@ public class MainUtil {
|
|||
return getPlotHome(w, plot.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the plot chunks
|
||||
*
|
||||
* @param world World in which the plot is located
|
||||
* @param plot Plot Object
|
||||
*/
|
||||
public static void refreshPlotChunks(final String world, final Plot plot) {
|
||||
final int bottomX = getPlotBottomLoc(world, plot.id).getX();
|
||||
final int topX = getPlotTopLoc(world, plot.id).getX();
|
||||
final int bottomZ = getPlotBottomLoc(world, plot.id).getZ();
|
||||
final int topZ = getPlotTopLoc(world, plot.id).getZ();
|
||||
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);
|
||||
final ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
for (int x = minChunkX; x <= maxChunkX; x++) {
|
||||
for (int z = minChunkZ; z <= maxChunkZ; z++) {
|
||||
if (canSendChunk) {
|
||||
final ChunkLoc chunk = new ChunkLoc(x, z);
|
||||
chunks.add(chunk);
|
||||
} else {
|
||||
BukkitUtil.refreshChunk(world, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
SendChunk.sendChunk(world, chunks);
|
||||
} catch (final Throwable e) {
|
||||
canSendChunk = false;
|
||||
for (int x = minChunkX; x <= maxChunkX; x++) {
|
||||
for (int z = minChunkZ; z <= maxChunkZ; z++) {
|
||||
BukkitUtil.refreshChunk(world, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the top plot location of a plot (all plots are treated as small plots) - To get the top loc of a mega plot
|
||||
* use getPlotTopLoc(...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue