From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Steve Anton Date: Thu, 3 Mar 2016 00:09:38 -0600 Subject: [PATCH] Add PlayerInitialSpawnEvent For modifying a player's initial spawn location as they join the server This is a duplicate API from spigot, so use our duplicate subclass and improve setPosition to use raw diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index c759dd0f9a66dc2fa30746132564a0981037f265..6f11111f413914856e6a3622512f00f8a49cdfa2 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -119,14 +119,14 @@ public abstract class PlayerList { // Spigot start - spawn location event Player bukkitPlayer = entityplayer.getBukkitEntity(); - PlayerSpawnLocationEvent ev = new PlayerSpawnLocationEvent(bukkitPlayer, bukkitPlayer.getLocation()); + PlayerSpawnLocationEvent ev = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(bukkitPlayer, bukkitPlayer.getLocation()); // Paper use our duplicate event Bukkit.getPluginManager().callEvent(ev); Location loc = ev.getSpawnLocation(); worldserver = ((CraftWorld) loc.getWorld()).getHandle(); entityplayer.spawnIn(worldserver); - entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ()); + entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world) entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); // Spigot end