From a015039dadc42b6958c6068800fd25c1ac6acf47 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 13 Mar 2017 18:36:40 +1100 Subject: [PATCH] Fixes #1535 Set `misc_spawn_unowned` --- .../com/plotsquared/bukkit/listeners/EntitySpawnListener.java | 4 +++- .../java/com/intellectualcrafters/plot/object/PlotArea.java | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java index a7ee97166..2dbfaf788 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -24,7 +24,9 @@ public class EntitySpawnListener implements Listener { Plot plot = area.getOwnedPlotAbs(location); if (plot == null) { if (!area.MOB_SPAWNING) { - event.setCancelled(true); + if (event.getEntityType().isAlive() || !area.MISC_SPAWN_UNOWNED) { + event.setCancelled(true); + } } return; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java index 19ce0c29f..c1aba3526 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java @@ -48,6 +48,7 @@ public abstract class PlotArea { public int MAX_PLOT_MEMBERS = 128; public boolean AUTO_MERGE = false; public boolean ALLOW_SIGNS = true; + public boolean MISC_SPAWN_UNOWNED = false; public boolean MOB_SPAWNING = false; public boolean MOB_SPAWNER_SPAWNING = false; public String PLOT_BIOME = "FOREST"; @@ -215,6 +216,7 @@ public abstract class PlotArea { this.TYPE = config.getInt("generator.type"); } this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning"); + this.MISC_SPAWN_UNOWNED = config.getBoolean("misc_spawn_unowned"); this.MOB_SPAWNER_SPAWNING = config.getBoolean("mob_spawner_spawning"); this.AUTO_MERGE = config.getBoolean("plot.auto_merge"); this.MAX_PLOT_MEMBERS = config.getInt("limits.max-members"); @@ -314,6 +316,7 @@ public abstract class PlotArea { public void saveConfiguration(ConfigurationSection config) { HashMap options = new HashMap<>(); options.put("natural_mob_spawning", this.MOB_SPAWNING); + options.put("misc_spawn_unowned", this.MISC_SPAWN_UNOWNED); options.put("mob_spawner_spawning", this.MOB_SPAWNER_SPAWNING); options.put("plot.auto_merge", this.AUTO_MERGE); options.put("plot.create_signs", this.ALLOW_SIGNS);