From 3dbaf061ed947666e30b282647bd62faf11228f1 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 21 Feb 2012 21:25:39 -0800 Subject: [PATCH] Added checks on world change for mcgod --- .../nossr50/listeners/mcPlayerListener.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index 6422fe64c..cef67b270 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -34,6 +34,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerFishEvent; @@ -78,6 +79,22 @@ public class mcPlayerListener implements Listener plugin = instance; } + @EventHandler + public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) + { + Player player = event.getPlayer(); + PlayerProfile PP = Users.getProfile(player); + + if(PP.getGodMode()) + { + if(!mcPermissions.getInstance().mcgod(player)) + { + PP.toggleGodMode(); + player.sendMessage("[mcMMO] God Mode not permitted on this world (See Permissions)"); + } + } + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onSheepUndressing(PlayerShearEntityEvent event) {