mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-21 06:44:43 +02:00
Some fixes
This commit is contained in:
@ -25,22 +25,22 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||
public class SendChunk {
|
||||
|
||||
// Ref Class
|
||||
private static final RefClass classWorld = getRefClass("{nms}.World");
|
||||
private static final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
||||
private static final RefClass classChunkCoordIntPair = getRefClass("{nms}.ChunkCoordIntPair");
|
||||
private static final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
private static final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
private static boolean v1_7_10 = PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 7, 10) && !PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 8, 0);
|
||||
private final RefClass classWorld = getRefClass("{nms}.World");
|
||||
private final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
||||
private final RefClass classChunkCoordIntPair = getRefClass("{nms}.ChunkCoordIntPair");
|
||||
private final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
private boolean v1_7_10 = PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 7, 10) && !PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 8, 0);
|
||||
// Ref Method
|
||||
private static RefMethod methodGetHandle;
|
||||
private RefMethod methodGetHandle;
|
||||
// Ref Field
|
||||
private static RefField chunkCoordIntPairQueue;
|
||||
private static RefField players;
|
||||
private static RefField locX;
|
||||
private static RefField locZ;
|
||||
private static RefField world;
|
||||
private RefField chunkCoordIntPairQueue;
|
||||
private RefField players;
|
||||
private RefField locX;
|
||||
private RefField locZ;
|
||||
private RefField world;
|
||||
// Ref Constructor
|
||||
private static RefConstructor ChunkCoordIntPairCon;
|
||||
private RefConstructor ChunkCoordIntPairCon;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -57,7 +57,7 @@ public class SendChunk {
|
||||
ChunkCoordIntPairCon = classChunkCoordIntPair.getConstructor(int.class, int.class);
|
||||
}
|
||||
|
||||
public static void sendChunk(final Collection<Chunk> chunks) {
|
||||
public void sendChunk(final Collection<Chunk> chunks) {
|
||||
int diffx, diffz;
|
||||
final int view = Bukkit.getServer().getViewDistance() << 4;
|
||||
for (final Chunk chunk : chunks) {
|
||||
@ -92,7 +92,7 @@ public class SendChunk {
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendChunk(final String worldname, final List<ChunkLoc> locs) {
|
||||
public void sendChunk(final String worldname, final List<ChunkLoc> locs) {
|
||||
final World myworld = Bukkit.getWorld(worldname);
|
||||
final ArrayList<Chunk> chunks = new ArrayList<>();
|
||||
for (final ChunkLoc loc : locs) {
|
||||
|
@ -39,16 +39,17 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
||||
* @author Empire92
|
||||
*/
|
||||
public class SetBlockFast extends BukkitSetBlockManager {
|
||||
private static final RefClass classBlock = getRefClass("{nms}.Block");
|
||||
private static final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
private static final RefClass classWorld = getRefClass("{nms}.World");
|
||||
private static final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||
private static RefMethod methodGetHandle;
|
||||
private static RefMethod methodGetChunkAt;
|
||||
private static RefMethod methodA;
|
||||
private static RefMethod methodGetById;
|
||||
private final RefClass classBlock = getRefClass("{nms}.Block");
|
||||
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
private final RefClass classWorld = getRefClass("{nms}.World");
|
||||
private final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||
private RefMethod methodGetHandle;
|
||||
private RefMethod methodGetChunkAt;
|
||||
private RefMethod methodA;
|
||||
private RefMethod methodGetById;
|
||||
private SendChunk chunksender;
|
||||
|
||||
public static HashMap<ChunkLoc, Chunk> toUpdate = new HashMap<>();
|
||||
public HashMap<ChunkLoc, Chunk> toUpdate = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -69,6 +70,7 @@ public class SetBlockFast extends BukkitSetBlockManager {
|
||||
toUpdate = new HashMap<>();
|
||||
}
|
||||
}, 20);
|
||||
this.chunksender = new SendChunk();
|
||||
}
|
||||
|
||||
private ChunkLoc lastLoc = null;
|
||||
@ -127,7 +129,7 @@ public class SetBlockFast extends BukkitSetBlockManager {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
SendChunk.sendChunk(chunks);
|
||||
chunksender.sendChunk(chunks);
|
||||
} catch (final Throwable e) {
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
|
@ -45,17 +45,18 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
||||
* @author Empire92
|
||||
*/
|
||||
public class SetBlockFast_1_8 extends BukkitSetBlockManager {
|
||||
private static final RefClass classBlock = getRefClass("{nms}.Block");
|
||||
private static final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
|
||||
private static final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
|
||||
private static final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
private static final RefClass classWorld = getRefClass("{nms}.World");
|
||||
private static final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||
private static RefMethod methodGetHandle;
|
||||
private static RefMethod methodGetChunkAt;
|
||||
private static RefMethod methodA;
|
||||
private static RefMethod methodGetByCombinedId;
|
||||
private static RefConstructor constructorBlockPosition;
|
||||
private final RefClass classBlock = getRefClass("{nms}.Block");
|
||||
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
|
||||
private final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
|
||||
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
private final RefClass classWorld = getRefClass("{nms}.World");
|
||||
private final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||
private RefMethod methodGetHandle;
|
||||
private RefMethod methodGetChunkAt;
|
||||
private RefMethod methodA;
|
||||
private RefMethod methodGetByCombinedId;
|
||||
private RefConstructor constructorBlockPosition;
|
||||
private SendChunk chunksender;
|
||||
|
||||
public static HashMap<ChunkLoc, Chunk> toUpdate = new HashMap<>();
|
||||
|
||||
@ -88,6 +89,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
|
||||
update(chunks);
|
||||
}
|
||||
}, 20);
|
||||
this.chunksender = new SendChunk();
|
||||
}
|
||||
|
||||
private ChunkLoc lastLoc = null;
|
||||
@ -345,7 +347,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
SendChunk.sendChunk(chunks);
|
||||
chunksender.sendChunk(chunks);
|
||||
} catch (final Throwable e) {
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
|
@ -31,18 +31,6 @@ public class SetBlockSlow extends BukkitSetBlockManager {
|
||||
|
||||
@Override
|
||||
public void update(final Collection<Chunk> chunks) {
|
||||
if (MainUtil.canSendChunk) {
|
||||
try {
|
||||
SendChunk.sendChunk(chunks);
|
||||
} catch (final Throwable e) {
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (Chunk chunk : chunks) {
|
||||
chunk.unload();
|
||||
chunk.load(true);
|
||||
}
|
||||
}
|
||||
// TODO nothing
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user