mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Yay! version 2.10 is coming soon.
This commit is contained in:
parent
5968b9e22e
commit
3540e1f6ca
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.9.17</version>
|
<version>2.10</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -66,7 +66,7 @@ public class Unlink extends SubCommand {
|
|||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!unlinkPlot(plot)) {
|
if (!MainUtil.unlinkPlot(plot)) {
|
||||||
MainUtil.sendMessage(plr, "&cUnlink has been cancelled");
|
MainUtil.sendMessage(plr, "&cUnlink has been cancelled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -81,61 +81,4 @@ public class Unlink extends SubCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean unlinkPlot(final Plot plot) {
|
|
||||||
final String world = plot.world;
|
|
||||||
final PlotId pos1 = MainUtil.getBottomPlot(plot).id;
|
|
||||||
final PlotId pos2 = MainUtil.getTopPlot(plot).id;
|
|
||||||
final ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(pos1, pos2);
|
|
||||||
final boolean result = EventUtil.manager.callUnlink(world, ids);
|
|
||||||
if (!result) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final PlotManager manager = PlotSquared.getPlotManager(world);
|
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
|
||||||
manager.startPlotUnlink(plotworld, ids);
|
|
||||||
for (final PlotId id : ids) {
|
|
||||||
final Plot myplot = PlotSquared.getPlots(world).get(id);
|
|
||||||
if (plot == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (plot.helpers != null) {
|
|
||||||
myplot.helpers = plot.helpers;
|
|
||||||
}
|
|
||||||
if (plot.denied != null) {
|
|
||||||
myplot.denied = plot.denied;
|
|
||||||
}
|
|
||||||
myplot.deny_entry = plot.deny_entry;
|
|
||||||
myplot.settings.setMerged(new boolean[] { false, false, false, false });
|
|
||||||
DBFunc.setMerged(world, myplot, myplot.settings.getMerged());
|
|
||||||
}
|
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
|
||||||
final boolean lx = x < pos2.x;
|
|
||||||
final boolean ly = y < pos2.y;
|
|
||||||
final Plot p = MainUtil.getPlot(world, new PlotId(x, y));
|
|
||||||
if (lx) {
|
|
||||||
manager.createRoadEast(plotworld, p);
|
|
||||||
if (ly) {
|
|
||||||
manager.createRoadSouthEast(plotworld, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ly) {
|
|
||||||
manager.createRoadSouth(plotworld, p);
|
|
||||||
}
|
|
||||||
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manager.finishPlotUnlink(plotworld, ids);
|
|
||||||
for (final PlotId id : ids) {
|
|
||||||
final Plot myPlot = MainUtil.getPlot(world, id);
|
|
||||||
if (plot.hasOwner()) {
|
|
||||||
final String name = UUIDHandler.getName(myPlot.owner);
|
|
||||||
if (name != null) {
|
|
||||||
MainUtil.setSign(name, myPlot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,27 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
Template.zipAll(plotworld.worldname, files);
|
Template.zipAll(plotworld.worldname, files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createRoadEast(PlotWorld plotworld, Plot plot) {
|
||||||
|
super.createRoadEast(plotworld, plot);
|
||||||
|
// TODO schematic
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createRoadSouth(PlotWorld plotworld, Plot plot) {
|
||||||
|
super.createRoadSouth(plotworld, plot);
|
||||||
|
// TODO schematic
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createRoadSouthEast(PlotWorld plotworld, Plot plot) {
|
||||||
|
super.createRoadSouthEast(plotworld, plot);
|
||||||
|
// TODO schematic
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clearing the plot needs to only consider removing the blocks - This implementation has used the setCuboidAsync
|
* Clearing the plot needs to only consider removing the blocks - This implementation has used the setCuboidAsync
|
||||||
* function, as it is fast, and uses NMS code - It also makes use of the fact that deleting chunks is a lot faster
|
* function, as it is fast, and uses NMS code - It also makes use of the fact that deleting chunks is a lot faster
|
||||||
|
@ -88,7 +88,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
setupSchematics();
|
setupSchematics();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
PlotSquared.log("&c - road schematics are disabled for this world.");
|
PlotSquared.log("&c - road schematics are disabled for this world.");
|
||||||
this.ROAD_SCHEMATIC_ENABLED = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public class ExpireManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.settings.isMerged()) {
|
if (plot.settings.isMerged()) {
|
||||||
Unlink.unlinkPlot(plot);
|
MainUtil.unlinkPlot(plot);
|
||||||
}
|
}
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
manager.clearPlot(plotworld, plot, false, null);
|
manager.clearPlot(plotworld, plot, false, null);
|
||||||
|
@ -42,6 +42,7 @@ import com.intellectualcrafters.plot.object.PlotSettings;
|
|||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot functions
|
* plot functions
|
||||||
@ -66,6 +67,64 @@ public class MainUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean unlinkPlot(final Plot plot) {
|
||||||
|
final String world = plot.world;
|
||||||
|
final PlotId pos1 = MainUtil.getBottomPlot(plot).id;
|
||||||
|
final PlotId pos2 = MainUtil.getTopPlot(plot).id;
|
||||||
|
final ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(pos1, pos2);
|
||||||
|
final boolean result = EventUtil.manager.callUnlink(world, ids);
|
||||||
|
if (!result) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PlotManager manager = PlotSquared.getPlotManager(world);
|
||||||
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
|
manager.startPlotUnlink(plotworld, ids);
|
||||||
|
for (final PlotId id : ids) {
|
||||||
|
final Plot myplot = PlotSquared.getPlots(world).get(id);
|
||||||
|
if (plot == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (plot.helpers != null) {
|
||||||
|
myplot.helpers = plot.helpers;
|
||||||
|
}
|
||||||
|
if (plot.denied != null) {
|
||||||
|
myplot.denied = plot.denied;
|
||||||
|
}
|
||||||
|
myplot.deny_entry = plot.deny_entry;
|
||||||
|
myplot.settings.setMerged(new boolean[] { false, false, false, false });
|
||||||
|
DBFunc.setMerged(world, myplot, myplot.settings.getMerged());
|
||||||
|
}
|
||||||
|
// FIXME unlink augmented
|
||||||
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
|
final boolean lx = x < pos2.x;
|
||||||
|
final boolean ly = y < pos2.y;
|
||||||
|
final Plot p = MainUtil.getPlot(world, new PlotId(x, y));
|
||||||
|
if (lx) {
|
||||||
|
manager.createRoadEast(plotworld, p);
|
||||||
|
if (ly) {
|
||||||
|
manager.createRoadSouthEast(plotworld, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ly) {
|
||||||
|
manager.createRoadSouth(plotworld, p);
|
||||||
|
}
|
||||||
|
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manager.finishPlotUnlink(plotworld, ids);
|
||||||
|
for (final PlotId id : ids) {
|
||||||
|
final Plot myPlot = MainUtil.getPlot(world, id);
|
||||||
|
if (plot.hasOwner()) {
|
||||||
|
final String name = UUIDHandler.getName(myPlot.owner);
|
||||||
|
if (name != null) {
|
||||||
|
MainUtil.setSign(name, myPlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isPlotAreaAbs(final Location location) {
|
public static boolean isPlotAreaAbs(final Location location) {
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(location.getWorld());
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(location.getWorld());
|
||||||
if (plotworld.TYPE == 2) {
|
if (plotworld.TYPE == 2) {
|
||||||
|
@ -12,7 +12,7 @@ import com.intellectualcrafters.plot.object.PlotBlock;
|
|||||||
public class SetBlockQueue {
|
public class SetBlockQueue {
|
||||||
|
|
||||||
private volatile static HashMap<ChunkWrapper, PlotBlock[][]> blocks;
|
private volatile static HashMap<ChunkWrapper, PlotBlock[][]> blocks;
|
||||||
private volatile static int allocate = 20;
|
private volatile static int allocate = 25;
|
||||||
private volatile static boolean running = false;
|
private volatile static boolean running = false;
|
||||||
private volatile static boolean locked = false;
|
private volatile static boolean locked = false;
|
||||||
private volatile static HashSet<Runnable> runnables;
|
private volatile static HashSet<Runnable> runnables;
|
||||||
@ -21,6 +21,10 @@ public class SetBlockQueue {
|
|||||||
allocate = t;
|
allocate = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getAllocate() {
|
||||||
|
return allocate;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized static void addNotify(Runnable whenDone) {
|
public synchronized static void addNotify(Runnable whenDone) {
|
||||||
if (runnables == null) {
|
if (runnables == null) {
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
|
@ -61,6 +61,7 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
|
|||||||
import com.intellectualcrafters.plot.object.entity.EntityWrapper;
|
import com.intellectualcrafters.plot.object.entity.EntityWrapper;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
public class BukkitChunkManager extends ChunkManager {
|
public class BukkitChunkManager extends ChunkManager {
|
||||||
@ -292,8 +293,11 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
while (System.currentTimeMillis() - start < 20) {
|
int allocated = SetBlockQueue.getAllocate();
|
||||||
|
SetBlockQueue.allocate(0);
|
||||||
|
while (System.currentTimeMillis() - start < allocated) {
|
||||||
if (chunks.size() == 0) {
|
if (chunks.size() == 0) {
|
||||||
|
SetBlockQueue.allocate(SetBlockQueue.getAllocate() + allocated);
|
||||||
TaskManager.runTaskLater(whenDone, 1);
|
TaskManager.runTaskLater(whenDone, 1);
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(currentIndex);
|
TaskManager.tasks.remove(currentIndex);
|
||||||
|
Loading…
Reference in New Issue
Block a user