mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-01 13:14:43 +02:00
WE unregistration + home/visit sorting + format
- WorldEdit listener unregistration for external masking/extent/async worldedit management. (wink) - Use the same listing for home and visit as previous behavior was confusing.
This commit is contained in:
@ -72,54 +72,54 @@ public class BO3Handler
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x++)
|
||||
{
|
||||
final int X = ((x + 7) - cx) >> 4;
|
||||
final int xx = (x - cx) % 16;
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z++)
|
||||
final int xx = (x - cx) % 16;
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z++)
|
||||
{
|
||||
final int Z = ((z + 7) - cz) >> 4;
|
||||
final int zz = (z - cz) % 16;
|
||||
final ChunkLoc loc = new ChunkLoc(X, Z);
|
||||
BO3 bo3 = map.get(loc);
|
||||
for (int y = 1; y < height; y++)
|
||||
{
|
||||
final PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
|
||||
if ((block != null) && !contains(cpw.MAIN_BLOCK, block))
|
||||
{
|
||||
final int Z = ((z + 7) - cz) >> 4;
|
||||
final int zz = (z - cz) % 16;
|
||||
final ChunkLoc loc = new ChunkLoc(X, Z);
|
||||
BO3 bo3 = map.get(loc);
|
||||
for (int y = 1; y < height; y++)
|
||||
if (bo3 == null)
|
||||
{
|
||||
final PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
|
||||
if ((block != null) && !contains(cpw.MAIN_BLOCK, block))
|
||||
{
|
||||
if (bo3 == null)
|
||||
{
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
content = true;
|
||||
}
|
||||
bo3.addBlock(xx, y - height - 1, zz, block);
|
||||
}
|
||||
}
|
||||
final PlotBlock floor = BlockManager.manager.getBlock(new Location(plot.world, x, height, z));
|
||||
if ((floor != null) && !contains(cpw.TOP_BLOCK, floor))
|
||||
{
|
||||
if (bo3 == null)
|
||||
{
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
content = true;
|
||||
}
|
||||
bo3.addBlock(xx, -1, zz, floor);
|
||||
}
|
||||
for (int y = height + 1; y < 256; y++)
|
||||
{
|
||||
final PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
|
||||
if ((block != null) && (block.id != 0))
|
||||
{
|
||||
if (bo3 == null)
|
||||
{
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
content = true;
|
||||
}
|
||||
bo3.addBlock(xx, y - height - 1, zz, block);
|
||||
}
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
content = true;
|
||||
}
|
||||
bo3.addBlock(xx, y - height - 1, zz, block);
|
||||
}
|
||||
}
|
||||
final PlotBlock floor = BlockManager.manager.getBlock(new Location(plot.world, x, height, z));
|
||||
if ((floor != null) && !contains(cpw.TOP_BLOCK, floor))
|
||||
{
|
||||
if (bo3 == null)
|
||||
{
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
content = true;
|
||||
}
|
||||
bo3.addBlock(xx, -1, zz, floor);
|
||||
}
|
||||
for (int y = height + 1; y < 256; y++)
|
||||
{
|
||||
final PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
|
||||
if ((block != null) && (block.id != 0))
|
||||
{
|
||||
if (bo3 == null)
|
||||
{
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
content = true;
|
||||
}
|
||||
bo3.addBlock(xx, y - height - 1, zz, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!content)
|
||||
{
|
||||
|
@ -66,6 +66,9 @@ public class MainUtil
|
||||
public static short[][] x_loc;
|
||||
public static short[][] y_loc;
|
||||
public static short[][] z_loc;
|
||||
|
||||
/**
|
||||
* This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
|
||||
*/
|
||||
public static void initCache()
|
||||
{
|
||||
@ -602,7 +605,7 @@ public class MainUtil
|
||||
return;
|
||||
}
|
||||
TaskManager.TELEPORT_QUEUE.remove(name);
|
||||
if (!player.isOnline()) {
|
||||
if (!player.isOnline()) {
|
||||
return;
|
||||
}
|
||||
sendMessage(player, C.TELEPORTED_TO_PLOT);
|
||||
@ -655,21 +658,21 @@ public class MainUtil
|
||||
final Location bot = getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
|
||||
final Location top = getPlotTopLoc(plot.world, plot.id);
|
||||
|
||||
final int bx = bot.getX() >> 4;
|
||||
final int bx = bot.getX() >> 4;
|
||||
final int bz = bot.getZ() >> 4;
|
||||
|
||||
final int tx = (top.getX() >> 4);
|
||||
|
||||
final int tx = (top.getX() >> 4);
|
||||
final int tz = (top.getZ() >> 4);
|
||||
|
||||
|
||||
final ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
|
||||
for (int x = bx; x <= tx; x++)
|
||||
{
|
||||
for (int z = bz; z <= tz; z++)
|
||||
{
|
||||
chunks.add(new ChunkLoc(x, z));
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = bx; x <= tx; x++)
|
||||
{
|
||||
for (int z = bz; z <= tz; z++)
|
||||
{
|
||||
chunks.add(new ChunkLoc(x, z));
|
||||
}
|
||||
}
|
||||
BlockUpdateUtil.setBlockManager.update(plot.world, chunks);
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ public class NbtFactory
|
||||
|
||||
LOAD_COMPOUND = READ_LIMITER_CLASS != null ?
|
||||
new LoadMethodSkinUpdate(STREAM_TOOLS, READ_LIMITER_CLASS) :
|
||||
new LoadMethodWorldUpdate(STREAM_TOOLS);
|
||||
new LoadMethodWorldUpdate(STREAM_TOOLS);
|
||||
SAVE_COMPOUND = getMethod(Modifier.STATIC, 0, STREAM_TOOLS, null, BASE_CLASS, DataOutput.class);
|
||||
|
||||
}
|
||||
@ -544,7 +544,7 @@ public class NbtFactory
|
||||
output = stream.getOutput();
|
||||
data = new DataOutputStream(
|
||||
option == StreamOptions.GZIP_COMPRESSION ? new GZIPOutputStream(output) : output
|
||||
);
|
||||
);
|
||||
|
||||
invokeMethod(get().SAVE_COMPOUND, null, source.getHandle(), data);
|
||||
suppress = false;
|
||||
|
@ -99,7 +99,7 @@ public class SetBlockQueue
|
||||
public void run()
|
||||
{
|
||||
if (locked) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if ((blocks == null) || (blocks.size() == 0))
|
||||
{
|
||||
@ -125,7 +125,7 @@ public class SetBlockQueue
|
||||
while ((blocks.size() > 0) && ((System.currentTimeMillis() - last) < (50 + allocate)))
|
||||
{
|
||||
if (locked) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
final Iterator<Entry<ChunkWrapper, PlotBlock[][]>> iter = blocks.entrySet().iterator();
|
||||
if (!iter.hasNext())
|
||||
@ -232,29 +232,29 @@ public class SetBlockQueue
|
||||
init();
|
||||
}
|
||||
final int X = x >> 4;
|
||||
final int Z = z >> 4;
|
||||
x -= X << 4;
|
||||
z -= Z << 4;
|
||||
final int Z = z >> 4;
|
||||
x -= X << 4;
|
||||
z -= Z << 4;
|
||||
|
||||
final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
||||
PlotBlock[][] result;
|
||||
result = blocks.get(wrap);
|
||||
if (!blocks.containsKey(wrap))
|
||||
{
|
||||
result = new PlotBlock[16][];
|
||||
blocks.put(wrap, result);
|
||||
}
|
||||
if ((y > 255) || (y < 0))
|
||||
{
|
||||
locked = false;
|
||||
return;
|
||||
}
|
||||
if (result[y >> 4] == null)
|
||||
{
|
||||
result[y >> 4] = new PlotBlock[4096];
|
||||
}
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = block;
|
||||
locked = false;
|
||||
final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
||||
PlotBlock[][] result;
|
||||
result = blocks.get(wrap);
|
||||
if (!blocks.containsKey(wrap))
|
||||
{
|
||||
result = new PlotBlock[16][];
|
||||
blocks.put(wrap, result);
|
||||
}
|
||||
if ((y > 255) || (y < 0))
|
||||
{
|
||||
locked = false;
|
||||
return;
|
||||
}
|
||||
if (result[y >> 4] == null)
|
||||
{
|
||||
result[y >> 4] = new PlotBlock[4096];
|
||||
}
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = block;
|
||||
locked = false;
|
||||
}
|
||||
|
||||
public static void setData(final String world, int x, final int y, int z, final byte data)
|
||||
@ -265,32 +265,32 @@ public class SetBlockQueue
|
||||
init();
|
||||
}
|
||||
final int X = x >> 4;
|
||||
final int Z = z >> 4;
|
||||
x -= X << 4;
|
||||
z -= Z << 4;
|
||||
final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
||||
PlotBlock[][] result;
|
||||
result = blocks.get(wrap);
|
||||
if (result == null)
|
||||
{
|
||||
if (blocks == null)
|
||||
{
|
||||
init();
|
||||
}
|
||||
result = new PlotBlock[16][];
|
||||
blocks.put(wrap, result);
|
||||
}
|
||||
if ((y > 255) || (y < 0))
|
||||
{
|
||||
locked = false;
|
||||
return;
|
||||
}
|
||||
if (result[y >> 4] == null)
|
||||
{
|
||||
result[y >> 4] = new PlotBlock[4096];
|
||||
}
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = new PlotBlock((short) -1, data);
|
||||
locked = false;
|
||||
final int Z = z >> 4;
|
||||
x -= X << 4;
|
||||
z -= Z << 4;
|
||||
final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
||||
PlotBlock[][] result;
|
||||
result = blocks.get(wrap);
|
||||
if (result == null)
|
||||
{
|
||||
if (blocks == null)
|
||||
{
|
||||
init();
|
||||
}
|
||||
result = new PlotBlock[16][];
|
||||
blocks.put(wrap, result);
|
||||
}
|
||||
if ((y > 255) || (y < 0))
|
||||
{
|
||||
locked = false;
|
||||
return;
|
||||
}
|
||||
if (result[y >> 4] == null)
|
||||
{
|
||||
result[y >> 4] = new PlotBlock[4096];
|
||||
}
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = new PlotBlock((short) -1, data);
|
||||
locked = false;
|
||||
}
|
||||
|
||||
public static void setBlock(final String world, int x, final int y, int z, final int id)
|
||||
@ -301,41 +301,41 @@ public class SetBlockQueue
|
||||
init();
|
||||
}
|
||||
final int X = x >> 4;
|
||||
final int Z = z >> 4;
|
||||
x -= X << 4;
|
||||
z -= Z << 4;
|
||||
final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
||||
PlotBlock[][] result;
|
||||
result = blocks.get(wrap);
|
||||
if (result == null)
|
||||
{
|
||||
if (blocks == null)
|
||||
{
|
||||
init();
|
||||
}
|
||||
result = new PlotBlock[16][];
|
||||
blocks.put(wrap, result);
|
||||
}
|
||||
if ((y > 255) || (y < 0))
|
||||
{
|
||||
locked = false;
|
||||
return;
|
||||
}
|
||||
if (result[y >> 4] == null)
|
||||
{
|
||||
result[y >> 4] = new PlotBlock[4096];
|
||||
}
|
||||
if (id == lastInt)
|
||||
{
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = lastBlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastInt = id;
|
||||
lastBlock = new PlotBlock((short) id, (byte) 0);
|
||||
}
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = lastBlock;
|
||||
locked = false;
|
||||
final int Z = z >> 4;
|
||||
x -= X << 4;
|
||||
z -= Z << 4;
|
||||
final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
||||
PlotBlock[][] result;
|
||||
result = blocks.get(wrap);
|
||||
if (result == null)
|
||||
{
|
||||
if (blocks == null)
|
||||
{
|
||||
init();
|
||||
}
|
||||
result = new PlotBlock[16][];
|
||||
blocks.put(wrap, result);
|
||||
}
|
||||
if ((y > 255) || (y < 0))
|
||||
{
|
||||
locked = false;
|
||||
return;
|
||||
}
|
||||
if (result[y >> 4] == null)
|
||||
{
|
||||
result[y >> 4] = new PlotBlock[4096];
|
||||
}
|
||||
if (id == lastInt)
|
||||
{
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = lastBlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastInt = id;
|
||||
lastBlock = new PlotBlock((short) id, (byte) 0);
|
||||
}
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = lastBlock;
|
||||
locked = false;
|
||||
}
|
||||
|
||||
public static class ChunkWrapper
|
||||
|
Reference in New Issue
Block a user