Added checks on world change for mcgod

This commit is contained in:
nossr50 2012-02-21 21:25:39 -08:00
parent 19ac0e6ba6
commit 3dbaf061ed

View File

@ -34,6 +34,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent;
@ -78,6 +79,22 @@ public class mcPlayerListener implements Listener
plugin = instance; 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) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSheepUndressing(PlayerShearEntityEvent event) public void onSheepUndressing(PlayerShearEntityEvent event)
{ {