geforkt von Mirrors/Paper
aabf676721
Logging into an unloaded world isn't going to end well. This may fix the cases of people seeing errors about regionfiles being closed, as loading chunks in an unloaded world will cause this as the regionfile cache is closed but not cleared.
40 Zeilen
2.4 KiB
Diff
40 Zeilen
2.4 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 92603bc69e7782f252b2ad7b8c8a4546c9b23e12..0d51a518fa8b5d3ef5f6332c2b8f8796d62da658 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -1853,6 +1853,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().spawn.keepSpawnLoadedRange * 16, prevSpawn);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index 566636192c8c5858999c80c31b068aeb5bace1e6..a04ae390f2d054b2ad9fb91eca04955471247b5a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -264,11 +264,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) {
|