Improve it more

This commit is contained in:
Telesphoreo 2022-04-08 16:37:13 -05:00
parent e402cd1fe5
commit 3039125b48

View File

@ -126,11 +126,22 @@ public class WorldListener extends PlexListener
public void onWorldTeleport(PlayerTeleportEvent e) public void onWorldTeleport(PlayerTeleportEvent e)
{ {
final World adminworld = Bukkit.getWorld("adminworld"); final World adminworld = Bukkit.getWorld("adminworld");
if (adminworld == null)
{
return;
}
PlexPlayer plexPlayer = DataUtils.getPlayer(e.getPlayer().getUniqueId()); PlexPlayer plexPlayer = DataUtils.getPlayer(e.getPlayer().getUniqueId());
if (e.getTo().getWorld().equals(adminworld) && !plexPlayer.isAdminActive()) if (e.getTo().getWorld().equals(adminworld))
{
if (plugin.getSystem().equals("ranks") && !plexPlayer.isAdminActive())
{ {
e.setCancelled(true); e.setCancelled(true);
} }
else if (plugin.getSystem().equals("permissions") && !e.getPlayer().hasPermission("plex.enter.adminworld"))
{
e.setCancelled(true);
}
}
} }
private boolean checkLevel(PlexPlayer player, String[] requiredList) private boolean checkLevel(PlexPlayer player, String[] requiredList)