diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml
index 23648cfb2..1719432e9 100644
--- a/PlotSquared/pom.xml
+++ b/PlotSquared/pom.xml
@@ -8,7 +8,7 @@
UTF-8
PlotSquared
- 2.8.4
+ 2.8.7
PlotSquared
jar
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java
index af0964ecb..9e75b9eda 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java
@@ -198,6 +198,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
+ PlotSquared.GEN_WORLD = world;
if (!PlotSquared.setupPlotWorld(world, id)) {
return null;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java
index 3ead9f356..9b92739c0 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java
@@ -72,6 +72,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
public class PlotSquared {
public static final String MAIN_PERMISSION = "plots.use";
public static final String ADMIN_PERMISSION = "plots.admin";
+ public static String GEN_WORLD = "__PLACEHOLDER__";
public static File styleFile;
public static YamlConfiguration style;
public static File configFile;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
index 28c2b6a53..ec3c16b65 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
@@ -46,11 +48,11 @@ public class Home extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, String... args) {
- final Plot[] plots = PlotSquared.getPlots(plr).toArray(new Plot[0]);
- if (plots.length == 1) {
- MainUtil.teleportPlayer(plr, plr.getLocation(), plots[0]);
+ final ArrayList plots = PlotSquared.sortPlots(PlotSquared.getPlots(plr), plr.getLocation().getWorld());
+ if (plots.size() == 1) {
+ MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
return true;
- } else if (plots.length > 1) {
+ } else if (plots.size() > 1) {
if (args.length < 1) {
args = new String[] { "1" };
}
@@ -72,11 +74,11 @@ public class Home extends SubCommand {
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
return true;
}
- if ((id > (plots.length)) || (id < 1)) {
+ if ((id > (plots.size())) || (id < 1)) {
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
return false;
}
- MainUtil.teleportPlayer(plr, plr.getLocation(), plots[id - 1]);
+ MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(id - 1));
return true;
} else {
MainUtil.sendMessage(plr, C.NO_PLOTS);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
index 65c996dc3..facfbad9a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
@@ -55,7 +55,7 @@ public class Visit extends SubCommand {
final UUID uuid = UUIDHandler.getUUID(username);
List plots = null;
if (uuid != null) {
- plots = getPlots(uuid);
+ plots = PlotSquared.sortPlots(getPlots(uuid), plr.getLocation().getWorld());
}
if ((uuid == null) || plots.isEmpty()) {
return sendMessage(plr, C.FOUND_NO_PLOTS);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
index 3f31b270b..c430217aa 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
@@ -347,7 +347,6 @@ public class FlagManager {
split = flagstrings.get(i).split(":");
}
if (split.length == 1) {
- System.out.print(split[0]);
flags[i] = new Flag(getFlag(split[0], true), "");
} else {
flags[i] = new Flag(getFlag(split[0], true), split[1]);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java
index 7b0f4090a..61fda9480 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java
@@ -115,12 +115,14 @@ public class BukkitHybridUtils extends HybridUtils {
if (LAST == 0) {
LAST = System.currentTimeMillis();
}
- AV = (System.currentTimeMillis() - LAST + AV) / 2;
- if (AV < 1050) {
+ long current = System.currentTimeMillis() - LAST;
+ AV = Math.max(current, (current + AV * 5) / 6);
+ LAST = System.currentTimeMillis();
+ if (AV < 1500) {
try {
final ChunkLoc loc = chunks.get(0);
- PlotSquared.log("Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 256 chunks)");
- PlotSquared.log("Remaining regions: " + chunks.size());
+ PlotSquared.log("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)");
+ PlotSquared.log(" - Remaining: " + chunks.size());
regenerateChunkChunk(world, loc);
chunks.remove(0);
} catch (final Exception e) {
@@ -133,14 +135,16 @@ public class BukkitHybridUtils extends HybridUtils {
ChunkManager.manager.unloadChunk(world, new ChunkLoc(x, z));
}
}
- PlotSquared.log("&d - Potentially skipping 256 chunks");
+ PlotSquared.log("&d - Potentially skipping 1024 chunks");
PlotSquared.log("&d - TODO: recommend chunkster if corrupt");
}
}
else {
- System.out.print("TPS LOW: " + (System.currentTimeMillis() - LAST) + " | " + AV);
+ double tps = (20000.0/Math.min(AV, current));
+ if (tps < 19) {
+ System.out.print("waiting for chunks to unload...");
+ }
}
- LAST = System.currentTimeMillis();
}
}
}, 20, 20);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java
index 7b27d2a1e..0b7a0ab0c 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java
@@ -32,6 +32,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
+import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotLoc;
import com.intellectualcrafters.plot.object.PlotManager;
@@ -88,9 +89,6 @@ public class HybridGen extends PlotGenerator {
* Initialize variables, and create plotworld object used in calculations
*/
public void init(PlotWorld plotworld) {
- if (this.plotworld == null) {
- this.plotworld = (HybridPlotWorld) plotworld;
- }
this.plotsize = this.plotworld.PLOT_WIDTH;
this.pathsize = this.plotworld.ROAD_WIDTH;
this.roadblock = this.plotworld.ROAD_BLOCK.id;
@@ -198,24 +196,7 @@ public class HybridGen extends PlotGenerator {
/**
* Return the block populator
*/
- public List getPopulators(final World world) {
- // disabling spawning for this world
- if (!this.plotworld.MOB_SPAWNING) {
- if (!this.plotworld.SPAWN_EGGS) {
- world.setSpawnFlags(false, false);
- }
- world.setAmbientSpawnLimit(0);
- world.setAnimalSpawnLimit(0);
- world.setMonsterSpawnLimit(0);
- world.setWaterAnimalSpawnLimit(0);
- }
- else {
- world.setSpawnFlags(true, true);
- world.setAmbientSpawnLimit(-1);
- world.setAnimalSpawnLimit(-1);
- world.setMonsterSpawnLimit(-1);
- world.setWaterAnimalSpawnLimit(-1);
- }
+ public List getPopulators(final String world) {
// You can have as many populators as you would like, e.g. tree
// populator, ore populator
return Arrays.asList((BlockPopulator) new HybridPop(this.plotworld));
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
index 8cf463d7a..703818a02 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
@@ -541,7 +541,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!PlotSquared.isPlotWorld(world)) {
return;
}
- if (block.getType() != Material.PISTON_STICKY_BASE) {
+ if (block.getType() != Material.PISTON_STICKY_BASE && block.getType() != Material.PISTON_MOVING_PIECE) {
return;
}
Plot plot = MainUtil.getPlot(loc);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java
index 78758a4d4..c180663ef 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java
@@ -21,7 +21,10 @@
package com.intellectualcrafters.plot.object;
import java.util.List;
+import java.util.Random;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
@@ -29,13 +32,32 @@ import org.bukkit.generator.ChunkGenerator;
import com.intellectualcrafters.plot.PlotSquared;
public abstract class PlotGenerator extends ChunkGenerator {
+
@Override
public List getDefaultPopulators(World world) {
- PlotSquared.loadWorld(world.getName(), this);
- return getPopulators(world);
+ PlotSquared.loadWorld(PlotSquared.GEN_WORLD, this);
+// world = Bukkit.getWorld(PlotSquared.GEN_WORLD);
+ PlotWorld plotworld = PlotSquared.getPlotWorld(PlotSquared.GEN_WORLD);
+ if (!plotworld.MOB_SPAWNING) {
+ if (!plotworld.SPAWN_EGGS) {
+ world.setSpawnFlags(false, false);
+ }
+ world.setAmbientSpawnLimit(0);
+ world.setAnimalSpawnLimit(0);
+ world.setMonsterSpawnLimit(0);
+ world.setWaterAnimalSpawnLimit(0);
+ }
+ else {
+ world.setSpawnFlags(true, true);
+ world.setAmbientSpawnLimit(-1);
+ world.setAnimalSpawnLimit(-1);
+ world.setMonsterSpawnLimit(-1);
+ world.setWaterAnimalSpawnLimit(-1);
+ }
+ return getPopulators(PlotSquared.GEN_WORLD);
}
- public abstract List getPopulators(World world);
+ public abstract List getPopulators(String world);
public abstract void init(PlotWorld plotworld);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/UUIDHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/UUIDHandler.java
index 63989284b..3c8872251 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/UUIDHandler.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/UUIDHandler.java
@@ -1,6 +1,9 @@
package com.intellectualcrafters.plot.util.bukkit;
+import java.io.File;
+import java.io.FilenameFilter;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.UUID;
import com.google.common.collect.BiMap;
@@ -13,6 +16,7 @@ import com.intellectualcrafters.plot.object.BukkitOfflinePlayer;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.StringWrapper;
+import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
@@ -86,17 +90,7 @@ public class UUIDHandler {
PlotSquared.log(C.PREFIX.s() + "&6Starting player data caching");
UUIDHandler.CACHED = true;
- for (OfflinePlotPlayer op : uuidWrapper.getOfflinePlayers()) {
- if (op.getLastPlayed() != 0) {
- String name = op.getName();
- StringWrapper wrap = new StringWrapper(name);
- UUID uuid = uuidWrapper.getUUID(op);
- add(wrap, uuid);
- }
- }
-
// OLD UUID CACHING SYSTEM
- /*
final HashSet worlds = new HashSet<>();
worlds.add(world);
worlds.add("world");
@@ -139,7 +133,7 @@ public class UUIDHandler {
final UUIDWrapper wrapper = new DefaultUUIDWrapper();
for (UUID uuid : uuids) {
try {
- final BukkitOfflinePlayer player = wrapper.getOfflinePlayer(uuid);
+ final OfflinePlotPlayer player = wrapper.getOfflinePlayer(uuid);
uuid = UUIDHandler.uuidWrapper.getUUID(player);
final StringWrapper name = new StringWrapper(player.getName());
add(name, uuid);
@@ -152,8 +146,18 @@ public class UUIDHandler {
final StringWrapper nameWrap = new StringWrapper(name);
add(nameWrap, uuid);
}
- */
+
+ if (uuidMap.size() == 0) {
+ for (OfflinePlotPlayer op : uuidWrapper.getOfflinePlayers()) {
+ if (op.getLastPlayed() != 0) {
+ String name = op.getName();
+ StringWrapper wrap = new StringWrapper(name);
+ UUID uuid = uuidWrapper.getUUID(op);
+ add(wrap, uuid);
+ }
+ }
+ }
// add the Everyone '*' UUID
add(new StringWrapper("*"), DBFunc.everyone);
PlotSquared.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");