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:
boy0001 2015-09-13 01:19:39 +10:00
parent c386f33df8
commit 1c28a72f9c
28 changed files with 490 additions and 465 deletions

View File

@ -879,7 +879,7 @@ public class PS
return -1;
}
else if (b.getTimestamp() > a.getTimestamp()) {
return 1;
return 1;
}
return 0;
}
@ -970,7 +970,7 @@ public class PS
return -1;
}
else if (b.getTimestamp() > a.getTimestamp()) {
return 1;
return 1;
}
return 0;
}
@ -1003,7 +1003,7 @@ public class PS
return -1;
}
else if (b.getTimestamp() > a.getTimestamp()) {
return 1;
return 1;
}
return 0;
}
@ -1150,7 +1150,7 @@ public class PS
public int compare(final String a, final String b)
{
if ((priorityWorld != null) && StringMan.isEqual(a, priorityWorld)) {
return -1;
return -1;
}
return a.hashCode() - b.hashCode();
}

View File

@ -21,6 +21,8 @@
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@ -51,7 +53,16 @@ public class Home extends SubCommand
@Override
public boolean onCommand(final PlotPlayer plr, String[] args)
{
final ArrayList<Plot> plots = PS.get().sortPlotsByTemp(PS.get().getPlots(plr));//PS.get().sortPlots(PS.get().getPlots(plr), SortType.CREATION_DATE, null);
final Set<Plot> all = PS.get().getPlots(plr);
final Iterator<Plot> iter = all.iterator();
while (iter.hasNext())
{
if (!iter.next().isBasePlot())
{
iter.remove();
}
}
final ArrayList<Plot> plots = PS.get().sortPlotsByTemp(all);
if (plots.size() == 1)
{
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));

View File

@ -159,12 +159,12 @@ public class Info extends SubCommand
final UUID uuid = player.getUUID();
final String name = MainUtil.getName(plot.owner);
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info", new String[] {
"&cID: &6" + plot.getId().toString(),
"&cOwner: &6" + name,
"&cAlias: &6" + plot.getSettings().getAlias(),
"&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(),
"&cCan Build: &6" + plot.isAdded(uuid),
"&cIs Denied: &6" + plot.isDenied(uuid) }));
"&cID: &6" + plot.getId().toString(),
"&cOwner: &6" + name,
"&cAlias: &6" + plot.getSettings().getAlias(),
"&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(),
"&cCan Build: &6" + plot.isAdded(uuid),
"&cIs Denied: &6" + plot.isDenied(uuid) }));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cTrusted", new String[] { "&cAmount: &6" + plot.getTrusted().size(), "&8Click to view a list of the trusted users" }));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cMembers", new String[] { "&cAmount: &6" + plot.getMembers().size(), "&8Click to view a list of plot members" }));
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cDenied", new String[] { "&cDenied", "&cAmount: &6" + plot.getDenied().size(), "&8Click to view a list of denied players" }));

View File

@ -61,7 +61,7 @@ public class MusicSubcommand extends SubCommand
{
final PlotItemStack item = getItem(index);
if (item == null) {
return true;
return true;
}
final int id = item.id == 7 ? 0 : item.id;
if (id == 0)

View File

@ -21,6 +21,7 @@
package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
@ -114,6 +115,14 @@ public class Visit extends SubCommand
}
final Plot plot = plots.get(index);
final Iterator<Plot> iter = plots.iterator();
while (iter.hasNext())
{
if (!iter.next().isBasePlot())
{
iter.remove();
}
}
if (!plot.hasOwner())
{
if (!Permissions.hasPermission(plr, "plots.visit.unowned"))

View File

@ -248,7 +248,7 @@ public class list extends SubCommand
if (MathMan.isInteger(va))
{
if (MathMan.isInteger(vb)) {
return Integer.parseInt(vb) - Integer.parseInt(va);
return Integer.parseInt(vb) - Integer.parseInt(va);
}
return -1;
}
@ -296,7 +296,7 @@ public class list extends SubCommand
v2 += p2s;
}
if ((v2 == v1) && (v2 != 0)) {
return p2s - p1s;
return p2s - p1s;
}
return (int) Math.signum(v2 - v1);
}

