From 87426bf63347832b693525b1fba5aa50e06f2b7e Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 16 Sep 2011 15:04:11 -0700 Subject: [PATCH] implementation of PlayerGameModeChangeEvent call By: sunkid --- .../java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 5fe614fc0b..058070be0f 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/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())); }