diff options
author | H31IX <effectsdude@gmail.com> | 2012-05-22 16:04:36 -0400 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-06-13 22:19:51 -0500 |
commit | ef1748ef6823ddc036bbaa64013ec70e7145a63a (patch) | |
tree | 03f32a5d70f8ed77909d9c356dc1ddefea0d1ae7 /src/main/java/org | |
parent | c389d321685df198688e712ae05f420b809e8164 (diff) | |
download | bukkit-ef1748ef6823ddc036bbaa64013ec70e7145a63a.tar bukkit-ef1748ef6823ddc036bbaa64013ec70e7145a63a.tar.gz bukkit-ef1748ef6823ddc036bbaa64013ec70e7145a63a.tar.lz bukkit-ef1748ef6823ddc036bbaa64013ec70e7145a63a.tar.xz bukkit-ef1748ef6823ddc036bbaa64013ec70e7145a63a.zip |
Add PlayerToggleFlightEvent. Fixes BUKKIT-1696
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/event/player/PlayerToggleFlightEvent.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/player/PlayerToggleFlightEvent.java b/src/main/java/org/bukkit/event/player/PlayerToggleFlightEvent.java new file mode 100644 index 00000000..1c5ec37e --- /dev/null +++ b/src/main/java/org/bukkit/event/player/PlayerToggleFlightEvent.java @@ -0,0 +1,45 @@ +package org.bukkit.event.player; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +/** + * Called when a player toggles their flying state + */ +public class PlayerToggleFlightEvent extends PlayerEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private final boolean isFlying; + private boolean cancel = false; + + public PlayerToggleFlightEvent(final Player player, final boolean isFlying) { + super(player); + this.isFlying = isFlying; + } + + /** + * Returns whether the player is trying to start or stop flying. + * + * @return flying state + */ + public boolean isFlying() { + return isFlying; + } + + public boolean isCancelled() { + return cancel; + } + + public void setCancelled(boolean cancel) { + this.cancel = cancel; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} |