2021-06-11 12:02:28 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Steve Anton <anxuiz.nx@gmail.com>
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/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
2022-03-01 03:25:13 +00:00
index bfec1beb0af39e2af6be7c6423bf1eaab32e1062..8e331babd8fdeba77aa3707b7e2e08591fa0d546 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
2021-11-23 12:15:10 +00:00
@@ -217,7 +217,7 @@ public abstract class PlayerList {
2021-06-11 12:02:28 +00:00
// Spigot start - spawn location event
2021-06-20 19:25:59 +00:00
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
2021-06-12 00:57:04 +00:00
this.cserver.getPluginManager().callEvent(ev);
2021-06-11 12:02:28 +00:00
Location loc = ev.getSpawnLocation();
2021-11-23 12:15:10 +00:00
@@ -225,7 +225,10 @@ public abstract class PlayerList {
2021-06-11 12:02:28 +00:00
2021-11-23 12:15:10 +00:00
player.spawnIn(worldserver1);
2021-06-11 12:02:28 +00:00
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
// Spigot end
// CraftBukkit - Moved message to after join