Added Sneaking Event

By: Alexander Hesse <azi@MacBook-Pro.local>
This commit is contained in:
Bukkit/Spigot
2011-01-25 19:04:52 +01:00
parent d245d54634
commit b280199e83
5 changed files with 74 additions and 4 deletions

View File

@@ -195,10 +195,17 @@ public abstract class Event {
/**
* Called when a player undergoes an animation, such as arm swinging
*
* @todo: add javadoc see comment
* @see org.bukkit.event.player.PlayerAnimationEvent
*/
PLAYER_ANIMATION (Category.PLAYER),
/**
* Called when a player toggles sneak mode
*
* @todo: add javadoc see comment
*/
PLAYER_TOGGLE_SNEAK (Category.PLAYER),
/**
* Called when a player uses an item
*

View File

@@ -32,9 +32,8 @@ public class PlayerListener implements Listener {
* @param event Relevant event details
*/
public void onPlayerKick(PlayerKickEvent event) {
}
/**
* Called when a player sends a chat message
*
@@ -66,7 +65,7 @@ public class PlayerListener implements Listener {
*/
public void onPlayerTeleport(PlayerMoveEvent event) {
}
/**
* Called when a player respawns
*
@@ -130,4 +129,12 @@ public class PlayerListener implements Listener {
*/
public void onPlayerDropItem(PlayerDropItemEvent event) {
}
/**
* Called when a player toggles sneak mode
*
* @param event Relevant event details
*/
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
}
}

View File

@@ -0,0 +1,39 @@
package org.bukkit.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
/**
*
* @author azi
*/
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{
private boolean cancel = false;
public PlayerToggleSneakEvent(final Type type, final Player player) {
super(type, player);
}
/**
* Gets the cancellation state of this event. A cancelled event will not
* be executed in the server, but will still pass to other plugins
*
* @return true if this event is cancelled
*/
public boolean isCancelled() {
return cancel;
}
/**
* Sets the cancellation state of this event. A cancelled event will not
* be executed in the server, but will still pass to other plugins
*
* @param cancel true if you wish to cancel this event
*/
public void setCancelled(boolean cancel) {
this.cancel = cancel;
}
}