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