2021-06-11 12:02:28 +00: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-10-02 07:56:36 +00:00
|
|
|
index fc3e5068473e1586024e87fee3eeeb6cf5124923..e18ee5ec984cb8d8aaa8a40714fc9a0381b04317 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2022-09-26 08:02:51 +00:00
|
|
|
@@ -1890,6 +1890,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
2021-06-11 12:02:28 +00: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 14:58:17 +00:00
|
|
|
this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn);
|
2021-06-11 12:02:28 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2022-09-26 08:02:51 +00:00
|
|
|
index 8a5967b5e4196d1df1aacb28ccefadb7863b75a5..55438fc0c789d4ea00653c6b521080460176e4be 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2022-09-01 16:51:59 +00:00
|
|
|
@@ -263,11 +263,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
2021-06-11 12:02:28 +00:00
|
|
|
public boolean setSpawnLocation(int x, int y, int z, float angle) {
|
|
|
|
try {
|
2021-06-14 10:42:08 +00:00
|
|
|
Location previousLocation = this.getSpawnLocation();
|
2021-06-11 12:02:28 +00:00
|
|
|
- world.levelData.setSpawn(new BlockPos(x, y, z), angle);
|
2021-06-17 17:11:00 +00:00
|
|
|
+ world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use WorldServer#setSpawn
|
2021-06-11 12:02:28 +00:00
|
|
|
|
|
|
|
+ // Paper start - move to nms.World
|
|
|
|
// Notify anyone who's listening.
|
|
|
|
- SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
|
2021-06-14 10:42:08 +00:00
|
|
|
- this.server.getPluginManager().callEvent(event);
|
2021-06-11 12:02:28 +00:00
|
|
|
+ // SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
|
|
|
|
+ // server.getPluginManager().callEvent(event);
|
|
|
|
+ // Paper end
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} catch (Exception e) {
|