mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
sendchunk
This commit is contained in:
parent
2b7053895c
commit
3f71e0e772
@ -38,6 +38,7 @@ import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
@ -634,12 +635,12 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
final int minChunkZ = (int) Math.floor((double) bottomZ / 16);
|
||||
final int maxChunkZ = (int) Math.floor((double) topZ / 16);
|
||||
|
||||
final ArrayList<Chunk> chunks = new ArrayList<>();
|
||||
final ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
|
||||
for (int x = minChunkX; x <= maxChunkX; x++) {
|
||||
for (int z = minChunkZ; z <= maxChunkZ; z++) {
|
||||
if (canSendChunk) {
|
||||
final Chunk chunk = BukkitUtil.getChunkAt(world, x, z);
|
||||
final ChunkLoc chunk = new ChunkLoc(x, z);
|
||||
chunks.add(chunk);
|
||||
} else {
|
||||
BukkitUtil.refreshChunk(world, x, z);
|
||||
@ -647,7 +648,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
}
|
||||
}
|
||||
try {
|
||||
SendChunk.sendChunk(chunks);
|
||||
SendChunk.sendChunk(world, chunks);
|
||||
} catch (final Throwable e) {
|
||||
canSendChunk = false;
|
||||
for (int x = minChunkX; x <= maxChunkX; x++) {
|
||||
|
@ -2,11 +2,15 @@ package com.intellectualcrafters.plot.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
||||
@ -57,7 +61,12 @@ public class SendChunk {
|
||||
ChunkCoordIntPairCon = classChunkCoordIntPair.getConstructor(int.class, int.class);
|
||||
}
|
||||
|
||||
public static void sendChunk(final List<Chunk> chunks) {
|
||||
public static void sendChunk(String worldname, List<ChunkLoc> locs) {
|
||||
World myworld = Bukkit.getWorld(worldname);
|
||||
HashSet<Chunk> chunks = new HashSet<>();
|
||||
for (ChunkLoc loc : locs) {
|
||||
chunks.add(myworld.getChunkAt(loc.x, loc.z));
|
||||
}
|
||||
int diffx, diffz;
|
||||
final int view = Bukkit.getServer().getViewDistance() << 4;
|
||||
for (final Chunk chunk : chunks) {
|
||||
|
Loading…
Reference in New Issue
Block a user