2020-05-06 11:48:49 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2015-12-23 05:06:19 +01:00
From: Steve Anton <anxuiz.nx@gmail.com>
2016-03-01 00:09:49 +01:00
Date: Thu, 3 Mar 2016 00:09:38 -0600
2015-12-23 05:06:19 +01:00
Subject: [PATCH] Add PlayerInitialSpawnEvent
For modifying a player's initial spawn location as they join the server
2020-04-19 09:11:02 +02:00
This is a duplicate API from spigot, so use our duplicate subclass and
improve setPosition to use raw
2015-12-23 05:06:19 +01:00
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
2021-03-09 00:12:31 +01:00
index d1b26d753774ef89638a1c5130b10f16a6c743d8..c71dea3e51c93cf1ad60b8a76408774d67552de8 100644
2015-12-23 05:06:19 +01:00
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
2021-03-09 00:12:31 +01:00
@@ -140,7 +140,7 @@ public abstract class PlayerList {
2020-04-19 09:11:02 +02:00
// Spigot start - spawn location event
Player bukkitPlayer = entityplayer.getBukkitEntity();
2021-03-09 00:12:31 +01:00
- org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new org.spigotmc.event.player.PlayerSpawnLocationEvent(bukkitPlayer, bukkitPlayer.getLocation());
+ org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(bukkitPlayer, bukkitPlayer.getLocation()); // Paper use our duplicate event
cserver.getPluginManager().callEvent(ev);
2020-04-19 09:11:02 +02:00
Location loc = ev.getSpawnLocation();
2021-03-09 00:12:31 +01:00
@@ -148,7 +148,7 @@ public abstract class PlayerList {
2015-12-23 05:06:19 +01:00
2020-06-27 07:12:11 +02:00
entityplayer.spawnIn(worldserver1);
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
2020-04-19 09:11:02 +02:00
- 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
2019-04-25 08:53:51 +02:00