Paper/patches/unapplied/server/0050-Add-PlayerInitialSpawnEvent.patch

39 Zeilen
2.0 KiB
Diff

2021-06-11 14:02:28 +02: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
== AT ==
public net.minecraft.world.entity.Entity setRot(FF)V
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
2023-09-21 19:39:51 +02:00
index b40ddd8fb3e2d2bafaa2ece46714815d0d6d5f75..9e835d63e1592fc064b73c51eecd8b84cbedfa33 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
2023-06-07 20:31:32 +02:00
@@ -240,7 +240,7 @@ public abstract class PlayerList {
2021-06-11 14:02:28 +02:00
// 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
2021-06-12 02:57:04 +02:00
this.cserver.getPluginManager().callEvent(ev);
2021-06-11 14:02:28 +02:00
Location loc = ev.getSpawnLocation();
2023-06-07 20:31:32 +02:00
@@ -248,7 +248,10 @@ public abstract class PlayerList {
2021-06-11 14:02:28 +02:00
2021-11-23 13:15:10 +01:00
player.spawnIn(worldserver1);
2023-06-07 20:31:32 +02:00
player.gameMode.setLevel((ServerLevel) player.level());
2021-06-11 14:02:28 +02:00
- 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