diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 5772b37b6..a77b77d5e 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -25,6 +25,7 @@ shadowJar { include(dependency(':Core')) } archiveName = "${parent.name}-${project.name}-${parent.version}.jar" + destinationDir = file '../target' } shadowJar.doLast { task -> diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java index 2028d2db0..83742401a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java @@ -20,6 +20,22 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.plotsquared.bukkit.database.plotme; +import com.intellectualcrafters.configuration.MemorySection; +import com.intellectualcrafters.configuration.file.FileConfiguration; +import com.intellectualcrafters.configuration.file.YamlConfiguration; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.generator.HybridGen; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotArea; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.util.TaskManager; +import com.plotsquared.bukkit.generator.BukkitPlotGenerator; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.WorldCreator; + import java.io.File; import java.io.IOException; import java.nio.charset.Charset; @@ -35,22 +51,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.WorldCreator; - -import com.intellectualcrafters.configuration.file.FileConfiguration; -import com.intellectualcrafters.configuration.file.YamlConfiguration; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.generator.HybridGen; -import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.object.PlotArea; -import com.intellectualcrafters.plot.object.PlotId; -import com.intellectualcrafters.plot.util.TaskManager; -import com.plotsquared.bukkit.generator.BukkitPlotGenerator; - /** * Created 2014-08-17 for PlotSquared * @@ -109,10 +109,12 @@ public class LikePlotMeConverter { YamlConfiguration yml = YamlConfiguration.loadConfiguration(genConfig); for (String key : yml.getKeys(true)) { if (!plotConfig.contains(key)) { - plotConfig.set(key, yml.get(key)); + Object value = yml.get(key); + if (!(value instanceof MemorySection)) { + plotConfig.set(key, value); + } } } - genConfig.delete(); } } catch (Exception e) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/WorldEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/WorldEvents.java index 7fbec47f8..6f7f1b654 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/WorldEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/WorldEvents.java @@ -21,9 +21,7 @@ public class WorldEvents implements Listener { if (gen instanceof GeneratorWrapper) { PS.get().loadWorld(name, (GeneratorWrapper) gen); } else { - if (PS.get().config.contains("worlds." + name)) { - PS.get().loadWorld(name, new BukkitPlotGenerator(name, gen)); - } + PS.get().loadWorld(name, new BukkitPlotGenerator(name, gen)); } } } diff --git a/Core/build.gradle b/Core/build.gradle index 1c2d200f5..a0bee08a6 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -1,4 +1,5 @@ dependencies { compile 'org.yaml:snakeyaml:1.16' } -jar.archiveName="PlotSquared-API-${parent.version}.jar" \ No newline at end of file +jar.archiveName="PlotSquared-API-${parent.version}.jar" +jar.destinationDir = file '../target' \ No newline at end of file diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 9fca037ac..ecd84d490 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -47,6 +47,12 @@ public class PS { // protected static: private static PS instance; + private HashSet plotareaHashCheck = new HashSet(); + private boolean plotareaHasCollision = false; + /** + * All plot areas (quick global access) + */ + private PlotArea[] plotareas = new PlotArea[0]; /** * All plot areas mapped by world (quick world access) */ @@ -68,10 +74,6 @@ public class PS { public TaskManager TASK; public WorldEdit worldedit; public URL update; - /** - * All plot areas (quick global access) - */ - private PlotArea[] plotareas = new PlotArea[0]; // private: private File storageFile; private File FILE = null; // This file @@ -384,7 +386,7 @@ public class PS { int hash = world.hashCode(); for (PlotArea area : plotareas) { if (hash == area.worldhash) { - if (area.contains(loc.getX(), loc.getZ()) && world.equals(area.worldname)) { + if (area.contains(loc.getX(), loc.getZ()) && (!plotareaHasCollision || world.equals(area.worldname))) { return area; } } @@ -511,7 +513,7 @@ public class PS { int hash = world.hashCode(); for (PlotArea area : plotareas) { if (hash == area.worldhash) { - if (area.contains(loc.getX(), loc.getZ()) && world.equals(area.worldname)) { + if (area.contains(loc.getX(), loc.getZ()) && (!plotareaHasCollision || world.equals(area.worldname))) { return area; } } @@ -1230,7 +1232,7 @@ public class PS { return false; case 1: PlotArea a = plotareas[0]; - return world.hashCode() == a.worldhash && a.worldname.equals(world); + return world.hashCode() == a.worldhash && (!plotareaHasCollision || a.worldname.equals(world)); case 2: case 3: case 4: @@ -1240,7 +1242,7 @@ public class PS { case 8: int hash = world.hashCode(); for (PlotArea area : plotareas) { - if (area.worldhash == hash && area.worldname.equals(world)) { + if (area.worldhash == hash && (!plotareaHasCollision || area.worldname.equals(world))) { return true; } } @@ -1355,6 +1357,9 @@ public class PS { if (world.equals("CheckingPlotSquaredGenerator")) { return; } + if (!plotareaHasCollision && !plotareaHashCheck.add(world.hashCode())) { + plotareaHasCollision = true; + } final Set worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet()); final String path = "worlds." + world; ConfigurationSection worldSection = config.getConfigurationSection(path); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index 0cdeb5f5b..136e04f69 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -20,8 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import java.util.Set; - import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.flag.Flag; @@ -34,6 +32,8 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.general.commands.CommandDeclaration; +import java.util.Set; + @CommandDeclaration( command = "buy", aliases = { "b" }, diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index ef3f3ccc8..4c150201c 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -22,17 +22,8 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.object.Location; -import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.object.PlotArea; -import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.object.RunnableVal; -import com.intellectualcrafters.plot.util.ByteArrayUtilities; -import com.intellectualcrafters.plot.util.EconHandler; -import com.intellectualcrafters.plot.util.EventUtil; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.Permissions; -import com.intellectualcrafters.plot.util.SchematicHandler; +import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.plotsquared.general.commands.CommandDeclaration; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java index c961a4228..5a81f37d8 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -24,16 +24,8 @@ import com.google.common.collect.BiMap; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.object.ChunkLoc; -import com.intellectualcrafters.plot.object.Location; -import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.object.PlotArea; -import com.intellectualcrafters.plot.object.PlotId; -import com.intellectualcrafters.plot.object.PlotManager; -import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.object.StringWrapper; +import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.util.ChunkManager; -import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; @@ -51,23 +43,6 @@ requiredType = RequiredType.CONSOLE, permission = "plots.debugclaimtest") public class DebugClaimTest extends SubCommand { - public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport) { - return claimPlot(player, plot, teleport, ""); - } - - public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final String schematic) { - final boolean result = EventUtil.manager.callClaim(player, plot, false); - if (result) { - plot.create(player.getUUID(), true); - plot.setSign(player.getName()); - MainUtil.sendMessage(player, C.CLAIMED); - if (teleport) { - plot.teleportPlayer(player); - } - } - return !result; - } - @Override public boolean onCommand(final PlotPlayer plr, final String[] args) { if (args.length < 3) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java index 8ecaaf7a1..ea5f96279 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -785,9 +785,9 @@ public class Plot { } else { for (final Plot current : plots) { manager.claimPlot(Plot.this.area, current); - SetQueue.IMP.addTask(run); } } + SetQueue.IMP.addTask(run); return; } final Plot current = queue.poll(); @@ -1041,6 +1041,7 @@ public class Plot { for (Plot current : getConnectedPlots()) { getArea().removePlot(getId()); DBFunc.delete(current); + current.owner = null; current.settings = null; } return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/SetQueue.java b/Core/src/main/java/com/intellectualcrafters/plot/util/SetQueue.java index 2cbe44286..b12926ad6 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/SetQueue.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/SetQueue.java @@ -172,6 +172,9 @@ public class SetQueue { if (obj == null) { return false; } + if (this.hashCode() != obj.hashCode()) { + return false; + } if (getClass() != obj.getClass()) { return false; } diff --git a/Sponge/build.gradle b/Sponge/build.gradle index ce9de41d5..e2a444e92 100644 --- a/Sponge/build.gradle +++ b/Sponge/build.gradle @@ -46,13 +46,12 @@ processResources { 'mcVersion': project.minecraft.version } } -// We only want the shadow jar produced -jar.enabled = false shadowJar { dependencies { include(dependency(':Core')) } archiveName = "${parent.name}-${project.name}-${parent.version}.jar" + destinationDir = file '../target' } shadowJar.doLast { task -> diff --git a/Sponge/src/main/java/com/plotsquared/sponge/listener/WorldEvents.java b/Sponge/src/main/java/com/plotsquared/sponge/listener/WorldEvents.java index 626ca2a9a..1ce7014c3 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/listener/WorldEvents.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/listener/WorldEvents.java @@ -21,7 +21,7 @@ public class WorldEvents { SpongeTerrainGen stg = (SpongeTerrainGen) terrain; PS.get().loadWorld(name, stg.parent); } - else if (PS.get().config.contains("worlds." + name)) { + else { PS.get().loadWorld(name, null); } } diff --git a/gradle.properties b/gradle.properties index f30cf6d13..0ff1aa364 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ org.gradle.daemon=true +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.configureondemand=true org.gradle.parallel=true \ No newline at end of file