mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Potential fixes
This commit is contained in:
parent
a93e8fac38
commit
3336d302ac
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<artifactId>PlotSquared</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.2.2</version>
|
||||
<name>PlotSquared</name>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
|
@ -291,8 +291,8 @@ public class PS {
|
||||
}
|
||||
if (!BlockManager.manager.isWorld(world) || (BlockManager.manager.isWorld(world) && !isPlotWorld(world))) {
|
||||
PS.debug("&c`" + world + "` was not properly loaded - PlotSquared will now try to load it properly: ");
|
||||
PS.debug("&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml as well");
|
||||
PS.debug("&8 - &7Your world management plugin may be faulty. Consider using an up to date plugin.");
|
||||
PS.debug("&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml");
|
||||
PS.debug("&8 - &7Your world management plugin may be faulty (or non existant)");
|
||||
IMP.setGenerator(world);
|
||||
}
|
||||
}
|
||||
|
@ -427,18 +427,19 @@ public class DebugExec extends SubCommand {
|
||||
@Override
|
||||
public void run() {
|
||||
final long start = System.currentTimeMillis();
|
||||
Object result = null;
|
||||
try {
|
||||
engine.eval(toExec, scope);
|
||||
result = engine.eval(toExec, scope);
|
||||
} catch (final ScriptException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PS.log("> " + (System.currentTimeMillis() - start) + "ms");
|
||||
PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
final long start = System.currentTimeMillis();
|
||||
engine.eval(script, scope);
|
||||
PS.log("> " + (System.currentTimeMillis() - start) + "ms");
|
||||
Object result = engine.eval(script, scope);
|
||||
PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
|
||||
}
|
||||
return true;
|
||||
} catch (final ScriptException e) {
|
||||
|
@ -101,7 +101,7 @@ public abstract class ChunkManager {
|
||||
|
||||
public abstract boolean loadChunk(final String world, final ChunkLoc loc, final boolean force);
|
||||
|
||||
public abstract boolean unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe);
|
||||
public abstract void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe);
|
||||
|
||||
public abstract Set<ChunkLoc> getChunkChunks(final String world);
|
||||
|
||||
|
@ -1172,10 +1172,8 @@ public class MainUtil {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
}
|
||||
if (!plot.owner.equals(uuid)) {
|
||||
return false;
|
||||
}
|
||||
HashSet<Plot> visited = new HashSet<>();
|
||||
HashSet<PlotId> merged = new HashSet<>();
|
||||
ArrayDeque<Plot> frontier = new ArrayDeque<>(getConnectedPlots(plot));
|
||||
Plot current;
|
||||
boolean toReturn = false;
|
||||
@ -1189,6 +1187,8 @@ public class MainUtil {
|
||||
if (other.isOwner(uuid)) {
|
||||
frontier.addAll(other.getConnectedPlots());
|
||||
mergePlot(current.world, current, other, removeRoads);
|
||||
merged.add(current.id);
|
||||
merged.add(other.id);
|
||||
toReturn = true;
|
||||
max--;
|
||||
}
|
||||
@ -1198,6 +1198,8 @@ public class MainUtil {
|
||||
if (other.isOwner(uuid)) {
|
||||
frontier.addAll(other.getConnectedPlots());
|
||||
mergePlot(current.world, current, other, removeRoads);
|
||||
merged.add(current.id);
|
||||
merged.add(other.id);
|
||||
toReturn = true;
|
||||
max--;
|
||||
}
|
||||
@ -1207,6 +1209,8 @@ public class MainUtil {
|
||||
if (other.isOwner(uuid)) {
|
||||
frontier.addAll(other.getConnectedPlots());
|
||||
mergePlot(current.world, current, other, removeRoads);
|
||||
merged.add(current.id);
|
||||
merged.add(other.id);
|
||||
toReturn = true;
|
||||
max--;
|
||||
}
|
||||
@ -1216,40 +1220,21 @@ public class MainUtil {
|
||||
if (other.isOwner(uuid)) {
|
||||
frontier.addAll(other.getConnectedPlots());
|
||||
mergePlot(current.world, current, other, removeRoads);
|
||||
merged.add(current.id);
|
||||
merged.add(other.id);
|
||||
toReturn = true;
|
||||
max--;
|
||||
}
|
||||
}
|
||||
PlotManager manager = PS.get().getPlotManager(plot.world);
|
||||
ArrayList<PlotId> ids = new ArrayList<>(visited.size());
|
||||
for (Plot visit : visited) {
|
||||
ids.add(visit.id);
|
||||
}
|
||||
manager.finishPlotMerge(PS.get().getPlotWorld(plot.world), ids);
|
||||
}
|
||||
PlotManager manager = PS.get().getPlotManager(plot.world);
|
||||
ArrayList<PlotId> ids = new ArrayList<>(merged);
|
||||
if (removeRoads) {
|
||||
manager.finishPlotMerge(plot.getWorld(), ids);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
// private static boolean ownsPlots(final String world, final ArrayList<PlotId> plots, final UUID uuid, final int dir) {
|
||||
// final PlotId id_min = plots.get(0);
|
||||
// final PlotId id_max = plots.get(plots.size() - 1);
|
||||
// for (final PlotId myid : plots) {
|
||||
// final Plot myplot = PS.get().getPlot(world, myid);
|
||||
// if ((myplot == null) || (myplot.owner == null) || !(myplot.owner.equals(uuid))) {
|
||||
// return false;
|
||||
// }
|
||||
// final PlotId top = getTopPlot(myplot).id;
|
||||
// if (((top.x > id_max.x) && (dir != 1)) || ((top.y > id_max.y) && (dir != 2))) {
|
||||
// return false;
|
||||
// }
|
||||
// final PlotId bot = getBottomPlot(myplot).id;
|
||||
// if (((bot.x < id_min.x) && (dir != 3)) || ((bot.y < id_min.y) && (dir != 0))) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public static void updateWorldBorder(final Plot plot) {
|
||||
if (!worldBorder.containsKey(plot.world)) {
|
||||
return;
|
||||
|
@ -22,15 +22,15 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
|
||||
public int X;
|
||||
public int Z;
|
||||
public String worldname;
|
||||
private World world;
|
||||
private Chunk chunk;
|
||||
|
||||
@Override
|
||||
public void populate(final World world, final Random rand, final Chunk chunk) {
|
||||
try {
|
||||
this.world = world;
|
||||
this.chunk = chunk;
|
||||
worldname = world.getName();
|
||||
X = chunk.getX() << 4;
|
||||
Z = chunk.getZ() << 4;
|
||||
X = this.chunk.getX() << 4;
|
||||
Z = this.chunk.getZ() << 4;
|
||||
if (ChunkManager.FORCE_PASTE) {
|
||||
for (short x = 0; x < 16; x++) {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
@ -92,7 +92,7 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
|
||||
*/
|
||||
public void setBlock(final int x, final int y, final int z, final byte data) {
|
||||
if (data != 0) {
|
||||
world.getBlockAt(X + x, y, Z + z).setData(data);
|
||||
chunk.getBlock(x, y, z).setData(data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
|
||||
* @param data
|
||||
*/
|
||||
public void setBlockAbs(final int x, final int y, final int z, final byte data) {
|
||||
world.getBlockAt(X + x, y, Z + z).setData(data);
|
||||
chunk.getBlock(x, y, z).setData(data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,7 +107,6 @@ public class HybridPop extends BukkitPlotPopulator {
|
||||
@Override
|
||||
public void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz) {
|
||||
PS.get().getPlotManager(world.getName());
|
||||
|
||||
int sx = (short) ((X - plotworld.ROAD_OFFSET_X) % size);
|
||||
int sz = (short) ((Z - plotworld.ROAD_OFFSET_Z) % size);
|
||||
if (sx < 0) {
|
||||
|
@ -940,8 +940,18 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) {
|
||||
return BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
|
||||
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) {
|
||||
if (!PS.get().isMainThread(Thread.currentThread())) {
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
|
||||
}
|
||||
}
|
||||
|
||||
public static void swapChunk(final World world1, final World world2, final Chunk pos1, final Chunk pos2, final RegionWrapper r1, final RegionWrapper r2) {
|
||||
|
@ -123,6 +123,7 @@ permissions:
|
||||
plots.set.home: true
|
||||
plots.merge: true
|
||||
plots.merge.other: true
|
||||
plots.merge.4: true
|
||||
plots.unlink: true
|
||||
plots.denied: true
|
||||
plots.add: true
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user