mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Significantly faster clearing for new world types
This commit is contained in:
parent
b87cb614ed
commit
79f48ff7d6
@ -106,24 +106,6 @@ public class SQLManager implements AbstractDB {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// public void setTimout() {
|
||||
// TaskManager.runTask(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// try {
|
||||
// final PreparedStatement statement =
|
||||
// connection.prepareStatement("SET GLOBAL wait_timeout =28800;");
|
||||
// statement.executeQuery();
|
||||
// statement.close();
|
||||
// } catch (final SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Could not reset MySQL timout.");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* Set Plot owner
|
||||
*
|
||||
@ -508,7 +490,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* Load all plots, helpers, denied, trusted, and every setting from DB into a hashmap
|
||||
*/
|
||||
@Override
|
||||
public LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
||||
|
@ -111,12 +111,10 @@ public abstract class PlotWorld {
|
||||
* @param config Configuration Section
|
||||
*/
|
||||
public void loadDefaultConfiguration(final ConfigurationSection config) {
|
||||
if (Settings.ENABLE_CLUSTERS) {
|
||||
if (config.contains("generator.terrain")) {
|
||||
this.TERRAIN = config.getInt("generator.terrain");
|
||||
this.TYPE = config.getInt("generator.type");
|
||||
}
|
||||
}
|
||||
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
|
||||
this.AUTO_MERGE = config.getBoolean("plot.auto_merge");
|
||||
this.PLOT_BIOME = (Biome) Configuration.BIOME.parseString(config.getString("plot.biome"));
|
||||
|
@ -145,7 +145,9 @@ public class ChunkManager {
|
||||
initMaps();
|
||||
int absX = x << 4;
|
||||
int absZ = z << 4;
|
||||
boolean save = false;
|
||||
if (x == c1x || z == c1z) {
|
||||
save = true;
|
||||
for (int X = 0; X < 16; X++) {
|
||||
for (int Z = 0; Z < 16; Z++) {
|
||||
if ((X + absX < sx || Z + absZ < sz) || (X + absX > ex || Z + absZ > ez)) {
|
||||
@ -156,6 +158,7 @@ public class ChunkManager {
|
||||
}
|
||||
else if (x == c2x || z == c2z) {
|
||||
for (int X = 0; X < 16; X++) {
|
||||
save = true;
|
||||
for (int Z = 0; Z < 16; Z++) {
|
||||
if ((X + absX > ex || Z + absZ > ez) || (X + absX < sx || Z + absZ < sz)) {
|
||||
saveBlock(world, maxY, X + absX, Z + absZ);
|
||||
@ -163,10 +166,14 @@ public class ChunkManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (save) {
|
||||
saveEntities(chunk, CURRENT_PLOT_CLEAR);
|
||||
}
|
||||
world.regenerateChunk(x, z);
|
||||
if (save) {
|
||||
restoreBlocks(world, 0, 0);
|
||||
restoreEntities(world, 0, 0);
|
||||
}
|
||||
chunk.unload();
|
||||
chunk.load();
|
||||
}
|
||||
@ -217,15 +224,6 @@ public class ChunkManager {
|
||||
}
|
||||
EntityWrapper wrap = new EntityWrapper(entity, (short) 2);
|
||||
entities.add(wrap);
|
||||
|
||||
|
||||
|
||||
// int y = loc.getBlockY();
|
||||
// BlockLoc bl = new BlockLoc(x, y, z);
|
||||
// EntityWrapper wrap = new EntityWrapper(entity.getType().getTypeId());
|
||||
// entities.put(wrap, bl);
|
||||
// System.out.print(entity.isDead());
|
||||
// entity.teleport(new Location(chunk.getWorld(), 0, 65, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user