mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
More than 2 lines
This commit is contained in:
@ -726,7 +726,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
plotExit(pp, plot);
|
||||
}
|
||||
|
||||
if (BukkitMain.worldEdit != null) {
|
||||
if (BukkitMain.worldEdit != null && PS.get().worldedit != null) {
|
||||
if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) {
|
||||
if (pp.getAttribute("worldedit")) {
|
||||
pp.removeAttribute("worldedit");
|
||||
|
@ -673,22 +673,6 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
return chunks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateChunk(String world, ChunkLoc loc) {
|
||||
World worldObj = Bukkit.getWorld(world);
|
||||
worldObj.regenerateChunk(loc.x, loc.z);
|
||||
SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc));
|
||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
PlotPlayer pp = entry.getValue();
|
||||
Location pLoc = pp.getLocation();
|
||||
if (!StringMan.isEqual(world, pLoc.getWorld()) || !pLoc.getChunkLoc().equals(loc)) {
|
||||
continue;
|
||||
}
|
||||
pLoc.setY(WorldUtil.IMP.getHighestBlock(world, pLoc.getX(), pLoc.getZ()));
|
||||
pp.teleport(pLoc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean copyRegion(Location pos1, Location pos2, Location newPos, final Runnable whenDone) {
|
||||
final int relX = newPos.getX() - pos1.getX();
|
||||
|
@ -13,6 +13,7 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.SendChunk;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -37,6 +38,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
private final SendChunk sendChunk;
|
||||
private final HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
||||
private final RefMethod methodGetHandleChunk;
|
||||
private final RefMethod methodGetHandleWorld;
|
||||
private final RefMethod methodInitLighting;
|
||||
private final RefConstructor classBlockPositionConstructor;
|
||||
private final RefConstructor classChunkSectionConstructor;
|
||||
@ -50,6 +52,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
|
||||
public FastQueue_1_8_3() throws RuntimeException {
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
this.methodInitLighting = classChunk.getMethod("initLighting");
|
||||
@ -64,6 +67,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
this.methodAreNeighborsLoaded = classChunk.getMethod("areNeighborsLoaded", int.class);
|
||||
this.classChunkSectionConstructor = classChunkSection.getConstructor(int.class, boolean.class, char[].class);
|
||||
this.tileEntityListTick = classWorld.getField("tileEntityList");
|
||||
this.methodGetHandleWorld = classCraftWorld.getMethod("getHandle");
|
||||
this.methodGetWorld = classChunk.getMethod("getWorld");
|
||||
this.sendChunk = new SendChunk();
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@ -257,6 +261,17 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
return new FastChunk_1_8_3(wrap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateChunk(String worldname, ChunkLoc loc) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
Chunk chunk = world.getChunkAt(loc.x, loc.z);
|
||||
if (chunk.getTileEntities().length > 0) {
|
||||
Object w = methodGetHandleWorld.of(world).call();
|
||||
((Collection) this.tileEntityListTick.of(w).get()).clear();
|
||||
}
|
||||
super.regenerateChunk(worldname, loc);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overridden by any specialized queues
|
||||
* @param plotChunk
|
||||
|
@ -80,6 +80,18 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
MainUtil.initCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateChunk(String worldname, ChunkLoc loc) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
Chunk chunk = world.getChunkAt(loc.x, loc.z);
|
||||
if (chunk.getTileEntities().length > 0) {
|
||||
Object c = methodGetHandleChunk.of(chunk).call();
|
||||
Object w = methodGetWorld.of(c).call();
|
||||
((Collection) this.tileEntityListTick.of(w).get()).clear();
|
||||
}
|
||||
super.regenerateChunk(worldname, loc);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overridden by any specialized queues
|
||||
* @param plotChunk
|
||||
|
@ -8,6 +8,7 @@ import com.intellectualcrafters.plot.util.PlotChunk;
|
||||
import com.intellectualcrafters.plot.util.PlotQueue;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
@ -103,6 +104,11 @@ public class SlowQueue implements PlotQueue<Chunk> {
|
||||
this.blocks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateChunk(String world, ChunkLoc loc) {
|
||||
BukkitUtil.getWorld(world).regenerateChunk(loc.x, loc.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overridden by any specialized queues.
|
||||
* @param plotChunk
|
||||
|
Reference in New Issue
Block a user