From a8755ea4968cf2ca7648ca85dc624f120bb68008 Mon Sep 17 00:00:00 2001 From: garbagemule Date: Mon, 8 Dec 2014 19:37:11 +0100 Subject: [PATCH] Add a guard for ridiculous Spigot health issue. --- src/com/garbagemule/MobArena/MASpawnThread.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/garbagemule/MobArena/MASpawnThread.java b/src/com/garbagemule/MobArena/MASpawnThread.java index 8efe99b..d0f5f46 100644 --- a/src/com/garbagemule/MobArena/MASpawnThread.java +++ b/src/com/garbagemule/MobArena/MASpawnThread.java @@ -170,7 +170,14 @@ public class MASpawnThread implements Runnable // Set the health. e.resetMaxHealth(); // Avoid conflicts/enormous multiplications from other plugins handling Mob health int health = (int) Math.max(1D, e.getMaxHealth() * mul); - e.setMaxHealth(health); + try { + e.setMaxHealth(health); + } catch (IllegalArgumentException ex) { + // Spigot... *facepalm* + Messenger.severe("Can't set health to " + health + ", using 2000. If you are running Spigot, set 'maxHealth' higher."); + ex.printStackTrace(); + health = 2000; + } e.setHealth(health); // Switch on the type.