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
Bukkit
build.gradle
src
main
java
com
plotsquared
bukkit
Core
build.gradle
src
main
java
com
Sponge
build.gradle
src
main
java
com
plotsquared
sponge
gradle.properties

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

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

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

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

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

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