- Make adminworld check for ranks or permissions

This commit is contained in:
Taah 2022-02-21 16:29:52 -08:00
parent d4578f2255
commit 93fa38d9da

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent;
import static dev.plex.util.PlexUtils.tl; import static dev.plex.util.PlexUtils.tl;
public class WorldListener extends PlexListener public class WorldListener extends PlexListener
@ -22,12 +23,20 @@ public class WorldListener extends PlexListener
World world = player.getWorld(); World world = player.getWorld();
switch (world.getName().toLowerCase()) switch (world.getName().toLowerCase())
{ {
case "adminworld": case "adminworld" -> {
if (plugin.getSystem().equalsIgnoreCase("ranks"))
{ {
if (plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN)) if (plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN))
{ {
return; return;
} }
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (player.hasPermission("plex.adminworld"))
{
return;
}
}
e.setCancelled(true); e.setCancelled(true);
player.sendMessage(tl("noAdminWorldBlockPlace")); player.sendMessage(tl("noAdminWorldBlockPlace"));
break; break;