View File

@ -148,7 +148,7 @@ public class Configuration
public String parseString(final String string)
{
if (validateValue(string)) {
return string.toUpperCase();
return string.toUpperCase();
}
return "FOREST";
}
@ -209,7 +209,7 @@ public class Configuration
}
final StringComparison<PlotBlock>.ComparisonResult value = BlockManager.manager.getClosestBlock(block);
if ((value == null) || (value.match > 1)) {
return false;
return false;
}
}
return true;

View File

@ -215,9 +215,9 @@ public class Settings
* MongoDB enabled?
*/
public static boolean USE_MONGO = false; /*
* TODO: Implement Mongo
* @Brandon
*/
* TODO: Implement Mongo
* @Brandon
*/
/**
* SQLite enabled?
*/

View File

@ -2289,9 +2289,9 @@ public class SQLManager implements AbstractDB
public PreparedStatement get() throws SQLException
{
if (plot != null) {
return connection.prepareStatement("DELETE FROM `"
+ prefix
+ "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `comment` = ? AND `inbox` = ? AND `sender` = ?");
return connection.prepareStatement("DELETE FROM `"
+ prefix
+ "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `comment` = ? AND `inbox` = ? AND `sender` = ?");
}
return connection.prepareStatement("DELETE FROM `" + prefix + "plot_comments` WHERE `comment` = ? AND `inbox` = ? AND `sender` = ?");
}
@ -2322,7 +2322,7 @@ public class SQLManager implements AbstractDB
public PreparedStatement get() throws SQLException
{
if (plot != null) {
return connection.prepareStatement("DELETE FROM `" + prefix + "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `inbox` = ?");
return connection.prepareStatement("DELETE FROM `" + prefix + "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `inbox` = ?");
}
return connection.prepareStatement("DELETE FROM `" + prefix + "plot_comments` `inbox` = ?");
}
@ -2353,7 +2353,7 @@ public class SQLManager implements AbstractDB
public PreparedStatement get() throws SQLException
{
if (plot != null) {
return connection.prepareStatement("SELECT * FROM `" + prefix + "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `inbox` = ?");
return connection.prepareStatement("SELECT * FROM `" + prefix + "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `inbox` = ?");
}
return connection.prepareStatement("SELECT * FROM `" + prefix + "plot_comments` WHERE `inbox` = ?");
}

View File

@ -154,7 +154,8 @@ public class Plot
* @param id
* @return
*/
public static Plot getPlot(String world, PlotId id) {
public static Plot getPlot(final String world, final PlotId id)
{
return MainUtil.getPlot(world, id);
}
@ -166,7 +167,8 @@ public class Plot
* @param loc
* @return
*/
public static Plot getPlot(Location loc) {
public static Plot getPlot(final Location loc)
{
return MainUtil.getPlot(loc);
}

View File

@ -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)
{

View File

@ -66,6 +66,9 @@ public class MainUtil
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()
{
if (x_loc == null)
@ -602,7 +605,7 @@ public class MainUtil
}
TaskManager.TELEPORT_QUEUE.remove(name);
if (!player.isOnline()) {
return;
return;
}
sendMessage(player, C.TELEPORTED_TO_PLOT);
player.teleport(location);
@ -655,21 +658,21 @@ public class MainUtil
final Location top = getPlotTopLoc(plot.world, plot.id);
final int bx = bot.getX() >> 4;
final int bz = bot.getZ() >> 4;
final int bz = bot.getZ() >> 4;
final int tx = (top.getX() >> 4);
final int tz = (top.getZ() >> 4);
final int tx = (top.getX() >> 4);
final int tz = (top.getZ() >> 4);
final ArrayList<ChunkLoc> chunks = new ArrayList<>();
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));
}
}
BlockUpdateUtil.setBlockManager.update(plot.world, chunks);
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);
}
public static void createWorld(final String world, final String generator)

