29 lines
738 B
Java
29 lines
738 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");
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|