diff --git a/Spigot-API-Patches/Add-PlayerInitialSpawnEvent.patch b/Spigot-API-Patches/Add-PlayerInitialSpawnEvent.patch index 147127bef..0c4b1f47c 100644 --- a/Spigot-API-Patches/Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-API-Patches/Add-PlayerInitialSpawnEvent.patch @@ -7,7 +7,7 @@ For modifying a player's initial spawn location as they join the server diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java new file mode 100644 -index 000000000..8e407eff1 +index 00000000..8b1fdb9d --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java @@ -0,0 +0,0 @@ @@ -15,47 +15,16 @@ index 000000000..8e407eff1 + +import org.bukkit.Location; +import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; +import org.jetbrains.annotations.NotNull; ++import org.spigotmc.event.player.PlayerSpawnLocationEvent; + -+public class PlayerInitialSpawnEvent extends PlayerEvent { -+ private static final HandlerList handlers = new HandlerList(); -+ @NotNull private Location spawnLocation; ++/** ++ * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API ++ */ ++public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent { + -+ public PlayerInitialSpawnEvent(@NotNull final Player player, @NotNull final Location spawnLocation) { -+ super(player); -+ this.spawnLocation = spawnLocation; -+ } -+ -+ /** -+ * Gets the current spawn location -+ * -+ * @return Location current spawn location -+ */ -+ @NotNull -+ public Location getSpawnLocation() { -+ return this.spawnLocation; -+ } -+ -+ /** -+ * Sets the new spawn location -+ * -+ * @param spawnLocation new location for the spawn -+ */ -+ public void setSpawnLocation(@NotNull Location spawnLocation) { -+ this.spawnLocation = spawnLocation; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return handlers; ++ public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) { ++ super(who, spawnLocation); + } +} -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch b/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch index 49234c022..8d10cf22c 100644 --- a/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch @@ -5,30 +5,28 @@ 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/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 1652a57e25..948a6e3b7a 100644 +index f28be11ee..541e3ce83 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - } - // CraftBukkit end -- entityplayer.spawnIn(worldserver); -+ // Paper start - support PlayerInitialSpawnEvent -+ Location originalLoc = new Location(entityplayer.world.getWorld(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.yaw, entityplayer.pitch); -+ com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent event = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(entityplayer.getBukkitEntity(), originalLoc); -+ this.server.server.getPluginManager().callEvent(event); -+ -+ Location newLoc = event.getSpawnLocation(); -+ entityplayer.world = ((CraftWorld) newLoc.getWorld()).getHandle(); -+ entityplayer.setPositionRaw(newLoc.getX(), newLoc.getY(), newLoc.getZ()); -+ entityplayer.yaw = newLoc.getYaw(); -+ entityplayer.pitch = newLoc.getPitch(); -+ entityplayer.dimension = ((CraftWorld) newLoc.getWorld()).getHandle().worldProvider.getDimensionManager(); -+ // Paper end -+ -+ entityplayer.spawnIn(((CraftWorld) newLoc.getWorld()).getHandle()); - entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); - String s1 = "local"; + // 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(); + + 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 -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Broadcast-join-message-to-console.patch b/Spigot-Server-Patches/Broadcast-join-message-to-console.patch index 311762497..45f58af6d 100644 --- a/Spigot-Server-Patches/Broadcast-join-message-to-console.patch +++ b/Spigot-Server-Patches/Broadcast-join-message-to-console.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Broadcast join message to console diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0e1703c9d..72ca7f706 100644 +index 160476fa2..7403be0b2 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { diff --git a/Spigot-Server-Patches/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/Spigot-Server-Patches/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 9e2660398..19323683f 100644 --- a/Spigot-Server-Patches/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/Spigot-Server-Patches/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 89d34716fe..4b3083499b 100644 +index f71c9f4a8..e9908cd01 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { diff --git a/Spigot-Server-Patches/Configurable-Player-Collision.patch b/Spigot-Server-Patches/Configurable-Player-Collision.patch index c38e5223c..66a174362 100644 --- a/Spigot-Server-Patches/Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/Configurable-Player-Collision.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable Player Collision diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index d500cd75a9..e4f0db64c0 100644 +index d500cd75a..e4f0db64c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { @@ -19,7 +19,7 @@ index d500cd75a9..e4f0db64c0 100644 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3094f763ba..deffa2ddbd 100644 +index 1d3f1be24..f82be54cc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> { @@ -23,7 +23,7 @@ index 8570e38f42..c97be42dd7 100644 this.e = flag; } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 4d6ac8f85c..89d34716fe 100644 +index e148940ab..f71c9f4a8 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { diff --git a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index aa9a0176d..7b088111d 100644 --- a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -12,7 +12,7 @@ for this on CB at one point but I can't find it. We may need to do this ourselves at some point in the future. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 47f5f8055e..b1d1a3c1f8 100644 +index 47f5f8055..b1d1a3c1f 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -26,7 +26,7 @@ index 47f5f8055e..b1d1a3c1f8 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 505189c82b..669d9a41d6 100644 +index 505189c82..669d9a41d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -48,7 +48,7 @@ index 505189c82b..669d9a41d6 100644 if (((LazyPlayerSet) event.getRecipients()).isLazy()) { for (Object recipient : minecraftServer.getPlayerList().players) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 05ea0ace58..94a24a49cf 100644 +index 9691d84f2..9212501b8 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { diff --git a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch index 91a8a7d3c..e9e74c72f 100644 --- a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 308bc3baf2..002f7e844a 100644 +index 77f1ddc8a..a61815c79 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { diff --git a/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch index 9d27f2b0e..b4a72a1b7 100644 --- a/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch +++ b/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch @@ -30,7 +30,7 @@ will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bdc98d12c6..e41352681a 100644 +index ebb41f788..af2fa93d4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant