Paper/Spigot-Server-Patches/0042-Add-PlayerInitialSpawnEvent.patch

35 Zeilen
1.6 KiB
Diff

From 2f2f30e296173f81723dde1480232744b4e444ef 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
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
index f28be11eee..541e3ce830 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
@@ -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();
2015-12-23 05:06:19 +01:00
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
2019-04-25 08:53:51 +02:00
2015-12-23 05:06:19 +01:00
--
2.26.2
2015-12-23 05:06:19 +01:00