diff options
Diffstat (limited to 'patches/server/0490-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch')
-rw-r--r-- | patches/server/0490-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/patches/server/0490-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0490-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch new file mode 100644 index 0000000000..24c50ccb97 --- /dev/null +++ b/patches/server/0490-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath <[email protected]> +Date: Sat, 22 Aug 2020 23:36:21 +0200 +Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases + + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index be26327d31a3117cb7a5bf752c49c204738bc91e..230ee6dd71e55921960a81d7b3aedbc804f785e5 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -1743,6 +1743,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); + + this.levelData.setSpawn(pos, angle); ++ new org.bukkit.event.world.SpawnChangeEvent(getWorld(), MCUtil.toLocation(this, prevSpawn)).callEvent(); // Paper + if (this.keepSpawnInMemory) { + // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add + this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index b08bca3111a70edd329aac26b6f2763925081b60..81756e78acb1b9ea2a7e9b75ffe55a936cc79dce 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -247,11 +247,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { + public boolean setSpawnLocation(int x, int y, int z, float angle) { + try { + Location previousLocation = this.getSpawnLocation(); +- world.levelData.setSpawn(new BlockPos(x, y, z), angle); ++ world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use WorldServer#setSpawn + ++ // Paper start - move to nms.World + // Notify anyone who's listening. +- SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); +- this.server.getPluginManager().callEvent(event); ++ // SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); ++ // server.getPluginManager().callEvent(event); ++ // Paper end + + return true; + } catch (Exception e) { |