SimplyPerms/net/crystalyx/bukkit/simplyperms/preventions/Sneak.java

29 lines
737 B
Java
Raw Normal View History

2012-04-29 00:11:39 +00:00
package net.crystalyx.bukkit.simplyperms.preventions;
import net.crystalyx.bukkit.simplyperms.SimplyPlugin;
import net.crystalyx.bukkit.simplyperms.SimplyPrevents;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerToggleSneakEvent;
public class Sneak extends SimplyPrevents {
public Sneak(SimplyPlugin plugin) {
super(plugin);
}
@EventHandler(priority = EventPriority.LOWEST)
public void sneak(PlayerToggleSneakEvent event) {
Player player = event.getPlayer();
if (event.isSneaking()) {
if (!player.getGameMode().equals(GameMode.CREATIVE)) {
prevent(event, player, "sneak");
}
}
}
2012-04-29 00:55:03 +00:00
2012-04-29 00:11:39 +00:00
}