Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-23 06:40:07 +01:00
47 Zeilen
2.7 KiB
Diff
47 Zeilen
2.7 KiB
Diff
|
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
|
||
|
index 61aee2c109614a014149ae5a15ad2a28c796cb9d..22266fda4de9b5fbace3b8e55ce390b8d7e75a65 100644
|
||
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||
|
@@ -1981,12 +1981,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||
|
}
|
||
|
// Paper end
|
||
|
|
||
|
+ public final void setSpawn(BlockPos blockposition, float f) { this.setDefaultSpawnPos(blockposition, f); } // Paper - OBFHELPER
|
||
|
public void setDefaultSpawnPos(BlockPos pos, float angle) {
|
||
|
// Paper - configurable spawn radius
|
||
|
BlockPos prevSpawn = this.getSpawn();
|
||
|
//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 793b1309528671ce822d5a484ff9e40d6eba4e9d..37513a1774f5a6611338c1b90018b974238ddbf6 100644
|
||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||
|
@@ -371,11 +371,13 @@ public class CraftWorld implements World {
|
||
|
public boolean setSpawnLocation(int x, int y, int z, float angle) {
|
||
|
try {
|
||
|
Location previousLocation = getSpawnLocation();
|
||
|
- world.levelData.setSpawn(new BlockPos(x, y, z), angle);
|
||
|
+ world.setSpawn(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);
|
||
|
- server.getPluginManager().callEvent(event);
|
||
|
+ // SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
|
||
|
+ // server.getPluginManager().callEvent(event);
|
||
|
+ // Paper end
|
||
|
|
||
|
return true;
|
||
|
} catch (Exception e) {
|