summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsunkid <sunkid@iminurnetz.com>2011-09-16 15:04:11 -0700
committerErik Broes <erikbroes@grum.nl>2011-09-18 11:19:08 +0200
commitaf6ba0f026bd7b3588a77c246fa2e54785b57d19 (patch)
tree524dcfb7139996ee0ebfcb955465107a5b758d51
parent65052c8a59ecfdf927e5bbfe4257c7a7c90e55e4 (diff)
downloadcraftbukkit-af6ba0f026bd7b3588a77c246fa2e54785b57d19.tar
craftbukkit-af6ba0f026bd7b3588a77c246fa2e54785b57d19.tar.gz
craftbukkit-af6ba0f026bd7b3588a77c246fa2e54785b57d19.tar.lz
craftbukkit-af6ba0f026bd7b3588a77c246fa2e54785b57d19.tar.xz
craftbukkit-af6ba0f026bd7b3588a77c246fa2e54785b57d19.zip
implementation of PlayerGameModeChangeEvent call
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5fe614fc..058070be 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -27,6 +27,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.map.CraftMapView;
import org.bukkit.craftbukkit.map.RenderData;
import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.map.MapView;
@@ -387,6 +388,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
if (mode != getGameMode()) {
+ PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode);
+ server.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+
getHandle().itemInWorldManager.a(mode.getValue());
getHandle().netServerHandler.sendPacket(new Packet70Bed(3, mode.getValue()));
}