SimplyPerms/net/crystalyx/bukkit/simplyperms/preventions/Sneak.java
2012-04-29 02:55:03 +02:00

29 lines
737 B
Java

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");
}
}
}
}