mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Fixed large roads, server crashes, and DB upgrades
Roads of 100 blocks or more will now work (WHO HAS ROADS THAT LARGE THOUGH!?) - We could see if we could block beacon effects from other plots... *The crash was due to a misconstructed for loop. Older databases will now add the missing table plot_ratings
This commit is contained in:
parent
980499a193
commit
8597117d7a
@ -84,18 +84,12 @@ public class PWE {
|
||||
}
|
||||
|
||||
public static void removeMask(Player p, LocalSession s) {
|
||||
System.out.print(0);
|
||||
try {
|
||||
System.out.print(1);
|
||||
s.setMask(null);
|
||||
System.out.print(2);
|
||||
} catch (Throwable e) {
|
||||
System.out.print(3);
|
||||
com.sk89q.worldedit.masks.Mask mask = null;
|
||||
s.setMask(mask);
|
||||
System.out.print(4);
|
||||
}
|
||||
System.out.print(5);
|
||||
}
|
||||
|
||||
public static void removeMask(Player p) {
|
||||
|
@ -739,23 +739,6 @@ public class PlotHelper {
|
||||
return new short[] { Short.parseShort(block), 0 };
|
||||
}
|
||||
|
||||
public static void teleportPlayers(World world, Plot plot, boolean tile) {
|
||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
||||
for (int i = (pos2.getBlockX() / 16) * 16; i < (16 + ((pos2.getBlockX() / 16) * 16)); i = 16) {
|
||||
for (int j = (pos1.getBlockZ() / 16) * 16; j < (16 + ((pos2.getBlockZ() / 16) * 16)); j += 16) {
|
||||
Chunk chunk = world.getChunkAt(i, j);
|
||||
for (Entity entity : chunk.getEntities()) {
|
||||
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
||||
if ((id != null) && id.equals(plot.id) && (entity.getType() == EntityType.PLAYER)) {
|
||||
entity.teleport(world.getSpawnLocation());
|
||||
// Should this teleport them to floor instead?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearAllEntities(World world, Plot plot, boolean tile) {
|
||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
||||
@ -765,7 +748,12 @@ public class PlotHelper {
|
||||
for (Entity entity : chunk.getEntities()) {
|
||||
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
||||
if ((id != null) && id.equals(plot.id)) {
|
||||
entity.remove();
|
||||
if (entity instanceof Player) {
|
||||
PlotMain.teleportPlayer((Player) entity, entity.getLocation(), plot);
|
||||
}
|
||||
else {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile) {
|
||||
@ -788,10 +776,8 @@ public class PlotHelper {
|
||||
final long start = System.nanoTime();
|
||||
final World world = requester.getWorld();
|
||||
|
||||
// clear entities:
|
||||
// clear entities/teleport players
|
||||
clearAllEntities(world, plot, false);
|
||||
// teleport players
|
||||
teleportPlayers(world, plot, false);
|
||||
|
||||
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||
PlotHelper.setBiome(requester.getWorld(), plot, Biome.FOREST);
|
||||
|
@ -608,6 +608,12 @@ public class PlotMain extends JavaPlugin {
|
||||
if (!res.next()) {
|
||||
DBFunc.createTables("mysql", false);
|
||||
}
|
||||
else {
|
||||
res = meta.getTables(null, null, "plot_ratings", null);
|
||||
if (!res.next()) {
|
||||
DBFunc.createTables("mysql", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
@ -630,6 +636,17 @@ public class PlotMain extends JavaPlugin {
|
||||
ResultSet res = meta.getTables(null, null, "plot", null);
|
||||
if (!res.next()) {
|
||||
DBFunc.createTables("sqlite", true);
|
||||
} else {
|
||||
res = meta.getTables(null, null, "plot_trusted", null);
|
||||
if (!res.next()) {
|
||||
DBFunc.createTables("sqlite", false);
|
||||
}
|
||||
else {
|
||||
res = meta.getTables(null, null, "plot_ratings", null);
|
||||
if (!res.next()) {
|
||||
DBFunc.createTables("sqlite", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
|
@ -287,6 +287,11 @@ public class WorldGenerator extends ChunkGenerator {
|
||||
// ROAD (0/24) The following is an inefficient placeholder as it is too
|
||||
// much work to finish it
|
||||
|
||||
if (pathsize>16 && ((plotMinX > roadStartX) || (plotMinZ > roadStartZ)) && !(roadStartX<16 && roadStartZ<16) && ((roadStartX>16 && roadStartZ>16) || (plotMinX > roadStartX) && (plotMinZ > roadStartZ))) {
|
||||
setCuboidRegion(0, 16, 1, this.roadheight + 1, 0, 16, this.floor1);
|
||||
return this.result;
|
||||
}
|
||||
|
||||
if (((plotMinZ + 1) <= 16) || ((roadStartZ <= 16) && (roadStartZ > 0))) {
|
||||
int start = Math.max((16 - plotMinZ - this.pathsize) + 1, (16 - roadStartZ) + 1);
|
||||
int end = Math.min(16 - plotMinZ - 1, (16 - roadStartZ) + this.pathsize);
|
||||
|
@ -159,6 +159,11 @@ public class XPopulator extends BlockPopulator {
|
||||
|
||||
// ROADS
|
||||
|
||||
if (pathsize>16 && ((plotMinX > roadStartX) || (plotMinZ > roadStartZ)) && !(roadStartX<16 && roadStartZ<16) && ((roadStartX>16 && roadStartZ>16) || (plotMinX > roadStartX) && (plotMinZ > roadStartZ))) {
|
||||
setCuboidRegion(0, 16, 1, this.roadheight + 1, 0, 16, this.f1_id, this.f1_v, w);
|
||||
return;
|
||||
}
|
||||
|
||||
if (((plotMinZ + 1) <= 16) || ((roadStartZ <= 16) && (roadStartZ > 0))) {
|
||||
int start = Math.max((16 - plotMinZ - this.pathsize) + 1, (16 - roadStartZ) + 1);
|
||||
int end = Math.min(16 - plotMinZ - 1, (16 - roadStartZ) + this.pathsize);
|
||||
|
@ -240,7 +240,6 @@ public class DBFunc {
|
||||
stmt.executeBatch();
|
||||
stmt.clearBatch();
|
||||
stmt.close();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user