From 264114332b6568ec184a2f7d687612fd13ea4540 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 17 Sep 2016 16:02:05 +1000 Subject: [PATCH] Let generator be up to the implementation --- .../com/plotsquared/bukkit/BukkitMain.java | 9 ++++-- .../database/plotme/LikePlotMeConverter.java | 2 +- .../bukkit/generator/BukkitPlotGenerator.java | 4 +-- .../intellectualcrafters/plot/IPlotMain.java | 6 ++++ .../plot/commands/Area.java | 2 +- .../plot/generator/ClassicPlotManager.java | 31 ++++++++++++------- .../plot/generator/HybridGen.java | 2 +- .../plot/generator/HybridPlotManager.java | 8 ++--- .../plot/generator/SquarePlotManager.java | 2 +- .../plot/object/PlotManager.java | 4 +++ Nukkit/build/resources/main/plugin.yml | 2 +- .../com/plotsquared/nukkit/NukkitMain.java | 18 +++++++++++ .../nukkit/generator/NukkitPlotGenerator.java | 4 +-- .../nukkit/listeners/WorldEvents.java | 2 +- .../nukkit/util/NukkitSetupUtils.java | 4 +-- .../nukkit/util/block/NukkitHybridGen.java | 2 +- .../com/plotsquared/sponge/SpongeMain.java | 9 ++++-- .../sponge/util/SpongeSetupUtils.java | 2 +- 18 files changed, 79 insertions(+), 34 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 94ea558a0..f67334a87 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -357,7 +357,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override 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)) { return null; } @@ -489,7 +489,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } return new BukkitPlotGenerator(world, gen); } 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); } + @Override + public IndependentPlotGenerator getDefaultGenerator() { + return new HybridGen(); + } + @Override public InventoryUtil initInventoryUtil() { return new BukkitInventoryUtil(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java index 88e8a5c46..f20bf20f7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java @@ -318,7 +318,7 @@ public class LikePlotMeConverter { // Load using Bukkit API // - User must set generator manually 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(); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 579acc44c..7f78448a5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -120,7 +120,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap @Override public PlotManager getNewPlotManager() { - return new HybridGen().getNewPlotManager(); + return PS.get().IMP.getDefaultGenerator().getNewPlotManager(); } @Override @@ -130,7 +130,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap @Override 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 diff --git a/Core/src/main/java/com/intellectualcrafters/plot/IPlotMain.java b/Core/src/main/java/com/intellectualcrafters/plot/IPlotMain.java index bb5948d41..f9aecdccc 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/IPlotMain.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/IPlotMain.java @@ -236,6 +236,12 @@ public interface IPlotMain extends ILogger { */ void registerWorldEvents(); + /** + * Usually HybridGen + * @return Default implementation generator + */ + IndependentPlotGenerator getDefaultGenerator(); + /** * Get the class that will manage player titles. * @return diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java index 3b894aa40..81241e8f5 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java @@ -157,7 +157,7 @@ public class Area extends SubCommand { id = null; } 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); if (other != null && Objects.equals(pa.id, other.id)) { C.SETUP_WORLD_TAKEN.send(player, pa.toString()); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java index ace2a8a90..6e7183e57 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java @@ -79,9 +79,10 @@ public class ClassicPlotManager extends SquarePlotManager { return false; } LocalBlockQueue queue = plotArea.getQueue(false); + int maxY = plotArea.getPlotManager().getWorldHeight(); for (RegionWrapper region : plot.getRegions()) { 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.enqueue(); @@ -95,9 +96,10 @@ public class ClassicPlotManager extends SquarePlotManager { } ClassicPlotWorld dpw = (ClassicPlotWorld) plotArea; LocalBlockQueue queue = plotArea.getQueue(false); + int maxY = plotArea.getPlotManager().getWorldHeight(); 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, 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.enqueue(); @@ -144,10 +146,11 @@ public class ClassicPlotManager extends SquarePlotManager { Location top = plot.getExtendedTopAbs(); PseudoRandom random = new PseudoRandom(); LocalBlockQueue queue = plotArea.getQueue(false); + int maxY = plotArea.getPlotManager().getWorldHeight(); if (!plot.getMerged(0)) { int z = bottom.getZ(); 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)]); } } @@ -155,7 +158,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 <= 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)]); } } @@ -164,7 +167,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 <= 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)]); } } @@ -172,15 +175,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 <= 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)]); } } } if (plot.isBasePlot()) { for (RegionWrapper region : plot.getRegions()) { - 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); + Location pos1 = new Location(plotArea.worldname, region.minX, Math.min(maxY, 255), region.minZ); + Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(maxY, 255), region.maxZ); queue.setCuboid(pos1, pos2, blocks); } } @@ -286,9 +289,10 @@ public class ClassicPlotManager extends SquarePlotManager { int sz = pos1.getZ() - 2; int ez = pos2.getZ() + 2; LocalBlockQueue queue = plotArea.getQueue(false); + int maxY = plotArea.getPlotManager().getWorldHeight(); queue.setCuboid( 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), new Location(plotArea.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7, (byte) 0)); @@ -318,9 +322,10 @@ public class ClassicPlotManager extends SquarePlotManager { int sx = pos1.getX() - 2; int ex = pos2.getX() + 2; LocalBlockQueue queue = plotArea.getQueue(false); + int maxY = plotArea.getPlotManager().getWorldHeight(); queue.setCuboid( 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), new Location(plotArea.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0)); 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 ez = pos2.getZ() + 1; 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), - 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), 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), @@ -389,8 +395,9 @@ public class ClassicPlotManager extends SquarePlotManager { int sx = pos1.getX() - 1; int ex = pos2.getX() + 1; 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), - 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), 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), diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java index ffa6801b9..0653aaf41 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java @@ -247,7 +247,7 @@ public class HybridGen extends IndependentPlotGenerator { @Override public PlotManager getNewPlotManager() { - return new HybridPlotManager(); + return new HybridPlotManager(); } @Override diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java index b17b0e9cc..cfca6d55d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java @@ -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(), 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); 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, 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); 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(Math.min(plotArea.MAX_BUILD_HEIGHT, 255)); + pos2.setY(Math.min(getWorldHeight(), 255)); LocalBlockQueue queue = hpw.getQueue(false); createSchemAbs(hpw, queue, pos1, pos2, true); if (hpw.ROAD_SCHEMATIC_ENABLED) { @@ -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(plotArea.MAX_BUILD_HEIGHT); + top.setY(getWorldHeight()); queue.setCuboid(bot, top, air); // And finally set the schematic, the y value is unimportant for this function pastePlotSchematic(dpw, queue, bot, top); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java index 14b2706bc..978e2873a 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java @@ -47,7 +47,7 @@ public abstract class SquarePlotManager extends GridPlotManager { 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 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 diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java index 1f0a9949b..516ac72fb 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java @@ -73,4 +73,8 @@ public abstract class PlotManager { Template.zipAll(plotArea.worldname, files); } + public int getWorldHeight() { + return 255; + } + } diff --git a/Nukkit/build/resources/main/plugin.yml b/Nukkit/build/resources/main/plugin.yml index 11087834b..3bd389656 100644 --- a/Nukkit/build/resources/main/plugin.yml +++ b/Nukkit/build/resources/main/plugin.yml @@ -1,5 +1,5 @@ name: "PlotSquared" -version: "3.4.6-SNAPSHOT-a95b68b" +version: "3.4.6-SNAPSHOT-56227a6" author: Empire92 api: ["1.0.0"] main: com.plotsquared.nukkit.NukkitMain diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java index c56cc5129..33c4d4449 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java @@ -15,10 +15,13 @@ import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; 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.IndependentPlotGenerator; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotArea; +import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.chat.PlainChatManager; @@ -407,4 +410,19 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain } return names; } + + @Override + public IndependentPlotGenerator getDefaultGenerator() { + return new HybridGen() { + @Override + public PlotManager getNewPlotManager() { + return new HybridPlotManager() { + @Override + public int getWorldHeight() { + return 127; + } + }; + } + }; + } } diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/generator/NukkitPlotGenerator.java b/Nukkit/src/main/java/com/plotsquared/nukkit/generator/NukkitPlotGenerator.java index d37609549..57ad4936d 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/generator/NukkitPlotGenerator.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/generator/NukkitPlotGenerator.java @@ -57,7 +57,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper map = new HashMap<>(); map.put("world", testWorld); - map.put("plot-generator", new HybridGen()); + map.put("plot-generator", PS.get().IMP.getDefaultGenerator()); NukkitPlotGenerator gen = new NukkitPlotGenerator(map); SetupUtils.generators.put("PlotSquared", gen); } @@ -119,7 +119,7 @@ public class NukkitSetupUtils extends SetupUtils { if (object.setupGenerator != null) { HashMap map = new HashMap<>(); 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); } else { plugin.getServer().generateLevel(object.world, object.world.hashCode()); diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitHybridGen.java b/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitHybridGen.java index ee72b62bb..aec5bf646 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitHybridGen.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitHybridGen.java @@ -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; } } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java index cfda08219..5deb23f66 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java @@ -136,7 +136,7 @@ public class SpongeMain implements IPlotMain { THIS = this; new PS(this, "Sponge"); 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 @@ -390,7 +390,7 @@ public class SpongeMain implements IPlotMain { return new SpongePlotGenerator(wgm); } } - return new SpongePlotGenerator(new HybridGen()); + return new SpongePlotGenerator(PS.get().IMP.getDefaultGenerator()); } @Override @@ -403,4 +403,9 @@ public class SpongeMain implements IPlotMain { return this.game.getPluginManager().getPlugins().stream().map(plugin1 -> plugin1.getName() + ';' + plugin1.getVersion() + ':' + true) .collect(Collectors.toCollection(ArrayList::new)); } + + @Override + public IndependentPlotGenerator getDefaultGenerator() { + return new HybridGen(); + } } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java index e814beaf5..3ef7d2261 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java @@ -32,7 +32,7 @@ public class SpongeSetupUtils extends SetupUtils { if (!SetupUtils.generators.isEmpty()) { return; } - SetupUtils.generators.put("PlotSquared", new SpongePlotGenerator(new HybridGen())); + SetupUtils.generators.put("PlotSquared", new SpongePlotGenerator(PS.get().IMP.getDefaultGenerator())); // TODO get external world generators Collection wgms = Sponge.getRegistry().getAllOf(WorldGeneratorModifier.class); for (WorldGeneratorModifier wgm : wgms) {