Notify core of all world loading regardless of generator
Optimize plot area fetching
Fix plot delete not deleting the plot until restart
Fix plot unclaim not removing the owner on any cached plots
Change gradle output directory
Fix plotme conversion sometimes not copying over the floor/main blocks
This commit is contained in:
Jesse Boyd 2016-02-27 21:07:42 +11:00
parent 7d8893b5d7
commit 01710e3ddb
13 changed files with 50 additions and 73 deletions

View File

@ -25,6 +25,7 @@ shadowJar {
include(dependency(':Core'))
}
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
destinationDir = file '../target'
}
shadowJar.doLast {
task ->

View File

@ -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) {

View File

@ -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));
}
}
}

View File

@ -1,4 +1,5 @@
dependencies {
compile 'org.yaml:snakeyaml:1.16'
}
jar.archiveName="PlotSquared-API-${parent.version}.jar"
jar.archiveName="PlotSquared-API-${parent.version}.jar"
jar.destinationDir = file '../target'

View File

@ -47,6 +47,12 @@ public class PS {
// protected static:
private static PS instance;
private HashSet<Integer> plotareaHashCheck = new HashSet<Integer>();
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<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
final String path = "worlds." + world;
ConfigurationSection worldSection = config.getConfigurationSection(path);

View File

@ -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" },

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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;
}

View File

@ -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 ->

View File

@ -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);
}
}

View File

@ -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