New permissions:

essentials.spawnmob.[mobname] and essentials.spawner.[mobname]
This commit is contained in:
snowleo 2011-11-27 19:59:06 +01:00
parent ec6baa3621
commit 67be976d90
2 changed files with 17 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
@ -43,6 +44,14 @@ public class Commandspawner extends EssentialsCommand
user.sendMessage(_("invalidMob"));
return;
}
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH)))
{
throw new Exception(_("unableToSpawnMob"));
}
if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase()))
{
throw new Exception(_("unableToSpawnMob"));
}
((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType());
user.sendMessage(_("setSpawner", mob.name));
}

View File

@ -66,6 +66,10 @@ public class Commandspawnmob extends EssentialsCommand
{
throw new Exception(_("unableToSpawnMob"));
}
if (!user.isAuthorized("essentials.spawnmob." + mob.name.toLowerCase()))
{
throw new Exception(_("unableToSpawnMob"));
}
final Block block = Util.getTarget(user).getBlock();
if (block == null)
@ -96,6 +100,10 @@ public class Commandspawnmob extends EssentialsCommand
{
throw new Exception(_("unableToSpawnMob"));
}
if (!user.isAuthorized("essentials.spawnmob." + mobMount.name.toLowerCase()))
{
throw new Exception(_("unableToSpawnMob"));
}
try
{
spawnedMount = mobMount.spawn(user, server, loc);