From f8450e39e31e9c90e28d96ee4de4275554537059 Mon Sep 17 00:00:00 2001 From: snowleo Date: Thu, 29 Sep 2011 23:56:02 +0200 Subject: Correctly throw exceptions if mob spawn protection is on --- .../earth2me/essentials/commands/Commandspawnmob.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index f46264582..97bcb9c8e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -56,11 +56,6 @@ public class Commandspawnmob extends EssentialsCommand } } - if (ess.getSettings().getProtectPreventSpawn(mobType.toLowerCase()) - || (mountType != null && ess.getSettings().getProtectPreventSpawn(mountType.toLowerCase()))) - { - throw new Exception(Util.i18n("unableToSpawnMob")); - } Entity spawnedMob = null; Mob mob = null; @@ -72,6 +67,12 @@ public class Commandspawnmob extends EssentialsCommand { throw new Exception(Util.i18n("invalidMob")); } + + if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase())) + { + throw new Exception(Util.i18n("unableToSpawnMob")); + } + int[] ignore = { 8, 9 @@ -102,6 +103,11 @@ public class Commandspawnmob extends EssentialsCommand user.sendMessage(Util.i18n("invalidMob")); return; } + + if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase())) + { + throw new Exception(Util.i18n("unableToSpawnMob")); + } try { spawnedMount = mobMount.spawn(user, server, loc); -- cgit v1.2.3