2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
|
|
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
|
2022-12-19 11:46:55 +01:00
|
|
|
index 95c53189e32aec6aca254fa3b157df7bc68d4d1a..0637fd424e98175f864f15c8bfa8bf696ed47fe7 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2022-12-19 11:46:55 +01:00
|
|
|
@@ -1866,6 +1866,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
2021-06-11 14:02:28 +02:00
|
|
|
//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
|
2022-06-11 16:58:17 +02:00
|
|
|
this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn);
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2023-02-13 18:52:27 +01:00
|
|
|
index a25dbc2bd3005cb3d1aee61fb48522b13e7c4922..b3c28849841a0dd661ce81235914670ce6cbbfef 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2022-12-07 21:16:54 +01:00
|
|
|
@@ -262,11 +262,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
2021-06-11 14:02:28 +02:00
|
|
|
public boolean setSpawnLocation(int x, int y, int z, float angle) {
|
|
|
|
try {
|
2021-06-14 12:42:08 +02:00
|
|
|
Location previousLocation = this.getSpawnLocation();
|
2021-06-11 14:02:28 +02:00
|
|
|
- world.levelData.setSpawn(new BlockPos(x, y, z), angle);
|
2021-06-17 19:11:00 +02:00
|
|
|
+ world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use WorldServer#setSpawn
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
+ // Paper start - move to nms.World
|
|
|
|
// Notify anyone who's listening.
|
|
|
|
- SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
|
2021-06-14 12:42:08 +02:00
|
|
|
- this.server.getPluginManager().callEvent(event);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
|
|
|
|
+ // server.getPluginManager().callEvent(event);
|
|
|
|
+ // Paper end
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} catch (Exception e) {
|