Relocate Event again and move logic further down to capture the resulting, potentially changed nextState
This commit is contained in:
parent
c573f3345d
commit
de12ae8724
2 changed files with 15 additions and 15 deletions
|
@ -4,13 +4,13 @@ Date: Wed, 8 Nov 2023 09:23:23 -0600
|
|||
Subject: [PATCH] ChunkStatusChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/ChunkStatusChangeEvent.java b/src/main/java/io/papermc/paper/chunk/ChunkStatusChangeEvent.java
|
||||
diff --git a/src/main/java/io/papermc/paper/event/chunk/ChunkStatusChangeEvent.java b/src/main/java/io/papermc/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7d446b6219f425aabdb6a7fbb587f89e8a0f23d8
|
||||
index 0000000000000000000000000000000000000000..5743964f329a7c52c48c35f05f398a3d0c4a1da0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/ChunkStatusChangeEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
@@ -0,0 +1,59 @@
|
||||
+package io.papermc.paper.chunk;
|
||||
+package io.papermc.paper.event.chunk;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
+import org.bukkit.event.Event;
|
||||
|
|
|
@ -5,20 +5,20 @@ Subject: [PATCH] ChunkStatusChangeEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
index b66a7d4aab887309579154815a0d4abf9de506b0..c86064ad87a9ce884a2c8b2847fb81a9c753a507 100644
|
||||
index b66a7d4aab887309579154815a0d4abf9de506b0..1445ab96d8ce498bb35d01eb37a542dad6715898 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
@@ -1324,6 +1324,13 @@ public final class NewChunkHolder {
|
||||
// chunks cannot downgrade state while status is pending a change
|
||||
final LevelChunk chunk = (LevelChunk)this.currentChunk;
|
||||
@@ -1375,6 +1375,13 @@ public final class NewChunkHolder {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ new io.papermc.paper.chunk.ChunkStatusChangeEvent(new org.bukkit.craftbukkit.CraftChunk(chunk),
|
||||
+ io.papermc.paper.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(currState.name()),
|
||||
+ io.papermc.paper.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(nextState.name()))
|
||||
+ .callEvent();
|
||||
+ new io.papermc.paper.event.chunk.ChunkStatusChangeEvent(new org.bukkit.craftbukkit.CraftChunk(chunk),
|
||||
+ io.papermc.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(currState.name()),
|
||||
+ io.papermc.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(nextState.name()))
|
||||
+ .callEvent();
|
||||
+ // Paper end
|
||||
+
|
||||
// Note: we assume that only load/unload contain plugin logic
|
||||
// plugin logic is anything stupid enough to possibly change the chunk status while it is already
|
||||
// being changed (i.e during load it is possible it will try to set to full ticking)
|
||||
ret = true;
|
||||
}
|
||||
} finally {
|
||||
|
|
Loading…
Reference in a new issue