Minor tweaks

This commit is contained in:
Jesse Boyd
2016-09-07 00:28:01 +10:00
parent 0557671b80
commit 85ff8bf639
53 changed files with 5215 additions and 32 deletions

View File

@ -222,7 +222,7 @@ public interface IPlotMain extends ILogger {
*/
GeneratorWrapper<?> getGenerator(String world, String name);
GeneratorWrapper<?> wrapPlotGenerator(IndependentPlotGenerator generator);
GeneratorWrapper<?> wrapPlotGenerator(String world, IndependentPlotGenerator generator);
/**
* Register the chunk processor which will clean out chunks that have too

View File

@ -0,0 +1,35 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal2;
import com.intellectualcrafters.plot.object.RunnableVal3;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.*;
import java.util.Set;
@CommandDeclaration(command = "leave",
description = "Leave a plot",
permission = "plots.leave",
category = CommandCategory.CLAIMING,
requiredType = RequiredType.NONE)
public class Leave extends Command {
public Leave(Command parent, boolean isStatic) {
super(MainCommand.getInstance(), true);
}
@Override
public void execute(PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
checkTrue(plot.isAdded(player.getUUID()), C.NO_PLOT_PERMS);
checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage());
if (plot.isOwner(player.getUUID())) {
Set<UUID> owners = plot.getOwners();
} else {
}
}
}

View File

@ -81,7 +81,7 @@ public class ClassicPlotManager extends SquarePlotManager {
LocalBlockQueue queue = plotArea.getQueue(false);
for (RegionWrapper region : plot.getRegions()) {
Location pos1 = new Location(plotArea.worldname, region.minX, 1, region.minZ);
Location pos2 = new Location(plotArea.worldname, region.maxX, 255, region.maxZ);
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), region.maxZ);
queue.setCuboid(pos1, pos2, blocks);
}
queue.enqueue();
@ -97,7 +97,7 @@ public class ClassicPlotManager extends SquarePlotManager {
LocalBlockQueue queue = plotArea.getQueue(false);
for (RegionWrapper region : plot.getRegions()) {
Location pos1 = new Location(plotArea.worldname, region.minX, dpw.PLOT_HEIGHT + 1, region.minZ);
Location pos2 = new Location(plotArea.worldname, region.maxX, 255, region.maxZ);
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), region.maxZ);
queue.setCuboid(pos1, pos2, blocks);
}
queue.enqueue();
@ -147,7 +147,7 @@ public class ClassicPlotManager extends SquarePlotManager {
if (!plot.getMerged(0)) {
int z = bottom.getZ();
for (int x = bottom.getX(); x <= top.getX(); x++) {
for (int y = dpw.PLOT_HEIGHT; y <= 255; y++) {
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(plotArea.MAX_BUILD_HEIGHT, 255); y++) {
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
}
}
@ -155,7 +155,7 @@ public class ClassicPlotManager extends SquarePlotManager {
if (!plot.getMerged(3)) {
int x = bottom.getX();
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
for (int y = dpw.PLOT_HEIGHT; y <= 255; y++) {
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(plotArea.MAX_BUILD_HEIGHT, 255); y++) {
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
}
}
@ -164,7 +164,7 @@ public class ClassicPlotManager extends SquarePlotManager {
if (!plot.getMerged(2)) {
int z = top.getZ();
for (int x = bottom.getX(); x <= top.getX(); x++) {
for (int y = dpw.PLOT_HEIGHT; y <= 255; y++) {
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(plotArea.MAX_BUILD_HEIGHT, 255); y++) {
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
}
}
@ -172,15 +172,15 @@ public class ClassicPlotManager extends SquarePlotManager {
if (!plot.getMerged(1)) {
int x = top.getX();
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
for (int y = dpw.PLOT_HEIGHT; y <= 255; y++) {
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(plotArea.MAX_BUILD_HEIGHT, 255); y++) {
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
}
}
}
if (plot.isBasePlot()) {
for (RegionWrapper region : plot.getRegions()) {
Location pos1 = new Location(plotArea.worldname, region.minX, 255, region.minZ);
Location pos2 = new Location(plotArea.worldname, region.maxX, 255, region.maxZ);
Location pos1 = new Location(plotArea.worldname, region.minX, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), region.minZ);
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), region.maxZ);
queue.setCuboid(pos1, pos2, blocks);
}
}
@ -288,7 +288,7 @@ public class ClassicPlotManager extends SquarePlotManager {
LocalBlockQueue queue = plotArea.getQueue(false);
queue.setCuboid(
new Location(plotArea.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1),
new Location(plotArea.worldname, ex, 255, ez - 1), PlotBlock.get((short) 0, (byte) 0));
new Location(plotArea.worldname, ex, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), ez - 1), PlotBlock.get((short) 0, (byte) 0));
queue.setCuboid(new Location(plotArea.worldname, sx, 0, sz + 1),
new Location(plotArea.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7,
(byte) 0));
@ -320,7 +320,7 @@ public class ClassicPlotManager extends SquarePlotManager {
LocalBlockQueue queue = plotArea.getQueue(false);
queue.setCuboid(
new Location(plotArea.worldname, sx + 1, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
new Location(plotArea.worldname, ex - 1, 255, ez), PlotBlock.get((short) 0, (byte) 0));
new Location(plotArea.worldname, ex - 1, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), ez), PlotBlock.get((short) 0, (byte) 0));
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz),
new Location(plotArea.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0));
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
@ -370,7 +370,7 @@ public class ClassicPlotManager extends SquarePlotManager {
int ez = pos2.getZ() + 1;
LocalBlockQueue queue = plotArea.getQueue(false);
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
new Location(plotArea.worldname, ex, 255, ez), PlotBlock.get((short) 0, (byte) 0));
new Location(plotArea.worldname, ex, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), ez), PlotBlock.get((short) 0, (byte) 0));
queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz + 1),
new Location(plotArea.worldname, ex, dpw.PLOT_HEIGHT - 1, ez - 1), dpw.MAIN_BLOCK);
queue.setCuboid(new Location(plotArea.worldname, sx, dpw.PLOT_HEIGHT, sz + 1),
@ -390,7 +390,7 @@ public class ClassicPlotManager extends SquarePlotManager {
int ex = pos2.getX() + 1;
LocalBlockQueue queue = plotArea.getQueue(false);
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
new Location(plotArea.worldname, ex, 255, ez), PlotBlock.get((short) 0, (byte) 0));
new Location(plotArea.worldname, ex, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), ez), PlotBlock.get((short) 0, (byte) 0));
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
new Location(plotArea.worldname, ex - 1, dpw.PLOT_HEIGHT - 1, ez), dpw.MAIN_BLOCK);
queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.PLOT_HEIGHT, sz),

View File

@ -26,11 +26,7 @@ public class HybridGen extends IndependentPlotGenerator {
public void generateChunk(ScopedLocalBlockQueue result, PlotArea settings, PseudoRandom random) {
HybridPlotWorld hpw = (HybridPlotWorld) settings;
// Biome
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
result.fillBiome(hpw.PLOT_BIOME);
}
}
result.fillBiome(hpw.PLOT_BIOME);
// Bedrock
if (hpw.PLOT_BEDROCK) {
for (short x = 0; x < 16; x++) {

View File

@ -61,7 +61,7 @@ public class HybridPlotManager extends ClassicPlotManager {
Location bot = getPlotBottomLocAbs(hpw, id2);
Location top = getPlotTopLocAbs(hpw, id);
Location pos1 = new Location(plotArea.worldname, top.getX() + 1, 0, bot.getZ() - 1);
Location pos2 = new Location(plotArea.worldname, bot.getX(), 255, top.getZ() + 1);
Location pos2 = new Location(plotArea.worldname, bot.getX(), Math.min(plotArea.MAX_BUILD_HEIGHT, 255), top.getZ() + 1);
MainUtil.resetBiome(plotArea, pos1, pos2);
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
@ -108,7 +108,7 @@ public class HybridPlotManager extends ClassicPlotManager {
Location bot = getPlotBottomLocAbs(hpw, id2);
Location top = getPlotTopLocAbs(hpw, id);
Location pos1 = new Location(plotArea.worldname, bot.getX() - 1, 0, top.getZ() + 1);
Location pos2 = new Location(plotArea.worldname, top.getX() + 1, 255, bot.getZ());
Location pos2 = new Location(plotArea.worldname, top.getX() + 1, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), bot.getZ());
MainUtil.resetBiome(plotArea, pos1, pos2);
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
@ -128,7 +128,7 @@ public class HybridPlotManager extends ClassicPlotManager {
Location pos1 = getPlotTopLocAbs(hpw, id).add(1, 0, 1);
Location pos2 = getPlotBottomLocAbs(hpw, id2);
pos1.setY(0);
pos2.setY(256);
pos2.setY(Math.min(plotArea.MAX_BUILD_HEIGHT, 255));
LocalBlockQueue queue = hpw.getQueue(false);
createSchemAbs(hpw, queue, pos1, pos2, true);
if (hpw.ROAD_SCHEMATIC_ENABLED) {
@ -145,7 +145,7 @@ public class HybridPlotManager extends ClassicPlotManager {
* to have 512x512 sized plots. </p>
*/
@Override
public boolean clearPlot(PlotArea plotArea, Plot plot, final Runnable whenDone) {
public boolean clearPlot(final PlotArea plotArea, Plot plot, final Runnable whenDone) {
final String world = plotArea.worldname;
final HybridPlotWorld dpw = (HybridPlotWorld) plotArea;
Location pos1 = plot.getBottomAbs();
@ -189,7 +189,7 @@ public class HybridPlotManager extends ClassicPlotManager {
top.setY(dpw.PLOT_HEIGHT + 1);
queue.setCuboid(bot, top, plotfloor);
bot.setY(dpw.PLOT_HEIGHT + 1);
top.setY(256);
top.setY(plotArea.MAX_BUILD_HEIGHT);
queue.setCuboid(bot, top, air);
// And finally set the schematic, the y value is unimportant for this function
pastePlotSchematic(dpw, queue, bot, top);

View File

@ -70,8 +70,8 @@ public abstract class IndependentPlotGenerator {
* @param <T>
* @return
*/
public <T> GeneratorWrapper<T> specify() {
return (GeneratorWrapper<T>) PS.get().IMP.wrapPlotGenerator(this);
public <T> GeneratorWrapper<T> specify(String world) {
return (GeneratorWrapper<T>) PS.get().IMP.wrapPlotGenerator(world, this);
}
@Override