Fixes #748
Fixes #759
This commit is contained in:
Jesse Boyd
2015-11-28 22:46:10 +11:00
parent 7db30590c6
commit 94b0fbb266
23 changed files with 445 additions and 140 deletions

View File

@ -28,9 +28,21 @@ public class ClassicPlotManager extends SquarePlotManager {
return true;
}
case "all": {
setAll(plotworld, plotid, blocks);
return true;
}
case "air": {
setAir(plotworld, plotid, blocks);
return true;
}
case "main": {
setMain(plotworld, plotid, blocks);
return true;
}
case "middle": {
setMiddle(plotworld, plotid, blocks);
return true;
}
case "outline": {
setOutline(plotworld, plotid, blocks);
return true;
@ -67,6 +79,20 @@ public class ClassicPlotManager extends SquarePlotManager {
return true;
}
public boolean setAll(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
Plot plot = MainUtil.getPlotAbs(plotworld.worldname, plotid);
if (!plot.isBasePlot()) {
return false;
}
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
for (RegionWrapper region : MainUtil.getRegions(plot)) {
Location pos1 = new Location(plot.world, region.minX, 1, region.minZ);
Location pos2 = new Location(plot.world, region.maxX, 255, region.maxZ);
MainUtil.setCuboidAsync(plotworld.worldname, pos1, pos2, blocks);
}
return true;
}
public boolean setAir(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
Plot plot = MainUtil.getPlotAbs(plotworld.worldname, plotid);
if (!plot.isBasePlot()) {
@ -81,6 +107,31 @@ public class ClassicPlotManager extends SquarePlotManager {
return true;
}
public boolean setMain(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
Plot plot = MainUtil.getPlotAbs(plotworld.worldname, plotid);
if (!plot.isBasePlot()) {
return false;
}
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
for (RegionWrapper region : MainUtil.getRegions(plot)) {
Location pos1 = new Location(plot.world, region.minX, 1, region.minZ);
Location pos2 = new Location(plot.world, region.maxX, dpw.PLOT_HEIGHT - 1, region.maxZ);
MainUtil.setCuboidAsync(plotworld.worldname, pos1, pos2, blocks);
}
return true;
}
public boolean setMiddle(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
Plot plot = MainUtil.getPlotAbs(plotworld.worldname, plotid);
if (!plot.isBasePlot()) {
return false;
}
Location[] corners = plot.getCorners();
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
SetBlockQueue.setBlock(plotworld.worldname, (corners[0].getX() + corners[1].getX()) / 2, dpw.PLOT_HEIGHT, (corners[0].getZ() + corners[1].getZ()) / 2, blocks[0]);
return true;
}
public boolean setOutline(final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
if (dpw.ROAD_WIDTH == 0) {
@ -368,7 +419,7 @@ public class ClassicPlotManager extends SquarePlotManager {
@Override
public String[] getPlotComponents(final PlotWorld plotworld, final PlotId plotid) {
return new String[] { "floor", "wall", "border", "all", "outline" };
return new String[] { "main", "floor", "air", "all", "border", "wall", "outline", "middle" };
}
/**