mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 20:29:20 +00:00
/spawnmob - Only list mobs you have permission to spawn.
This commit is contained in:
parent
3c98718387
commit
f0c0ee1a8d
1 changed files with 15 additions and 2 deletions
|
@ -7,6 +7,7 @@ import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
@ -26,7 +27,19 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList())));
|
Set<String> availableList = Mob.getMobList();
|
||||||
|
for (String mob : availableList)
|
||||||
|
{
|
||||||
|
if (!user.isAuthorized("essentials.spawnmob." + mob.toLowerCase()))
|
||||||
|
{
|
||||||
|
availableList.remove(mob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (availableList.isEmpty())
|
||||||
|
{
|
||||||
|
availableList.add(_("none"));
|
||||||
|
}
|
||||||
|
throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(availableList)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +92,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
User otherUser = null;
|
User otherUser = null;
|
||||||
if (args.length >= 3)
|
if (args.length >= 3)
|
||||||
{
|
{
|
||||||
otherUser = getPlayer(ess.getServer(), args, 2);
|
otherUser = getPlayer(ess.getServer(), args, 2);
|
||||||
}
|
}
|
||||||
final Location loc = (otherUser == null) ? block.getLocation() : otherUser.getLocation();
|
final Location loc = (otherUser == null) ? block.getLocation() : otherUser.getLocation();
|
||||||
final Location sloc = Util.getSafeDestination(loc);
|
final Location sloc = Util.getSafeDestination(loc);
|
||||||
|
|
Loading…
Reference in a new issue