mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
implementation of PlayerGameModeChangeEvent call
By: sunkid <sunkid@iminurnetz.com>
This commit is contained in:
parent
f0abf7a025
commit
87426bf633
1 changed files with 7 additions and 0 deletions
|
@ -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()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue