mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +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) {
|
public static void removeMask(Player p, LocalSession s) {
|
||||||
System.out.print(0);
|
|
||||||
try {
|
try {
|
||||||
System.out.print(1);
|
|
||||||
s.setMask(null);
|
s.setMask(null);
|
||||||
System.out.print(2);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
System.out.print(3);
|
|
||||||
com.sk89q.worldedit.masks.Mask mask = null;
|
com.sk89q.worldedit.masks.Mask mask = null;
|
||||||
s.setMask(mask);
|
s.setMask(mask);
|
||||||
System.out.print(4);
|
|
||||||
}
|
}
|
||||||
System.out.print(5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeMask(Player p) {
|
public static void removeMask(Player p) {
|
||||||
|
@ -739,23 +739,6 @@ public class PlotHelper {
|
|||||||
return new short[] { Short.parseShort(block), 0 };
|
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) {
|
public static void clearAllEntities(World world, Plot plot, boolean tile) {
|
||||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
final Location pos2 = getPlotTopLoc(world, plot.id);
|
||||||
@ -765,9 +748,14 @@ public class PlotHelper {
|
|||||||
for (Entity entity : chunk.getEntities()) {
|
for (Entity entity : chunk.getEntities()) {
|
||||||
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
||||||
if ((id != null) && id.equals(plot.id)) {
|
if ((id != null) && id.equals(plot.id)) {
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
PlotMain.teleportPlayer((Player) entity, entity.getLocation(), plot);
|
||||||
|
}
|
||||||
|
else {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (tile) {
|
if (tile) {
|
||||||
for (BlockState entity : chunk.getTileEntities()) {
|
for (BlockState entity : chunk.getTileEntities()) {
|
||||||
entity.setRawData((byte) 0);
|
entity.setRawData((byte) 0);
|
||||||
@ -788,10 +776,8 @@ public class PlotHelper {
|
|||||||
final long start = System.nanoTime();
|
final long start = System.nanoTime();
|
||||||
final World world = requester.getWorld();
|
final World world = requester.getWorld();
|
||||||
|
|
||||||
// clear entities:
|
// clear entities/teleport players
|
||||||
clearAllEntities(world, plot, false);
|
clearAllEntities(world, plot, false);
|
||||||
// teleport players
|
|
||||||
teleportPlayers(world, plot, false);
|
|
||||||
|
|
||||||
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
PlotHelper.setBiome(requester.getWorld(), plot, Biome.FOREST);
|
PlotHelper.setBiome(requester.getWorld(), plot, Biome.FOREST);
|
||||||
|
@ -608,6 +608,12 @@ public class PlotMain extends JavaPlugin {
|
|||||||
if (!res.next()) {
|
if (!res.next()) {
|
||||||
DBFunc.createTables("mysql", false);
|
DBFunc.createTables("mysql", false);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
res = meta.getTables(null, null, "plot_ratings", null);
|
||||||
|
if (!res.next()) {
|
||||||
|
DBFunc.createTables("mysql", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
@ -630,6 +636,17 @@ public class PlotMain extends JavaPlugin {
|
|||||||
ResultSet res = meta.getTables(null, null, "plot", null);
|
ResultSet res = meta.getTables(null, null, "plot", null);
|
||||||
if (!res.next()) {
|
if (!res.next()) {
|
||||||
DBFunc.createTables("sqlite", true);
|
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) {
|
} 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
|
// ROAD (0/24) The following is an inefficient placeholder as it is too
|
||||||
// much work to finish it
|
// 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))) {
|
if (((plotMinZ + 1) <= 16) || ((roadStartZ <= 16) && (roadStartZ > 0))) {
|
||||||
int start = Math.max((16 - plotMinZ - this.pathsize) + 1, (16 - roadStartZ) + 1);
|
int start = Math.max((16 - plotMinZ - this.pathsize) + 1, (16 - roadStartZ) + 1);
|
||||||
int end = Math.min(16 - plotMinZ - 1, (16 - roadStartZ) + this.pathsize);
|
int end = Math.min(16 - plotMinZ - 1, (16 - roadStartZ) + this.pathsize);
|
||||||
|
@ -159,6 +159,11 @@ public class XPopulator extends BlockPopulator {
|
|||||||
|
|
||||||
// ROADS
|
// 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))) {
|
if (((plotMinZ + 1) <= 16) || ((roadStartZ <= 16) && (roadStartZ > 0))) {
|
||||||
int start = Math.max((16 - plotMinZ - this.pathsize) + 1, (16 - roadStartZ) + 1);
|
int start = Math.max((16 - plotMinZ - this.pathsize) + 1, (16 - roadStartZ) + 1);
|
||||||
int end = Math.min(16 - plotMinZ - 1, (16 - roadStartZ) + this.pathsize);
|
int end = Math.min(16 - plotMinZ - 1, (16 - roadStartZ) + this.pathsize);
|
||||||
|
@ -240,7 +240,6 @@ public class DBFunc {
|
|||||||
stmt.executeBatch();
|
stmt.executeBatch();
|
||||||
stmt.clearBatch();
|
stmt.clearBatch();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user