0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 20:56:14 +00:00
spigot/CraftBukkit-Patches/0048-Implement-PlayerSpawnLocationEvent.patch
2024-10-23 02:15:00 +11:00

34 lines
1.7 KiB
Diff

From 8e6c4d6d5fc89cb179d78484f7110af587e397c7 Mon Sep 17 00:00:00 2001
From: ninja <xninja@openmailbox.org>
Date: Tue, 8 Apr 2014 14:05:19 +0200
Subject: [PATCH] Implement PlayerSpawnLocationEvent.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3da6f2cb53..61fa728269 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -224,6 +224,19 @@ public abstract class PlayerList {
entityplayer.setServerLevel(worldserver1);
String s1 = networkmanager.getLoggableAddress(this.server.logIPs());
+ // Spigot start - spawn location event
+ Player spawnPlayer = entityplayer.getBukkitEntity();
+ org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new org.spigotmc.event.player.PlayerSpawnLocationEvent(spawnPlayer, spawnPlayer.getLocation());
+ cserver.getPluginManager().callEvent(ev);
+
+ Location loc = ev.getSpawnLocation();
+ worldserver1 = ((CraftWorld) loc.getWorld()).getHandle();
+
+ entityplayer.spawnIn(worldserver1);
+ entityplayer.gameMode.setLevel((WorldServer) entityplayer.level());
+ entityplayer.absMoveTo(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
+ // Spigot end
+
// CraftBukkit - Moved message to after join
// PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", new Object[]{entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ()});
WorldData worlddata = worldserver1.getLevelData();
--
2.47.0