diff options
author | H31IX <effectsdude@gmail.com> | 2012-05-25 17:38:03 -0400 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-06-13 22:21:35 -0500 |
commit | 01fe76733f869c4f2ff6681003e31960955a39ca (patch) | |
tree | d7d55739e2fadb5875704bf5742ab0a423920ad8 /src/main/java/net/minecraft/server | |
parent | 478654351a0c16d62bb849fb87094dc692e96466 (diff) | |
download | craftbukkit-01fe76733f869c4f2ff6681003e31960955a39ca.tar craftbukkit-01fe76733f869c4f2ff6681003e31960955a39ca.tar.gz craftbukkit-01fe76733f869c4f2ff6681003e31960955a39ca.tar.lz craftbukkit-01fe76733f869c4f2ff6681003e31960955a39ca.tar.xz craftbukkit-01fe76733f869c4f2ff6681003e31960955a39ca.zip |
Fire PlayerToggleFlightEvent. Fixes BUKKIT-1696
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 9d002fb8..157a6aad 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -42,6 +42,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.inventory.*; import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryView; @@ -1292,7 +1293,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void a(Packet202Abilities packet202abilities) { - this.player.abilities.isFlying = packet202abilities.b && this.player.abilities.canFly; + // CraftBukkit start + if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.b) { + PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.b); + this.server.getPluginManager().callEvent(event); + if (!event.isCancelled()) { + this.player.abilities.isFlying = packet202abilities.b; // Actually set the player's flying status + } + else { + this.player.updateAbilities(); // Tell the player their ability was reverted + } + } + // CraftBukkit end } // CraftBukkit start |