Correctly throw exceptions if mob spawn protection is on

This commit is contained in:
snowleo 2011-09-29 23:56:02 +02:00
parent c6e68f72ea
commit f8450e39e3

View File

@ -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; Entity spawnedMob = null;
Mob mob = null; Mob mob = null;
@ -72,6 +67,12 @@ public class Commandspawnmob extends EssentialsCommand
{ {
throw new Exception(Util.i18n("invalidMob")); throw new Exception(Util.i18n("invalidMob"));
} }
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase()))
{
throw new Exception(Util.i18n("unableToSpawnMob"));
}
int[] ignore = int[] ignore =
{ {
8, 9 8, 9
@ -102,6 +103,11 @@ public class Commandspawnmob extends EssentialsCommand
user.sendMessage(Util.i18n("invalidMob")); user.sendMessage(Util.i18n("invalidMob"));
return; return;
} }
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase()))
{
throw new Exception(Util.i18n("unableToSpawnMob"));
}
try try
{ {
spawnedMount = mobMount.spawn(user, server, loc); spawnedMount = mobMount.spawn(user, server, loc);