diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java index 49ea227c0..770fb0f5f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java @@ -35,6 +35,8 @@ import com.intellectualcrafters.plot.listeners.PlayerEvents; import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8; import com.intellectualcrafters.plot.listeners.PlotPlusListener; import com.intellectualcrafters.plot.listeners.WorldEditListener; +import com.intellectualcrafters.plot.listeners.WorldEvents; +import com.intellectualcrafters.plot.object.PlotGenerator; import com.intellectualcrafters.plot.titles.AbstractTitle; import com.intellectualcrafters.plot.titles.DefaultTitle; import com.intellectualcrafters.plot.util.BlockManager; @@ -99,7 +101,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { } else { log("&dUsing metrics will allow us to improve the plugin, please consider it :)"); } - getServer().getPluginManager().registerEvents(this, this); + getServer().getPluginManager().registerEvents(new WorldEvents(), this); } @Override @@ -295,12 +297,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { } @Override - public void getGenerator(final String world, final String name) { + public ChunkGenerator getGenerator(final String world, final String name) { final Plugin gen_plugin = Bukkit.getPluginManager().getPlugin(name); if ((gen_plugin != null) && gen_plugin.isEnabled()) { - gen_plugin.getDefaultWorldGenerator(world, ""); + return gen_plugin.getDefaultWorldGenerator(world, ""); } else { - new HybridGen(); + return new HybridGen(); } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/IPlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/IPlotMain.java index fdd5dc407..d2d10b564 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/IPlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/IPlotMain.java @@ -2,6 +2,8 @@ package com.intellectualcrafters.plot; import java.io.File; +import org.bukkit.generator.ChunkGenerator; + import net.milkbowl.vault.economy.Economy; import com.intellectualcrafters.plot.generator.HybridUtils; @@ -53,5 +55,5 @@ public interface IPlotMain { public boolean initPlotMeConverter(); - public void getGenerator(String world, String name); + public ChunkGenerator getGenerator(String world, String name); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java index 37ea49f49..9a8b4d047 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java @@ -218,7 +218,7 @@ public class PlotSquared { return true; } - public static void loadWorld(final String world, final PlotGenerator generator) { + public static void loadWorld(final String world, PlotGenerator generator) { PlotWorld plotWorld = getPlotWorld(world); if (plotWorld != null) { if (generator != null) { @@ -263,10 +263,11 @@ public class PlotSquared { try { final String gen_string = config.getString("worlds." + world + "." + "generator.plugin"); if (gen_string == null) { - new HybridGen(); + generator = new HybridGen(); } else { - IMP.getGenerator(world, gen_string); + generator = (PlotGenerator) IMP.getGenerator(world, gen_string); } + loadWorld(world, generator); } catch (final Exception e) { log("&d=== Oh no! Please set the generator for the " + world + " ==="); e.printStackTrace(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java index 26f7b67b0..efd4f3303 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java @@ -208,6 +208,10 @@ public class HybridGen extends PlotGenerator { } else { world.setSpawnFlags(true, true); + world.setAmbientSpawnLimit(-1); + world.setAnimalSpawnLimit(-1); + world.setMonsterSpawnLimit(-1); + world.setWaterAnimalSpawnLimit(-1); } // You can have as many populators as you would like, e.g. tree // populator, ore populator diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEvents.java index 4dc9a8513..01bdcc690 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEvents.java @@ -3,6 +3,7 @@ package com.intellectualcrafters.plot.listeners; import org.bukkit.World; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.generator.ChunkGenerator; @@ -11,7 +12,7 @@ import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.object.PlotGenerator; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -public class WorldEvents { +public class WorldEvents implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public static void onWorldInit(final WorldInitEvent event) { final World world = event.getWorld(); @@ -19,7 +20,7 @@ public class WorldEvents { if (gen instanceof PlotGenerator) { PlotSquared.loadWorld(world.getName(), (PlotGenerator) gen); } else { - if (PlotSquared.isPlotWorld(world.getName())) { + if (PlotSquared.config.contains("worlds." + world.getName())) { PlotSquared.loadWorld(world.getName(), null); } }