View File

@ -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;

View File

@ -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

View File

@ -563,7 +563,7 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
return this;
}
*/
*/
/**
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.

View File

@ -372,7 +372,7 @@ public class EntityWrapper
}
case ARMOR_STAND:
{ // NEW
// CHECK positions
// CHECK positions
final ArmorStand stand = (ArmorStand) entity;
inventory = new ItemStack[] { stand.getItemInHand().clone(), stand.getHelmet().clone(), stand.getChestplate().clone(), stand.getLeggings().clone(), stand.getBoots().clone() };
storeLiving((LivingEntity) entity);
@ -665,7 +665,7 @@ public class EntityWrapper
}
case ARMOR_STAND:
{ // NEW
// CHECK positions
// CHECK positions
final ArmorStand stand = (ArmorStand) entity;
if (inventory[0] != null)
{

View File

@ -315,181 +315,181 @@ public class BukkitChunkManager extends ChunkManager
final int p2x = pos2.getX();
final int p2z = pos2.getZ();
final int bcx = p1x >> 4;
final int bcz = p1z >> 4;
final int tcx = p2x >> 4;
final int tcz = p2z >> 4;
final int bcz = p1z >> 4;
final int tcx = p2x >> 4;
final int tcz = p2z >> 4;
final boolean canRegen = ((plotworld.TYPE != 0) && (plotworld.TERRAIN == 0));
final boolean canRegen = ((plotworld.TYPE != 0) && (plotworld.TERRAIN == 0));
final ArrayList<ChunkLoc> chunks = new ArrayList<ChunkLoc>();
final ArrayList<ChunkLoc> chunks = new ArrayList<ChunkLoc>();
for (int x = bcx; x <= tcx; x++)
{
for (int z = bcz; z <= tcz; z++)
{
chunks.add(new ChunkLoc(x, z));
}
}
AugmentedPopulator augpop = null;
final World worldObj = Bukkit.getWorld(world);
final List<BlockPopulator> populators = worldObj.getPopulators();
for (final BlockPopulator populator : populators)
{
if (populator instanceof AugmentedPopulator)
{
final AugmentedPopulator current = ((AugmentedPopulator) populator);
if (current.cluster == null)
for (int x = bcx; x <= tcx; x++)
{
augpop = current;
break;
}
else if (ClusterManager.contains(current.cluster, pos1))
{
augpop = current;
break;
}
}
}
final Random r = new Random(System.currentTimeMillis());
final AugmentedPopulator ap = augpop;
TaskManager.runTask(new Runnable()
{
@Override
public void run()
{
final long start = System.currentTimeMillis();
while ((chunks.size() > 0) && ((System.currentTimeMillis() - start) < 5))
{
final ChunkLoc chunk = chunks.remove(0);
final int x = chunk.x;
final int z = chunk.z;
final int xxb = x << 4;
final int zzb = z << 4;
final int xxt = xxb + 15;
final int zzt = zzb + 15;
CURRENT_PLOT_CLEAR = null;
final Chunk chunkObj = worldObj.getChunkAt(x, z);
if (!chunkObj.load(false))
for (int z = bcz; z <= tcz; z++)
{
continue;
chunks.add(new ChunkLoc(x, z));
}
CURRENT_PLOT_CLEAR = new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
if ((xxb >= p1x) && (xxt <= p2x) && (zzb >= p1z) && (zzt <= p2z))
}
AugmentedPopulator augpop = null;
final World worldObj = Bukkit.getWorld(world);
final List<BlockPopulator> populators = worldObj.getPopulators();
for (final BlockPopulator populator : populators)
{
if (populator instanceof AugmentedPopulator)
{
if (canRegen && (ap != null))
final AugmentedPopulator current = ((AugmentedPopulator) populator);
if (current.cluster == null)
{
ap.populate(worldObj, r, chunkObj);
augpop = current;
break;
}
else if (ClusterManager.contains(current.cluster, pos1))
{
augpop = current;
break;
}
}
}
final Random r = new Random(System.currentTimeMillis());
final AugmentedPopulator ap = augpop;
TaskManager.runTask(new Runnable()
{
@Override
public void run()
{
final long start = System.currentTimeMillis();
while ((chunks.size() > 0) && ((System.currentTimeMillis() - start) < 5))
{
final ChunkLoc chunk = chunks.remove(0);
final int x = chunk.x;
final int z = chunk.z;
final int xxb = x << 4;
final int zzb = z << 4;
final int xxt = xxb + 15;
final int zzt = zzb + 15;
CURRENT_PLOT_CLEAR = null;
final Chunk chunkObj = worldObj.getChunkAt(x, z);
if (!chunkObj.load(false))
{
continue;
}
CURRENT_PLOT_CLEAR = new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
if ((xxb >= p1x) && (xxt <= p2x) && (zzb >= p1z) && (zzt <= p2z))
{
if (canRegen && (ap != null))
{
ap.populate(worldObj, r, chunkObj);
}
else
{
regenerateChunk(world, chunk);
}
continue;
}
boolean checkX1 = false;
boolean checkX2 = false;
boolean checkZ1 = false;
boolean checkZ2 = false;
int xxb2;
int zzb2;
int xxt2;
int zzt2;
if (x == bcx)
{
xxb2 = p1x - 1;
checkX1 = true;
}
else
{
xxb2 = xxb;
}
if (x == tcx)
{
xxt2 = p2x + 1;
checkX2 = true;
}
else
{
xxt2 = xxt;
}
if (z == bcz)
{
zzb2 = p1z - 1;
checkZ1 = true;
}
else
{
zzb2 = zzb;
}
if (z == tcz)
{
zzt2 = p2z + 1;
checkZ2 = true;
}
else
{
zzt2 = zzt;
}
initMaps();
if (checkX1)
{
saveRegion(worldObj, xxb, xxb2, zzb2, zzt2); //
}
if (checkX2)
{
saveRegion(worldObj, xxt2, xxt, zzb2, zzt2); //
}
if (checkZ1)
{
saveRegion(worldObj, xxb2, xxt2, zzb, zzb2); //
}
if (checkZ2)
{
saveRegion(worldObj, xxb2, xxt2, zzt2, zzt); //
}
if (checkX1 && checkZ1)
{
saveRegion(worldObj, xxb, xxb2, zzb, zzb2); //
}
if (checkX2 && checkZ1)
{
saveRegion(worldObj, xxt2, xxt, zzb, zzb2); // ?
}
if (checkX1 && checkZ2)
{
saveRegion(worldObj, xxb, xxb2, zzt2, zzt); // ?
}
if (checkX2 && checkZ2)
{
saveRegion(worldObj, xxt2, xxt, zzt2, zzt); //
}
saveEntitiesOut(chunkObj, CURRENT_PLOT_CLEAR);
if (canRegen && (ap != null))
{
ap.populate(worldObj, r, chunkObj);
}
else
{
regenerateChunk(world, chunk);
}
restoreBlocks(worldObj, 0, 0);
restoreEntities(worldObj, 0, 0);
}
CURRENT_PLOT_CLEAR = null;
if (chunks.size() != 0)
{
TaskManager.runTaskLater(this, 1);
}
else
{
regenerateChunk(world, chunk);
TaskManager.runTaskLater(whenDone, 1);
}
continue;
}
boolean checkX1 = false;
boolean checkX2 = false;
boolean checkZ1 = false;
boolean checkZ2 = false;
int xxb2;
int zzb2;
int xxt2;
int zzt2;
if (x == bcx)
{
xxb2 = p1x - 1;
checkX1 = true;
}
else
{
xxb2 = xxb;
}
if (x == tcx)
{
xxt2 = p2x + 1;
checkX2 = true;
}
else
{
xxt2 = xxt;
}
if (z == bcz)
{
zzb2 = p1z - 1;
checkZ1 = true;
}
else
{
zzb2 = zzb;
}
if (z == tcz)
{
zzt2 = p2z + 1;
checkZ2 = true;
}
else
{
zzt2 = zzt;
}
initMaps();
if (checkX1)
{
saveRegion(worldObj, xxb, xxb2, zzb2, zzt2); //
}
if (checkX2)
{
saveRegion(worldObj, xxt2, xxt, zzb2, zzt2); //
}
if (checkZ1)
{
saveRegion(worldObj, xxb2, xxt2, zzb, zzb2); //
}
if (checkZ2)
{
saveRegion(worldObj, xxb2, xxt2, zzt2, zzt); //
}
if (checkX1 && checkZ1)
{
saveRegion(worldObj, xxb, xxb2, zzb, zzb2); //
}
if (checkX2 && checkZ1)
{
saveRegion(worldObj, xxt2, xxt, zzb, zzb2); // ?
}
if (checkX1 && checkZ2)
{
saveRegion(worldObj, xxb, xxb2, zzt2, zzt); // ?
}
if (checkX2 && checkZ2)
{
saveRegion(worldObj, xxt2, xxt, zzt2, zzt); //
}
saveEntitiesOut(chunkObj, CURRENT_PLOT_CLEAR);
if (canRegen && (ap != null))
{
ap.populate(worldObj, r, chunkObj);
}
else
{
regenerateChunk(world, chunk);
}
restoreBlocks(worldObj, 0, 0);
restoreEntities(worldObj, 0, 0);
}
CURRENT_PLOT_CLEAR = null;
if (chunks.size() != 0)
{
TaskManager.runTaskLater(this, 1);
}
else
{
TaskManager.runTaskLater(whenDone, 1);
}
}
});
return true;
});
return true;
}
public static void initMaps()
@ -1293,91 +1293,91 @@ public class BukkitChunkManager extends ChunkManager
final Location bot = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
final Location top = MainUtil.getPlotTopLoc(plot.world, plot.id);
final int bx = bot.getX() >> 4;
final int bz = bot.getZ() >> 4;
final int bz = bot.getZ() >> 4;
final int tx = top.getX() >> 4;
final int tz = top.getZ() >> 4;
final int tx = top.getX() >> 4;
final int tz = top.getZ() >> 4;
final int size = (tx - bx) << 4;
final int size = (tx - bx) << 4;
final HashSet<Chunk> chunks = new HashSet<>();
for (int X = bx; X <= tx; X++)
{
for (int Z = bz; Z <= tz; Z++)
{
chunks.add(world.getChunkAt(X, Z));
}
}
boolean doWhole = false;
List<Entity> entities = null;
if (size > 200)
{
entities = world.getEntities();
if (entities.size() < (16 + ((size * size) / 64)))
{
doWhole = true;
}
}
if (doWhole)
{
for (final Entity entity : entities)
{
if (!((entity instanceof Creature) || (entity instanceof Vehicle)))
{
continue;
}
final org.bukkit.Location loc = entity.getLocation();
final Chunk chunk = loc.getChunk();
if (chunks.contains(chunk))
{
final int X = chunk.getX();
final int Z = chunk.getX();
if ((X > bx) && (X < tx) && (Z > bz) && (Z < tz))
{
count(count, entity);
}
else
{
final PlotId id = MainUtil.getPlotId(BukkitUtil.getLocation(loc));
if (plot.id.equals(id))
final HashSet<Chunk> chunks = new HashSet<>();
for (int X = bx; X <= tx; X++)
{
count(count, entity);
for (int Z = bz; Z <= tz; Z++)
{
chunks.add(world.getChunkAt(X, Z));
}
}
}
}
}
}
else
{
for (final Chunk chunk : chunks)
{
final int X = chunk.getX();
final int Z = chunk.getX();
final Entity[] ents = chunk.getEntities();
for (final Entity entity : ents)
{
if (!((entity instanceof Creature) || (entity instanceof Vehicle)))
{
continue;
}
if ((X == bx) || (X == tx) || (Z == bz) || (Z == tz))
{
final PlotId id = MainUtil.getPlotId(BukkitUtil.getLocation(entity));
if (plot.id.equals(id))
boolean doWhole = false;
List<Entity> entities = null;
if (size > 200)
{
count(count, entity);
entities = world.getEntities();
if (entities.size() < (16 + ((size * size) / 64)))
{
doWhole = true;
}
}
}
else
{
count(count, entity);
}
}
}
}
return count;
if (doWhole)
{
for (final Entity entity : entities)
{
if (!((entity instanceof Creature) || (entity instanceof Vehicle)))
{
continue;
}
final org.bukkit.Location loc = entity.getLocation();
final Chunk chunk = loc.getChunk();
if (chunks.contains(chunk))
{
final int X = chunk.getX();
final int Z = chunk.getX();
if ((X > bx) && (X < tx) && (Z > bz) && (Z < tz))
{
count(count, entity);
}
else
{
final PlotId id = MainUtil.getPlotId(BukkitUtil.getLocation(loc));
if (plot.id.equals(id))
{
count(count, entity);
}
}
}
}
}
else
{
for (final Chunk chunk : chunks)
{
final int X = chunk.getX();
final int Z = chunk.getX();
final Entity[] ents = chunk.getEntities();
for (final Entity entity : ents)
{
if (!((entity instanceof Creature) || (entity instanceof Vehicle)))
{
continue;
}
if ((X == bx) || (X == tx) || (Z == bz) || (Z == tz))
{
final PlotId id = MainUtil.getPlotId(BukkitUtil.getLocation(entity));
if (plot.id.equals(id))
{
count(count, entity);
}
}
else
{
count(count, entity);
}
}
}
}
return count;
}
private void count(final int[] count, final Entity entity)

View File

@ -54,7 +54,7 @@ public class BukkitHybridUtils extends HybridUtils
final World world = Bukkit.getWorld(plot.world);
final ChunkGenerator gen = world.getGenerator();
if (gen == null) {
return;
return;
}
final BiomeGrid base = new BiomeGrid()
{

View File

@ -79,7 +79,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager
public void run()
{
if (toUpdate.size() == 0) {
return;
return;
}
int count = 0;
final ArrayList<Chunk> chunks = new ArrayList<Chunk>();
@ -91,7 +91,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager
count++;
}
if (count == 0) {
return;
return;
}
update(chunks);
}
@ -336,24 +336,24 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager
// End blockstate workaround //
final int X = x >> 4;
final int Z = z >> 4;
final ChunkLoc loc = new ChunkLoc(X, Z);
if (!loc.equals(lastLoc))
{
Chunk chunk = toUpdate.get(loc);
if (chunk == null)
{
chunk = world.getChunkAt(X, Z);
toUpdate.put(loc, chunk);
}
chunk.load(false);
}
// check sign
final Object w = methodGetHandle.of(world).call();
final Object chunk = methodGetChunkAt.of(w).call(x >> 4, z >> 4);
final Object pos = constructorBlockPosition.create(x & 0x0f, y, z & 0x0f);
final Object combined = methodGetByCombinedId.of(null).call(id + (data << 12));
methodA.of(chunk).call(pos, combined);
final int Z = z >> 4;
final ChunkLoc loc = new ChunkLoc(X, Z);
if (!loc.equals(lastLoc))
{
Chunk chunk = toUpdate.get(loc);
if (chunk == null)
{
chunk = world.getChunkAt(X, Z);
toUpdate.put(loc, chunk);
}
chunk.load(false);
}
// check sign
final Object w = methodGetHandle.of(world).call();
final Object chunk = methodGetChunkAt.of(w).call(x >> 4, z >> 4);
final Object pos = constructorBlockPosition.create(x & 0x0f, y, z & 0x0f);
final Object combined = methodGetByCombinedId.of(null).call(id + (data << 12));
methodA.of(chunk).call(pos, combined);
}
@Override

View File

@ -79,13 +79,13 @@ public class CommandManager<T extends CommandCaller>
public int compare(final Command<T> a, final Command<T> b)
{
if (a == b) {
return 0;
return 0;
}
if (a == null) {
return -1;
return -1;
}
if (b == null) {
return 1;
return 1;
}
return a.getCommand().compareTo(b.getCommand());
}

View File

@ -36,7 +36,7 @@ public class WESubscriber
final WorldEdit worldedit = PS.get().worldedit;
if (worldedit == null)
{
worldedit.getEventBus().unregister(this);
WorldEdit.getInstance().getEventBus().unregister(this);
return;
}
final World worldObj = event.getWorld();

View File

@ -293,7 +293,7 @@ public class SpongeMain implements IPlotMain, PluginContainer
PS.get().loadWorld(world, wrapper);
switch (plotworld.TYPE)
{
// Normal
// Normal
case 0:
{
modify = new WorldModify(generator, false);

View File

@ -230,18 +230,18 @@ public class AugmentedPopulator implements Populator
public void setBlock(final int x, final int y, final int z, final BlockState t)
{
if (check && (((z) < bz) || ((z) > tz) || ((x) < bx) || ((x) > tx))) {
return;
return;
}
if (p)
{
if (ChunkManager.CURRENT_PLOT_CLEAR != null)
{
if (ChunkManager.CURRENT_PLOT_CLEAR.isIn(x, z)) {
return;
return;
}
}
else if (manager.getPlotIdAbs(plotworld, x, 0, z) != null) {
return;
return;
}
}
final PlotBlock block = SpongeMain.THIS.getPlotBlock(t);
@ -315,18 +315,18 @@ public class AugmentedPopulator implements Populator
public void setBlockType(final int x, final int y, final int z, final BlockType t)
{
if (check && (((z) < bz) || ((z) > tz) || ((x) < bx) || ((x) > tx))) {
return;
return;
}
if (p)
{
if (ChunkManager.CURRENT_PLOT_CLEAR != null)
{
if (ChunkManager.CURRENT_PLOT_CLEAR.isIn(x, z)) {
return;
return;
}
}
else if (manager.getPlotIdAbs(plotworld, x, 0, z) != null) {
return;
return;
}
}
final PlotBlock block = SpongeMain.THIS.getPlotBlock(t.getDefaultState());

View File

@ -119,7 +119,7 @@ public class MainListener
public boolean apply(final org.spongepowered.api.world.Location<World> loc)
{
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(loc)))) {
return false;
return false;
}
return true;
}
@ -323,7 +323,7 @@ public class MainListener
public boolean apply(final org.spongepowered.api.world.Location loc)
{
if (MainUtil.isPlotRoad(SpongeUtil.getLocation(worldname, loc))) {
return false;
return false;
}
return true;
}
@ -427,7 +427,7 @@ public class MainListener
public boolean apply(final org.spongepowered.api.world.Location loc)
{
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(loc)))) {
return false;
return false;
}
return true;
}
@ -438,7 +438,7 @@ public class MainListener
public boolean apply(final Entity entity)
{
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(entity)))) {
return false;
return false;
}
return true;
}
@ -457,7 +457,7 @@ public class MainListener
public boolean apply(final Entity entity)
{
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(entity)))) {
return false;
return false;
}
return true;
}
@ -474,7 +474,7 @@ public class MainListener
public boolean apply(final org.spongepowered.api.world.Location loc)
{
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(loc)))) {
return false;
return false;
}
return true;
}
@ -485,7 +485,7 @@ public class MainListener
public boolean apply(final Entity entity)
{
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(entity)))) {
return false;
return false;
}
return true;
}

Binary file not shown.

Binary file not shown.