mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Let generator be up to the implementation
This commit is contained in:
parent
56227a6d7d
commit
264114332b
@ -357,7 +357,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final ChunkGenerator getDefaultWorldGenerator(String world, String id) {
|
public final ChunkGenerator getDefaultWorldGenerator(String world, String id) {
|
||||||
HybridGen result = new HybridGen();
|
IndependentPlotGenerator result = PS.get().IMP.getDefaultGenerator();
|
||||||
if (!PS.get().setupPlotWorld(world, id, result)) {
|
if (!PS.get().setupPlotWorld(world, id, result)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -489,7 +489,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
return new BukkitPlotGenerator(world, gen);
|
return new BukkitPlotGenerator(world, gen);
|
||||||
} else {
|
} else {
|
||||||
return new BukkitPlotGenerator(new HybridGen());
|
return new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,6 +573,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
|
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IndependentPlotGenerator getDefaultGenerator() {
|
||||||
|
return new HybridGen();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventoryUtil initInventoryUtil() {
|
public InventoryUtil initInventoryUtil() {
|
||||||
return new BukkitInventoryUtil();
|
return new BukkitInventoryUtil();
|
||||||
|
@ -318,7 +318,7 @@ public class LikePlotMeConverter {
|
|||||||
// Load using Bukkit API
|
// Load using Bukkit API
|
||||||
// - User must set generator manually
|
// - User must set generator manually
|
||||||
Bukkit.getServer().unloadWorld(world, true);
|
Bukkit.getServer().unloadWorld(world, true);
|
||||||
World myWorld = WorldCreator.name(actualWorldName).generator(new BukkitPlotGenerator(new HybridGen())).createWorld();
|
World myWorld = WorldCreator.name(actualWorldName).generator(new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator())).createWorld();
|
||||||
myWorld.save();
|
myWorld.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotManager getNewPlotManager() {
|
public PlotManager getNewPlotManager() {
|
||||||
return new HybridGen().getNewPlotManager();
|
return PS.get().IMP.getDefaultGenerator().getNewPlotManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -130,7 +130,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
||||||
return new HybridGen().getNewPlotArea(world, id, min, max);
|
return PS.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -236,6 +236,12 @@ public interface IPlotMain extends ILogger {
|
|||||||
*/
|
*/
|
||||||
void registerWorldEvents();
|
void registerWorldEvents();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Usually HybridGen
|
||||||
|
* @return Default implementation generator
|
||||||
|
*/
|
||||||
|
IndependentPlotGenerator getDefaultGenerator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the class that will manage player titles.
|
* Get the class that will manage player titles.
|
||||||
* @return
|
* @return
|
||||||
|
@ -157,7 +157,7 @@ public class Area extends SubCommand {
|
|||||||
id = null;
|
id = null;
|
||||||
}
|
}
|
||||||
object.world = split[0];
|
object.world = split[0];
|
||||||
final HybridPlotWorld pa = new HybridPlotWorld(object.world, id, new HybridGen(), null, null);
|
final HybridPlotWorld pa = new HybridPlotWorld(object.world, id, PS.get().IMP.getDefaultGenerator(), null, null);
|
||||||
PlotArea other = PS.get().getPlotArea(pa.worldname, id);
|
PlotArea other = PS.get().getPlotArea(pa.worldname, id);
|
||||||
if (other != null && Objects.equals(pa.id, other.id)) {
|
if (other != null && Objects.equals(pa.id, other.id)) {
|
||||||
C.SETUP_WORLD_TAKEN.send(player, pa.toString());
|
C.SETUP_WORLD_TAKEN.send(player, pa.toString());
|
||||||
|
@ -79,9 +79,10 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
for (RegionWrapper region : plot.getRegions()) {
|
for (RegionWrapper region : plot.getRegions()) {
|
||||||
Location pos1 = new Location(plotArea.worldname, region.minX, 1, region.minZ);
|
Location pos1 = new Location(plotArea.worldname, region.minX, 1, region.minZ);
|
||||||
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), region.maxZ);
|
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(maxY, 255), region.maxZ);
|
||||||
queue.setCuboid(pos1, pos2, blocks);
|
queue.setCuboid(pos1, pos2, blocks);
|
||||||
}
|
}
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
@ -95,9 +96,10 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
}
|
}
|
||||||
ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea;
|
ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
for (RegionWrapper region : plot.getRegions()) {
|
for (RegionWrapper region : plot.getRegions()) {
|
||||||
Location pos1 = new Location(plotArea.worldname, region.minX, dpw.PLOT_HEIGHT + 1, region.minZ);
|
Location pos1 = new Location(plotArea.worldname, region.minX, dpw.PLOT_HEIGHT + 1, region.minZ);
|
||||||
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), region.maxZ);
|
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(maxY, 255), region.maxZ);
|
||||||
queue.setCuboid(pos1, pos2, blocks);
|
queue.setCuboid(pos1, pos2, blocks);
|
||||||
}
|
}
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
@ -144,10 +146,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
Location top = plot.getExtendedTopAbs();
|
Location top = plot.getExtendedTopAbs();
|
||||||
PseudoRandom random = new PseudoRandom();
|
PseudoRandom random = new PseudoRandom();
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
if (!plot.getMerged(0)) {
|
if (!plot.getMerged(0)) {
|
||||||
int z = bottom.getZ();
|
int z = bottom.getZ();
|
||||||
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
||||||
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(plotArea.MAX_BUILD_HEIGHT, 255); y++) {
|
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(maxY, 255); y++) {
|
||||||
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +158,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
if (!plot.getMerged(3)) {
|
if (!plot.getMerged(3)) {
|
||||||
int x = bottom.getX();
|
int x = bottom.getX();
|
||||||
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
||||||
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(plotArea.MAX_BUILD_HEIGHT, 255); y++) {
|
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(maxY, 255); y++) {
|
||||||
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +167,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
if (!plot.getMerged(2)) {
|
if (!plot.getMerged(2)) {
|
||||||
int z = top.getZ();
|
int z = top.getZ();
|
||||||
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
||||||
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(plotArea.MAX_BUILD_HEIGHT, 255); y++) {
|
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(maxY, 255); y++) {
|
||||||
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,15 +175,15 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
if (!plot.getMerged(1)) {
|
if (!plot.getMerged(1)) {
|
||||||
int x = top.getX();
|
int x = top.getX();
|
||||||
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
||||||
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(plotArea.MAX_BUILD_HEIGHT, 255); y++) {
|
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(maxY, 255); y++) {
|
||||||
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (plot.isBasePlot()) {
|
if (plot.isBasePlot()) {
|
||||||
for (RegionWrapper region : plot.getRegions()) {
|
for (RegionWrapper region : plot.getRegions()) {
|
||||||
Location pos1 = new Location(plotArea.worldname, region.minX, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), region.minZ);
|
Location pos1 = new Location(plotArea.worldname, region.minX, Math.min(maxY, 255), region.minZ);
|
||||||
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), region.maxZ);
|
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(maxY, 255), region.maxZ);
|
||||||
queue.setCuboid(pos1, pos2, blocks);
|
queue.setCuboid(pos1, pos2, blocks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,9 +289,10 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int sz = pos1.getZ() - 2;
|
int sz = pos1.getZ() - 2;
|
||||||
int ez = pos2.getZ() + 2;
|
int ez = pos2.getZ() + 2;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
queue.setCuboid(
|
queue.setCuboid(
|
||||||
new Location(plotArea.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1),
|
new Location(plotArea.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1),
|
||||||
new Location(plotArea.worldname, ex, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), ez - 1), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex, Math.min(maxY, 255), ez - 1), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, 0, sz + 1),
|
queue.setCuboid(new Location(plotArea.worldname, sx, 0, sz + 1),
|
||||||
new Location(plotArea.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7,
|
new Location(plotArea.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7,
|
||||||
(byte) 0));
|
(byte) 0));
|
||||||
@ -318,9 +322,10 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int sx = pos1.getX() - 2;
|
int sx = pos1.getX() - 2;
|
||||||
int ex = pos2.getX() + 2;
|
int ex = pos2.getX() + 2;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
queue.setCuboid(
|
queue.setCuboid(
|
||||||
new Location(plotArea.worldname, sx + 1, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
new Location(plotArea.worldname, sx + 1, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
||||||
new Location(plotArea.worldname, ex - 1, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex - 1, Math.min(maxY, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz),
|
||||||
new Location(plotArea.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0));
|
new Location(plotArea.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
|
||||||
@ -369,8 +374,9 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int sz = pos1.getZ() - 1;
|
int sz = pos1.getZ() - 1;
|
||||||
int ez = pos2.getZ() + 1;
|
int ez = pos2.getZ() + 1;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
||||||
new Location(plotArea.worldname, ex, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex, Math.min(maxY, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz + 1),
|
queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz + 1),
|
||||||
new Location(plotArea.worldname, ex, dpw.PLOT_HEIGHT - 1, ez - 1), dpw.MAIN_BLOCK);
|
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),
|
queue.setCuboid(new Location(plotArea.worldname, sx, dpw.PLOT_HEIGHT, sz + 1),
|
||||||
@ -389,8 +395,9 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int sx = pos1.getX() - 1;
|
int sx = pos1.getX() - 1;
|
||||||
int ex = pos2.getX() + 1;
|
int ex = pos2.getX() + 1;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
||||||
new Location(plotArea.worldname, ex, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex, Math.min(maxY, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
|
||||||
new Location(plotArea.worldname, ex - 1, dpw.PLOT_HEIGHT - 1, ez), dpw.MAIN_BLOCK);
|
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),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.PLOT_HEIGHT, sz),
|
||||||
|
@ -247,7 +247,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotManager getNewPlotManager() {
|
public PlotManager getNewPlotManager() {
|
||||||
return new HybridPlotManager();
|
return new HybridPlotManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,7 +61,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
Location bot = getPlotBottomLocAbs(hpw, id2);
|
Location bot = getPlotBottomLocAbs(hpw, id2);
|
||||||
Location top = getPlotTopLocAbs(hpw, id);
|
Location top = getPlotTopLocAbs(hpw, id);
|
||||||
Location pos1 = new Location(plotArea.worldname, top.getX() + 1, 0, bot.getZ() - 1);
|
Location pos1 = new Location(plotArea.worldname, top.getX() + 1, 0, bot.getZ() - 1);
|
||||||
Location pos2 = new Location(plotArea.worldname, bot.getX(), Math.min(plotArea.MAX_BUILD_HEIGHT, 255), top.getZ() + 1);
|
Location pos2 = new Location(plotArea.worldname, bot.getX(), Math.min(getWorldHeight(), 255), top.getZ() + 1);
|
||||||
MainUtil.resetBiome(plotArea, pos1, pos2);
|
MainUtil.resetBiome(plotArea, pos1, pos2);
|
||||||
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
|
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
|
||||||
return true;
|
return true;
|
||||||
@ -108,7 +108,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
Location bot = getPlotBottomLocAbs(hpw, id2);
|
Location bot = getPlotBottomLocAbs(hpw, id2);
|
||||||
Location top = getPlotTopLocAbs(hpw, id);
|
Location top = getPlotTopLocAbs(hpw, id);
|
||||||
Location pos1 = new Location(plotArea.worldname, bot.getX() - 1, 0, top.getZ() + 1);
|
Location pos1 = new Location(plotArea.worldname, bot.getX() - 1, 0, top.getZ() + 1);
|
||||||
Location pos2 = new Location(plotArea.worldname, top.getX() + 1, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), bot.getZ());
|
Location pos2 = new Location(plotArea.worldname, top.getX() + 1, Math.min(getWorldHeight(), 255), bot.getZ());
|
||||||
MainUtil.resetBiome(plotArea, pos1, pos2);
|
MainUtil.resetBiome(plotArea, pos1, pos2);
|
||||||
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
|
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
|
||||||
return true;
|
return true;
|
||||||
@ -128,7 +128,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
Location pos1 = getPlotTopLocAbs(hpw, id).add(1, 0, 1);
|
Location pos1 = getPlotTopLocAbs(hpw, id).add(1, 0, 1);
|
||||||
Location pos2 = getPlotBottomLocAbs(hpw, id2);
|
Location pos2 = getPlotBottomLocAbs(hpw, id2);
|
||||||
pos1.setY(0);
|
pos1.setY(0);
|
||||||
pos2.setY(Math.min(plotArea.MAX_BUILD_HEIGHT, 255));
|
pos2.setY(Math.min(getWorldHeight(), 255));
|
||||||
LocalBlockQueue queue = hpw.getQueue(false);
|
LocalBlockQueue queue = hpw.getQueue(false);
|
||||||
createSchemAbs(hpw, queue, pos1, pos2, true);
|
createSchemAbs(hpw, queue, pos1, pos2, true);
|
||||||
if (hpw.ROAD_SCHEMATIC_ENABLED) {
|
if (hpw.ROAD_SCHEMATIC_ENABLED) {
|
||||||
@ -189,7 +189,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
top.setY(dpw.PLOT_HEIGHT + 1);
|
top.setY(dpw.PLOT_HEIGHT + 1);
|
||||||
queue.setCuboid(bot, top, plotfloor);
|
queue.setCuboid(bot, top, plotfloor);
|
||||||
bot.setY(dpw.PLOT_HEIGHT + 1);
|
bot.setY(dpw.PLOT_HEIGHT + 1);
|
||||||
top.setY(plotArea.MAX_BUILD_HEIGHT);
|
top.setY(getWorldHeight());
|
||||||
queue.setCuboid(bot, top, air);
|
queue.setCuboid(bot, top, air);
|
||||||
// And finally set the schematic, the y value is unimportant for this function
|
// And finally set the schematic, the y value is unimportant for this function
|
||||||
pastePlotSchematic(dpw, queue, bot, top);
|
pastePlotSchematic(dpw, queue, bot, top);
|
||||||
|
@ -47,7 +47,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
int pz = plotId.y;
|
int pz = plotId.y;
|
||||||
int x = (dpw.ROAD_OFFSET_X + (px * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH))) - (int) Math.floor(dpw.ROAD_WIDTH / 2) - 1;
|
int x = (dpw.ROAD_OFFSET_X + (px * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH))) - (int) Math.floor(dpw.ROAD_WIDTH / 2) - 1;
|
||||||
int z = (dpw.ROAD_OFFSET_Z + (pz * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH))) - (int) Math.floor(dpw.ROAD_WIDTH / 2) - 1;
|
int z = (dpw.ROAD_OFFSET_Z + (pz * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH))) - (int) Math.floor(dpw.ROAD_WIDTH / 2) - 1;
|
||||||
return new Location(plotArea.worldname, x, Math.min(plotArea.MAX_BUILD_HEIGHT, 255), z);
|
return new Location(plotArea.worldname, x, Math.min(getWorldHeight(), 255), z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,4 +73,8 @@ public abstract class PlotManager {
|
|||||||
Template.zipAll(plotArea.worldname, files);
|
Template.zipAll(plotArea.worldname, files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getWorldHeight() {
|
||||||
|
return 255;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: "PlotSquared"
|
name: "PlotSquared"
|
||||||
version: "3.4.6-SNAPSHOT-a95b68b"
|
version: "3.4.6-SNAPSHOT-56227a6"
|
||||||
author: Empire92
|
author: Empire92
|
||||||
api: ["1.0.0"]
|
api: ["1.0.0"]
|
||||||
main: com.plotsquared.nukkit.NukkitMain
|
main: com.plotsquared.nukkit.NukkitMain
|
||||||
|
@ -15,10 +15,13 @@ import com.intellectualcrafters.plot.PS;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||||
|
import com.intellectualcrafters.plot.generator.HybridGen;
|
||||||
|
import com.intellectualcrafters.plot.generator.HybridPlotManager;
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
|
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
|
||||||
@ -407,4 +410,19 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IndependentPlotGenerator getDefaultGenerator() {
|
||||||
|
return new HybridGen() {
|
||||||
|
@Override
|
||||||
|
public PlotManager getNewPlotManager() {
|
||||||
|
return new HybridPlotManager() {
|
||||||
|
@Override
|
||||||
|
public int getWorldHeight() {
|
||||||
|
return 127;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotManager getNewPlotManager() {
|
public PlotManager getNewPlotManager() {
|
||||||
return new HybridGen().getNewPlotManager();
|
return PS.get().IMP.getDefaultGenerator().getNewPlotManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,7 +67,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
||||||
return new HybridGen().getNewPlotArea(world, id, min, max);
|
return PS.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +49,7 @@ public class WorldEvents implements Listener {
|
|||||||
settings.put("generator", gen);
|
settings.put("generator", gen);
|
||||||
PS.get().loadWorld(name, new NukkitPlotGenerator(settings));
|
PS.get().loadWorld(name, new NukkitPlotGenerator(settings));
|
||||||
for (PlotArea area : PS.get().getPlotAreas(name)) {
|
for (PlotArea area : PS.get().getPlotAreas(name)) {
|
||||||
area.MAX_BUILD_HEIGHT = Math.min(128, area.MAX_BUILD_HEIGHT);
|
area.MAX_BUILD_HEIGHT = Math.min(127, area.MAX_BUILD_HEIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -36,7 +36,7 @@ public class NukkitSetupUtils extends SetupUtils {
|
|||||||
String testWorld = "CheckingPlotSquaredGenerator";
|
String testWorld = "CheckingPlotSquaredGenerator";
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("world", testWorld);
|
map.put("world", testWorld);
|
||||||
map.put("plot-generator", new HybridGen());
|
map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
||||||
NukkitPlotGenerator gen = new NukkitPlotGenerator(map);
|
NukkitPlotGenerator gen = new NukkitPlotGenerator(map);
|
||||||
SetupUtils.generators.put("PlotSquared", gen);
|
SetupUtils.generators.put("PlotSquared", gen);
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ public class NukkitSetupUtils extends SetupUtils {
|
|||||||
if (object.setupGenerator != null) {
|
if (object.setupGenerator != null) {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("world", object.world);
|
map.put("world", object.world);
|
||||||
map.put("plot-generator", new HybridGen());
|
map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
||||||
plugin.getServer().generateLevel(object.world, object.world.hashCode(), NukkitPlotGenerator.class, map);
|
plugin.getServer().generateLevel(object.world, object.world.hashCode(), NukkitPlotGenerator.class, map);
|
||||||
} else {
|
} else {
|
||||||
plugin.getServer().generateLevel(object.world, object.world.hashCode());
|
plugin.getServer().generateLevel(object.world, object.world.hashCode());
|
||||||
|
@ -24,7 +24,7 @@ public class NukkitHybridGen extends NukkitPlotGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
existing.put("plot-generator", new HybridGen());
|
existing.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public class SpongeMain implements IPlotMain {
|
|||||||
THIS = this;
|
THIS = this;
|
||||||
new PS(this, "Sponge");
|
new PS(this, "Sponge");
|
||||||
this.server = this.game.getServer();
|
this.server = this.game.getServer();
|
||||||
this.game.getRegistry().register(WorldGeneratorModifier.class, (WorldGeneratorModifier) new HybridGen().specify(null));
|
this.game.getRegistry().register(WorldGeneratorModifier.class, (WorldGeneratorModifier) PS.get().IMP.getDefaultGenerator().specify(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -390,7 +390,7 @@ public class SpongeMain implements IPlotMain {
|
|||||||
return new SpongePlotGenerator(wgm);
|
return new SpongePlotGenerator(wgm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new SpongePlotGenerator(new HybridGen());
|
return new SpongePlotGenerator(PS.get().IMP.getDefaultGenerator());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -403,4 +403,9 @@ public class SpongeMain implements IPlotMain {
|
|||||||
return this.game.getPluginManager().getPlugins().stream().map(plugin1 -> plugin1.getName() + ';' + plugin1.getVersion() + ':' + true)
|
return this.game.getPluginManager().getPlugins().stream().map(plugin1 -> plugin1.getName() + ';' + plugin1.getVersion() + ':' + true)
|
||||||
.collect(Collectors.toCollection(ArrayList::new));
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IndependentPlotGenerator getDefaultGenerator() {
|
||||||
|
return new HybridGen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class SpongeSetupUtils extends SetupUtils {
|
|||||||
if (!SetupUtils.generators.isEmpty()) {
|
if (!SetupUtils.generators.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetupUtils.generators.put("PlotSquared", new SpongePlotGenerator(new HybridGen()));
|
SetupUtils.generators.put("PlotSquared", new SpongePlotGenerator(PS.get().IMP.getDefaultGenerator()));
|
||||||
// TODO get external world generators
|
// TODO get external world generators
|
||||||
Collection<WorldGeneratorModifier> wgms = Sponge.getRegistry().getAllOf(WorldGeneratorModifier.class);
|
Collection<WorldGeneratorModifier> wgms = Sponge.getRegistry().getAllOf(WorldGeneratorModifier.class);
|
||||||
for (WorldGeneratorModifier wgm : wgms) {
|
for (WorldGeneratorModifier wgm : wgms) {
|
||||||
|
Loading…
Reference in New Issue
Block a user