mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
Finished several core parts of the sponge port
Mass block changes / chunk packet sending AsyncWorldEdit (buggy) Fixed world ground cover layers being generated Fixed tab completion Fixed plot title color Fixed worlds unloading when no players are present Fixed falling blocks not falling where they should Fixed console color Fixed chunk regeneration on full plot worlds Other stuff
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
@ -19,13 +17,11 @@ import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
/**
|
||||
* An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS)
|
||||
*
|
||||
@ -107,10 +103,6 @@ public class SendChunk {
|
||||
final Object c = methodGetHandleChunk.of(chunk).call();
|
||||
chunks.remove(chunk);
|
||||
final Object con = connection.of(entity).get();
|
||||
// if (dx != 0 || dz != 0) {
|
||||
// Object packet = MapChunk.create(c, true, 0);
|
||||
// send.of(con).call(packet);
|
||||
// }
|
||||
final Object packet = MapChunk.create(c, true, 65535);
|
||||
send.of(con).call(packet);
|
||||
}
|
||||
@ -131,55 +123,6 @@ public class SendChunk {
|
||||
}
|
||||
});
|
||||
}
|
||||
//
|
||||
//
|
||||
// int diffx, diffz;
|
||||
// << 4;
|
||||
// for (final Chunk chunk : chunks) {
|
||||
// if (!chunk.isLoaded()) {
|
||||
// continue;
|
||||
// }
|
||||
// boolean unload = true;
|
||||
// final Object c = methodGetHandle.of(chunk).call();
|
||||
// final Object w = world.of(c).get();
|
||||
// final Object p = players.of(w).get();
|
||||
// for (final Object ep : (List<Object>) p) {
|
||||
// final int x = ((Double) locX.of(ep).get()).intValue();
|
||||
// final int z = ((Double) locZ.of(ep).get()).intValue();
|
||||
// diffx = Math.abs(x - (chunk.getX() << 4));
|
||||
// diffz = Math.abs(z - (chunk.getZ() << 4));
|
||||
// if ((diffx <= view) && (diffz <= view)) {
|
||||
// unload = false;
|
||||
// if (v1_7_10) {
|
||||
// chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
|
||||
// chunk.load(true);
|
||||
// }
|
||||
// else {
|
||||
// final Object pair = ChunkCoordIntPairCon.create(chunk.getX(), chunk.getZ());
|
||||
// final Object pq = chunkCoordIntPairQueue.of(ep).get();
|
||||
// ((List) pq).add(pair);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (unload) {
|
||||
// TaskManager.runTask(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// try {
|
||||
// chunk.unload(true, true);
|
||||
// }
|
||||
// catch (Exception e) {
|
||||
// String worldname = chunk.getWorld().getName();
|
||||
// PS.debug("$4Could not save chunk: " + worldname + ";" + chunk.getX() + ";" + chunk.getZ());
|
||||
// PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||
// PS.debug("$3 - $4" + worldname + "/level.dat or " + worldname + "level_old.dat may be corrupt (try repairing
|
||||
// or removing these)");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
public void sendChunk(final String worldname, final List<ChunkLoc> locs) {
|
||||
|
@ -22,7 +22,7 @@ public class GenChunk extends PlotChunk<Chunk> {
|
||||
|
||||
public GenChunk(Chunk chunk, ChunkWrapper wrap) {
|
||||
super(wrap);
|
||||
if ((this.chunk = chunk) == null) {
|
||||
if ((this.chunk = chunk) == null && wrap != null) {
|
||||
World world = BukkitUtil.getWorld(wrap.world);
|
||||
if (world != null) {
|
||||
chunk = world.getChunkAt(wrap.x, wrap.z);
|
||||
|
Reference in New Issue
Block a user