1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-09-25 13:49:12 +02:00

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.Mob;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import java.util.Locale;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
@@ -43,6 +44,14 @@ public class Commandspawner extends EssentialsCommand
user.sendMessage(_("invalidMob")); user.sendMessage(_("invalidMob"));
return; 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()); ((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType());
user.sendMessage(_("setSpawner", mob.name)); user.sendMessage(_("setSpawner", mob.name));
} }

View File

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