SPIGOT-3157: Use Vanilla gamemode change code

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2017-03-31 21:21:11 +11:00
parent fbcf1da3b9
commit c37f72b58c
2 changed files with 43 additions and 50 deletions

View File

@@ -785,18 +785,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new IllegalArgumentException("Mode cannot be null");
}
if (mode != getGameMode()) {
PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
getHandle().setSpectatorTarget(getHandle());
getHandle().playerInteractManager.setGameMode(EnumGamemode.getById(mode.getValue()));
getHandle().fallDistance = 0;
getHandle().playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, mode.getValue()));
}
getHandle().a(EnumGamemode.getById(mode.getValue()));
}
@Override