aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0054-Add-PlayerInitialSpawnEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0054-Add-PlayerInitialSpawnEvent.patch')
-rw-r--r--patches/server/0054-Add-PlayerInitialSpawnEvent.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/patches/server/0054-Add-PlayerInitialSpawnEvent.patch b/patches/server/0054-Add-PlayerInitialSpawnEvent.patch
new file mode 100644
index 0000000000..6afbd430d3
--- /dev/null
+++ b/patches/server/0054-Add-PlayerInitialSpawnEvent.patch
@@ -0,0 +1,38 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Steve Anton <[email protected]>
+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
+
+== AT ==
+public net.minecraft.world.entity.Entity setRot(FF)V
+
+diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
+index 26a0f1ae6fb2acb62648b0cd7996505d107db532..abb769cbbed17a82ee86a6c99e61a375045d9937 100644
+--- a/src/main/java/net/minecraft/server/players/PlayerList.java
++++ b/src/main/java/net/minecraft/server/players/PlayerList.java
+@@ -226,7 +226,7 @@ public abstract class PlayerList {
+
+ // Spigot start - spawn location event
+ Player spawnPlayer = player.getBukkitEntity();
+- org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new org.spigotmc.event.player.PlayerSpawnLocationEvent(spawnPlayer, spawnPlayer.getLocation());
++ org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(spawnPlayer, spawnPlayer.getLocation()); // Paper use our duplicate event
+ this.cserver.getPluginManager().callEvent(ev);
+
+ Location loc = ev.getSpawnLocation();
+@@ -234,7 +234,10 @@ public abstract class PlayerList {
+
+ player.spawnIn(worldserver1);
+ player.gameMode.setLevel((ServerLevel) player.level());
+- player.absMoveTo(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
++ // Paper start - set raw so we aren't fully joined to the world (not added to chunk or world)
++ player.setPosRaw(loc.getX(), loc.getY(), loc.getZ());
++ player.setRot(loc.getYaw(), loc.getPitch());
++ // Paper end - set raw so we aren't fully joined to the world
+ // Spigot end
+
+ // CraftBukkit - Moved message to after join