2015-02-10 21:56:04 +11:00
|
|
|
package com.intellectualcrafters.plot.generator;
|
|
|
|
|
2015-07-31 00:25:16 +10:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import com.intellectualcrafters.plot.object.Location;
|
|
|
|
import com.intellectualcrafters.plot.object.Plot;
|
|
|
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
|
|
|
import com.intellectualcrafters.plot.object.PlotId;
|
|
|
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
|
|
|
import com.intellectualcrafters.plot.object.PseudoRandom;
|
2015-02-20 22:23:48 +11:00
|
|
|
import com.intellectualcrafters.plot.util.MainUtil;
|
2015-05-18 02:20:53 +10:00
|
|
|
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
2015-02-18 03:14:34 +11:00
|
|
|
|
2015-02-10 21:56:04 +11:00
|
|
|
/**
|
2015-02-20 17:34:19 +11:00
|
|
|
* A plot manager with square plots which tesselate on a square grid with the following sections: ROAD, WALL, BORDER (wall), PLOT, FLOOR (plot)
|
2015-02-10 21:56:04 +11:00
|
|
|
*/
|
2015-08-18 23:20:11 +10:00
|
|
|
public class ClassicPlotManager extends SquarePlotManager {
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean setComponent(final PlotWorld plotworld, final PlotId plotid, final String component, final PlotBlock[] blocks) {
|
2015-02-20 17:34:19 +11:00
|
|
|
switch (component) {
|
2015-02-18 03:14:34 +11:00
|
|
|
case "floor": {
|
2015-02-21 03:17:34 +11:00
|
|
|
setFloor(plotworld, plotid, blocks);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case "wall": {
|
2015-02-21 03:17:34 +11:00
|
|
|
setWallFilling(plotworld, plotid, blocks);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case "border": {
|
2015-02-21 03:17:34 +11:00
|
|
|
setWall(plotworld, plotid, blocks);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2015-03-31 21:05:40 +11:00
|
|
|
|
2015-08-18 23:20:11 +10:00
|
|
|
@Override
|
|
|
|
public boolean unclaimPlot(PlotWorld plotworld, Plot plot, Runnable whenDone) {
|
|
|
|
final HybridPlotWorld dpw = ((HybridPlotWorld) plotworld);
|
|
|
|
setWallFilling(dpw, plot.id, new PlotBlock[] { dpw.WALL_FILLING });
|
|
|
|
if (dpw.WALL_BLOCK.id != 0 || !dpw.WALL_BLOCK.equals(dpw.CLAIMED_WALL_BLOCK)) {
|
|
|
|
setWall(dpw, plot.id, new PlotBlock[] { dpw.WALL_BLOCK });
|
|
|
|
}
|
|
|
|
SetBlockQueue.addNotify(whenDone);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean setFloor(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
|
2015-02-18 03:14:34 +11:00
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
2015-02-20 22:23:48 +11:00
|
|
|
final Location pos1 = MainUtil.getPlotBottomLoc(plotworld.worldname, plotid).add(1, 0, 1);
|
2015-02-23 18:08:49 +11:00
|
|
|
final Location pos2 = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1, 0, 1);
|
2015-02-21 03:17:34 +11:00
|
|
|
pos1.setY(dpw.PLOT_HEIGHT);
|
|
|
|
pos2.setY(dpw.PLOT_HEIGHT + 1);
|
2015-05-18 02:20:53 +10:00
|
|
|
MainUtil.setCuboidAsync(plotworld.worldname, pos1, pos2, blocks);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean setWallFilling(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
|
2015-02-18 03:14:34 +11:00
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
|
|
|
if (dpw.ROAD_WIDTH == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
2015-02-20 22:23:48 +11:00
|
|
|
final Location bottom = MainUtil.getPlotBottomLoc(plotworld.worldname, plotid);
|
2015-02-23 11:05:25 +11:00
|
|
|
final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1, 0, 1);
|
2015-02-18 03:14:34 +11:00
|
|
|
int x, z;
|
2015-02-21 03:17:34 +11:00
|
|
|
z = bottom.getZ();
|
2015-03-27 18:15:41 +11:00
|
|
|
PseudoRandom random = new PseudoRandom();
|
2015-02-23 11:05:25 +11:00
|
|
|
for (x = bottom.getX(); x <= (top.getX() - 1); x++) {
|
2015-02-18 03:14:34 +11:00
|
|
|
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
|
2015-05-18 02:20:53 +10:00
|
|
|
SetBlockQueue.setBlock(plotworld.worldname, x, y, z, blocks[random.random(blocks.length)]);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
|
|
|
}
|
2015-02-23 11:05:25 +11:00
|
|
|
x = top.getX();
|
|
|
|
for (z = bottom.getZ(); z <= (top.getZ() - 1); z++) {
|
2015-02-18 03:14:34 +11:00
|
|
|
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
|
2015-05-18 02:20:53 +10:00
|
|
|
SetBlockQueue.setBlock(plotworld.worldname, x, y, z, blocks[random.random(blocks.length)]);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
|
|
|
}
|
2015-02-23 11:05:25 +11:00
|
|
|
z = top.getZ();
|
|
|
|
for (x = top.getX(); x >= (bottom.getX() + 1); x--) {
|
2015-02-18 03:14:34 +11:00
|
|
|
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
|
2015-05-18 02:20:53 +10:00
|
|
|
SetBlockQueue.setBlock(plotworld.worldname, x, y, z, blocks[random.random(blocks.length)]);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
|
|
|
}
|
2015-02-21 03:17:34 +11:00
|
|
|
x = bottom.getX();
|
2015-02-23 11:05:25 +11:00
|
|
|
for (z = top.getZ(); z >= (bottom.getZ() + 1); z--) {
|
2015-02-18 03:14:34 +11:00
|
|
|
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
|
2015-05-18 02:20:53 +10:00
|
|
|
SetBlockQueue.setBlock(plotworld.worldname, x, y, z, blocks[random.random(blocks.length)]);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean setWall(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
|
2015-02-18 03:14:34 +11:00
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
|
|
|
if (dpw.ROAD_WIDTH == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
2015-02-20 22:23:48 +11:00
|
|
|
final Location bottom = MainUtil.getPlotBottomLoc(plotworld.worldname, plotid);
|
2015-02-23 12:32:27 +11:00
|
|
|
final Location top = MainUtil.getPlotTopLoc(plotworld.worldname, plotid).add(1, 0, 1);
|
2015-02-18 03:14:34 +11:00
|
|
|
int x, z;
|
2015-02-21 03:17:34 +11:00
|
|
|
z = bottom.getZ();
|
2015-03-27 18:15:41 +11:00
|
|
|
PseudoRandom random = new PseudoRandom();
|
2015-02-23 12:32:27 +11:00
|
|
|
final int y = dpw.WALL_HEIGHT + 1;
|
2015-02-23 11:05:25 +11:00
|
|
|
for (x = bottom.getX(); x <= (top.getX() - 1); x++) {
|
2015-05-18 02:20:53 +10:00
|
|
|
SetBlockQueue.setBlock(plotworld.worldname, x, y, z, blocks[random.random(blocks.length)]);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
2015-02-23 11:05:25 +11:00
|
|
|
x = top.getX();
|
|
|
|
for (z = bottom.getZ(); z <= (top.getZ() - 1); z++) {
|
2015-05-18 02:20:53 +10:00
|
|
|
SetBlockQueue.setBlock(plotworld.worldname, x, y, z, blocks[random.random(blocks.length)]);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
2015-02-23 11:05:25 +11:00
|
|
|
z = top.getZ();
|
|
|
|
for (x = top.getX(); x >= (bottom.getX() + 1); x--) {
|
2015-05-18 02:20:53 +10:00
|
|
|
SetBlockQueue.setBlock(plotworld.worldname, x, y, z, blocks[random.random(blocks.length)]);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
2015-02-21 03:17:34 +11:00
|
|
|
x = bottom.getX();
|
2015-02-23 11:05:25 +11:00
|
|
|
for (z = top.getZ(); z >= (bottom.getZ() + 1); z--) {
|
2015-05-18 02:20:53 +10:00
|
|
|
SetBlockQueue.setBlock(plotworld.worldname, x, y, z, blocks[random.random(blocks.length)]);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
/**
|
|
|
|
* PLOT MERGING
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public boolean createRoadEast(final PlotWorld plotworld, final Plot plot) {
|
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
|
|
|
final Location pos1 = getPlotBottomLocAbs(plotworld, plot.id);
|
|
|
|
final Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sx = pos2.getX() + 1;
|
2015-02-18 03:14:34 +11:00
|
|
|
final int ex = (sx + dpw.ROAD_WIDTH) - 1;
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sz = pos1.getZ() - 1;
|
|
|
|
final int ez = pos2.getZ() + 2;
|
2015-05-18 02:20:53 +10:00
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1), new Location(plotworld.worldname, ex + 1, 257, ez), new PlotBlock((short) 0, (byte) 0));
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, 1, sz + 1), new Location(plotworld.worldname, ex + 1, dpw.PLOT_HEIGHT, ez), new PlotBlock((short) 7, (byte) 0));
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, 1, sz + 1), new Location(plotworld.worldname, sx + 1, dpw.WALL_HEIGHT + 1, ez), dpw.WALL_FILLING);
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, dpw.WALL_HEIGHT + 1, sz + 1), new Location(plotworld.worldname, sx + 1, dpw.WALL_HEIGHT + 2, ez), dpw.WALL_BLOCK);
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, ex, 1, sz + 1), new Location(plotworld.worldname, ex + 1, dpw.WALL_HEIGHT + 1, ez), dpw.WALL_FILLING);
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, ex, dpw.WALL_HEIGHT + 1, sz + 1), new Location(plotworld.worldname, ex + 1, dpw.WALL_HEIGHT + 2, ez), dpw.WALL_BLOCK);
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, 1, sz + 1), new Location(plotworld.worldname, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
|
|
|
public boolean createRoadSouth(final PlotWorld plotworld, final Plot plot) {
|
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
|
|
|
final Location pos1 = getPlotBottomLocAbs(plotworld, plot.id);
|
|
|
|
final Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sz = pos2.getZ() + 1;
|
2015-02-18 03:14:34 +11:00
|
|
|
final int ez = (sz + dpw.ROAD_WIDTH) - 1;
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sx = pos1.getX() - 1;
|
|
|
|
final int ex = pos2.getX() + 2;
|
2015-05-18 02:20:53 +10:00
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz), new Location(plotworld.worldname, ex, 257, ez + 1), new PlotBlock((short) 0, (byte) 0));
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, 0, sz), new Location(plotworld.worldname, ex, 1, ez + 1), new PlotBlock((short) 7, (byte) 0));
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, 1, sz), new Location(plotworld.worldname, ex, dpw.WALL_HEIGHT + 1, sz + 1), dpw.WALL_FILLING);
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, dpw.WALL_HEIGHT + 1, sz), new Location(plotworld.worldname, ex, dpw.WALL_HEIGHT + 2, sz + 1), dpw.WALL_BLOCK);
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, 1, ez), new Location(plotworld.worldname, ex, dpw.WALL_HEIGHT + 1, ez + 1), dpw.WALL_FILLING);
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, dpw.WALL_HEIGHT + 1, ez), new Location(plotworld.worldname, ex, dpw.WALL_HEIGHT + 2, ez + 1), dpw.WALL_BLOCK);
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, 1, sz + 1), new Location(plotworld.worldname, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
|
|
|
public boolean createRoadSouthEast(final PlotWorld plotworld, final Plot plot) {
|
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
|
|
|
final Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sx = pos2.getX() + 1;
|
2015-02-18 03:14:34 +11:00
|
|
|
final int ex = (sx + dpw.ROAD_WIDTH) - 1;
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sz = pos2.getZ() + 1;
|
2015-02-18 03:14:34 +11:00
|
|
|
final int ez = (sz + dpw.ROAD_WIDTH) - 1;
|
2015-05-18 02:20:53 +10:00
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, dpw.ROAD_HEIGHT + 1, sz + 1), new Location(plotworld.worldname, ex, 257, ez), new PlotBlock((short) 0, (byte) 0));
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, 0, sz + 1), new Location(plotworld.worldname, ex, 1, ez), new PlotBlock((short) 7, (byte) 0));
|
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, 1, sz + 1), new Location(plotworld.worldname, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
|
|
|
public boolean removeRoadEast(final PlotWorld plotworld, final Plot plot) {
|
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
|
|
|
final Location pos1 = getPlotBottomLocAbs(plotworld, plot.id);
|
|
|
|
final Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sx = pos2.getX() + 1;
|
2015-02-18 03:14:34 +11:00
|
|
|
final int ex = (sx + dpw.ROAD_WIDTH) - 1;
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sz = pos1.getZ();
|
|
|
|
final int ez = pos2.getZ() + 1;
|
2015-05-18 02:20:53 +10:00
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz), new Location(plotworld.worldname, ex + 1, 257, ez + 1), new PlotBlock((short) 0, (byte) 0));
|
|
|
|
MainUtil.setCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, 1, sz + 1), new Location(plotworld.worldname, ex + 1, dpw.PLOT_HEIGHT, ez), dpw.MAIN_BLOCK);
|
|
|
|
MainUtil.setCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, dpw.PLOT_HEIGHT, sz + 1), new Location(plotworld.worldname, ex + 1, dpw.PLOT_HEIGHT + 1, ez), dpw.TOP_BLOCK);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
|
|
|
public boolean removeRoadSouth(final PlotWorld plotworld, final Plot plot) {
|
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
|
|
|
final Location pos1 = getPlotBottomLocAbs(plotworld, plot.id);
|
|
|
|
final Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sz = pos2.getZ() + 1;
|
2015-02-18 03:14:34 +11:00
|
|
|
final int ez = (sz + dpw.ROAD_WIDTH) - 1;
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sx = pos1.getX();
|
|
|
|
final int ex = pos2.getX() + 1;
|
2015-05-18 02:20:53 +10:00
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz), new Location(plotworld.worldname, ex + 1, 257, ez + 1), new PlotBlock((short) 0, (byte) 0));
|
|
|
|
MainUtil.setCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, 1, sz), new Location(plotworld.worldname, ex, dpw.PLOT_HEIGHT, ez + 1), dpw.MAIN_BLOCK);
|
|
|
|
MainUtil.setCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx + 1, dpw.PLOT_HEIGHT, sz), new Location(plotworld.worldname, ex, dpw.PLOT_HEIGHT + 1, ez + 1), dpw.TOP_BLOCK);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
|
|
|
public boolean removeRoadSouthEast(final PlotWorld plotworld, final Plot plot) {
|
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
|
|
|
final Location loc = getPlotTopLocAbs(dpw, plot.id);
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sx = loc.getX() + 1;
|
2015-02-18 03:14:34 +11:00
|
|
|
final int ex = (sx + dpw.ROAD_WIDTH) - 1;
|
2015-02-21 03:17:34 +11:00
|
|
|
final int sz = loc.getZ() + 1;
|
2015-02-18 03:14:34 +11:00
|
|
|
final int ez = (sz + dpw.ROAD_WIDTH) - 1;
|
2015-05-18 02:20:53 +10:00
|
|
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, dpw.ROAD_HEIGHT + 1, sz), new Location(plotworld.worldname, ex + 1, 257, ez + 1), new PlotBlock((short) 0, (byte) 0));
|
|
|
|
MainUtil.setCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, 1, sz), new Location(plotworld.worldname, ex + 1, dpw.ROAD_HEIGHT, ez + 1), dpw.MAIN_BLOCK);
|
|
|
|
MainUtil.setCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, dpw.ROAD_HEIGHT, sz), new Location(plotworld.worldname, ex + 1, dpw.ROAD_HEIGHT + 1, ez + 1), dpw.TOP_BLOCK);
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
/**
|
|
|
|
* Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED)
|
|
|
|
*/
|
|
|
|
@Override
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean finishPlotMerge(final PlotWorld plotworld, final ArrayList<PlotId> plotIds) {
|
2015-02-18 03:14:34 +11:00
|
|
|
final PlotId pos1 = plotIds.get(0);
|
2015-02-27 12:06:51 +11:00
|
|
|
final PlotBlock block = ((ClassicPlotWorld) plotworld).CLAIMED_WALL_BLOCK;
|
|
|
|
final PlotBlock unclaim = ((ClassicPlotWorld) plotworld).WALL_BLOCK;
|
2015-08-12 05:29:14 +10:00
|
|
|
if (block.id != 0 || !block.equals(unclaim)) {
|
2015-02-27 12:06:51 +11:00
|
|
|
setWall(plotworld, pos1, new PlotBlock[] { block });
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean finishPlotUnlink(final PlotWorld plotworld, final ArrayList<PlotId> plotIds) {
|
2015-02-20 17:34:19 +11:00
|
|
|
final PlotBlock block = ((ClassicPlotWorld) plotworld).CLAIMED_WALL_BLOCK;
|
|
|
|
final PlotBlock unclaim = ((ClassicPlotWorld) plotworld).WALL_BLOCK;
|
|
|
|
for (final PlotId id : plotIds) {
|
2015-05-02 23:58:52 +10:00
|
|
|
if (block.id != 0 || !block.equals(unclaim)) {
|
2015-02-21 12:19:19 +11:00
|
|
|
setWall(plotworld, id, new PlotBlock[] { block });
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean startPlotMerge(final PlotWorld plotworld, final ArrayList<PlotId> plotIds) {
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean startPlotUnlink(final PlotWorld plotworld, final ArrayList<PlotId> plotIds) {
|
2015-02-18 03:14:34 +11:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
2015-02-21 03:17:34 +11:00
|
|
|
public boolean claimPlot(final PlotWorld plotworld, final Plot plot) {
|
2015-02-20 17:34:19 +11:00
|
|
|
final PlotBlock unclaim = ((ClassicPlotWorld) plotworld).WALL_BLOCK;
|
|
|
|
final PlotBlock claim = ((ClassicPlotWorld) plotworld).CLAIMED_WALL_BLOCK;
|
2015-05-02 23:58:52 +10:00
|
|
|
if (claim.id != 0 || !claim.equals(unclaim)) {
|
2015-02-21 12:19:19 +11:00
|
|
|
setWall(plotworld, plot.id, new PlotBlock[] { claim });
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
@Override
|
2015-02-20 17:34:19 +11:00
|
|
|
public String[] getPlotComponents(final PlotWorld plotworld, final PlotId plotid) {
|
|
|
|
return new String[] { "floor", "wall", "border" };
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
2015-02-23 12:32:27 +11:00
|
|
|
|
2015-02-18 03:14:34 +11:00
|
|
|
/**
|
|
|
|
* Remove sign for a plot
|
|
|
|
*/
|
|
|
|
@Override
|
2015-02-24 18:11:14 +11:00
|
|
|
public Location getSignLoc(final PlotWorld plotworld, final Plot plot) {
|
2015-02-19 14:24:05 +11:00
|
|
|
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
|
2015-02-20 22:23:48 +11:00
|
|
|
final Location bot = MainUtil.getPlotBottomLoc(plotworld.worldname, plot.id);
|
2015-02-21 03:17:34 +11:00
|
|
|
return new com.intellectualcrafters.plot.object.Location(plotworld.worldname, bot.getX(), dpw.ROAD_HEIGHT + 1, bot.getZ() - 1);
|
2015-02-18 03:14:34 +11:00
|
|
|
}
|
2015-02-10 21:56:04 +11:00
|
|
|
}
|