From 3039125b48a7d251888d1c7c9aafb02842b6272e Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Fri, 8 Apr 2022 16:37:13 -0500 Subject: [PATCH] Improve it more --- .../dev/plex/listener/impl/WorldListener.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/plex/listener/impl/WorldListener.java b/src/main/java/dev/plex/listener/impl/WorldListener.java index 83a0930..b2b319e 100644 --- a/src/main/java/dev/plex/listener/impl/WorldListener.java +++ b/src/main/java/dev/plex/listener/impl/WorldListener.java @@ -126,10 +126,21 @@ public class WorldListener extends PlexListener public void onWorldTeleport(PlayerTeleportEvent e) { final World adminworld = Bukkit.getWorld("adminworld"); - PlexPlayer plexPlayer = DataUtils.getPlayer(e.getPlayer().getUniqueId()); - if (e.getTo().getWorld().equals(adminworld) && !plexPlayer.isAdminActive()) + if (adminworld == null) { - e.setCancelled(true); + return; + } + PlexPlayer plexPlayer = DataUtils.getPlayer(e.getPlayer().getUniqueId()); + if (e.getTo().getWorld().equals(adminworld)) + { + if (plugin.getSystem().equals("ranks") && !plexPlayer.isAdminActive()) + { + e.setCancelled(true); + } + else if (plugin.getSystem().equals("permissions") && !e.getPlayer().hasPermission("plex.enter.adminworld")) + { + e.setCancelled(true); + } } }