possible fix for mob damage

This commit is contained in:
Jesse Boyd 2018-06-21 07:48:45 +10:00
parent da5478f141
commit df6914fb1e
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 4 additions and 1 deletions

View File

@ -2515,7 +2515,7 @@ public class PlayerEvents extends PlotListener implements Listener {
return false; return false;
} }
// player is null // player is null
return !(damager instanceof Arrow && !(victim instanceof Creature)); return (dArea != null && dArea.MOB_DAMAGE) || !(damager instanceof Arrow && !(victim instanceof Creature));
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)

View File

@ -52,6 +52,7 @@ public abstract class PlotArea {
public boolean MISC_SPAWN_UNOWNED = false; public boolean MISC_SPAWN_UNOWNED = false;
public boolean MOB_SPAWNING = false; public boolean MOB_SPAWNING = false;
public boolean MOB_SPAWNER_SPAWNING = false; public boolean MOB_SPAWNER_SPAWNING = false;
public boolean MOB_DAMAGE = false;
public String PLOT_BIOME = "FOREST"; public String PLOT_BIOME = "FOREST";
public boolean PLOT_CHAT = false; public boolean PLOT_CHAT = false;
public boolean SCHEMATIC_CLAIM_SPECIFY = false; public boolean SCHEMATIC_CLAIM_SPECIFY = false;
@ -217,6 +218,7 @@ public abstract class PlotArea {
this.TERRAIN = config.getInt("generator.terrain"); this.TERRAIN = config.getInt("generator.terrain");
this.TYPE = config.getInt("generator.type"); this.TYPE = config.getInt("generator.type");
} }
this.MOB_DAMAGE = config.getBoolean("mob_damage");
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning"); this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
this.MISC_SPAWN_UNOWNED = config.getBoolean("misc_spawn_unowned"); this.MISC_SPAWN_UNOWNED = config.getBoolean("misc_spawn_unowned");
this.MOB_SPAWNER_SPAWNING = config.getBoolean("mob_spawner_spawning"); this.MOB_SPAWNER_SPAWNING = config.getBoolean("mob_spawner_spawning");
@ -326,6 +328,7 @@ public abstract class PlotArea {
*/ */
public void saveConfiguration(ConfigurationSection config) { public void saveConfiguration(ConfigurationSection config) {
HashMap<String, Object> options = new HashMap<>(); HashMap<String, Object> options = new HashMap<>();
options.put("mob_damage", this.MOB_DAMAGE);
options.put("natural_mob_spawning", this.MOB_SPAWNING); options.put("natural_mob_spawning", this.MOB_SPAWNING);
options.put("misc_spawn_unowned", this.MISC_SPAWN_UNOWNED); options.put("misc_spawn_unowned", this.MISC_SPAWN_UNOWNED);
options.put("mob_spawner_spawning", this.MOB_SPAWNER_SPAWNING); options.put("mob_spawner_spawning", this.MOB_SPAWNER_SPAWNING);