mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 21:19:00 +01:00
Rebase and update
This commit is contained in:
parent
76d2e11207
commit
9b013f7727
74
patches/api/0500-Add-ChunkStatusChangeEvent.patch
Normal file
74
patches/api/0500-Add-ChunkStatusChangeEvent.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 23 Nov 2024 14:46:11 -0600
|
||||
Subject: [PATCH] Add ChunkStatusChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..11a69ae1c8e5163e2d8cb136e7378f6f92fd481e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
@@ -0,0 +1,62 @@
|
||||
+package com.destroystokyo.paper.event.chunk;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the Full Status of a Chunk changes. This cannot be modified; you wouldn't want to if you tried.
|
||||
+ * Chunk Statuses are a dark magic and this event only exposes the changes of status and will probably do nothing else.
|
||||
+ */
|
||||
+public class ChunkStatusChangeEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Chunk chunk;
|
||||
+ private final ChunkStatus currentState;
|
||||
+ private final ChunkStatus newState;
|
||||
+
|
||||
+ public ChunkStatusChangeEvent(@NotNull Chunk chunk, @NotNull ChunkStatus currentState, @NotNull ChunkStatus newState) {
|
||||
+ super();
|
||||
+ this.chunk = chunk;
|
||||
+ this.currentState = currentState;
|
||||
+ this.newState = newState;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Chunk getChunk() {
|
||||
+ return chunk;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ChunkStatus getCurrentState() {
|
||||
+ return currentState;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ChunkStatus getNewState() {
|
||||
+ return newState;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isUpgrade() {
|
||||
+ return newState.ordinal() > currentState.ordinal();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public enum ChunkStatus {
|
||||
+ INACCESSIBLE,
|
||||
+ FULL,
|
||||
+ BLOCK_TICKING,
|
||||
+ ENTITY_TICKING;
|
||||
+ }
|
||||
+}
|
24
patches/server/1070-Add-ChunkStatusChangeEvent.patch
Normal file
24
patches/server/1070-Add-ChunkStatusChangeEvent.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 23 Nov 2024 14:46:11 -0600
|
||||
Subject: [PATCH] Add ChunkStatusChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java
|
||||
index eafa4e6d55cd0f9314ac0f2b96a7f48fbb5e1a4c..271479e4a3b511e15aedf692ad101c463b16790c 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java
|
||||
@@ -1261,6 +1261,13 @@ public final class NewChunkHolder {
|
||||
// note: currentChunk must be LevelChunk, as current != pending which means that at least one is not ACCESSIBLE
|
||||
final LevelChunk chunk = (LevelChunk)this.currentChunk;
|
||||
|
||||
+ // Paper start
|
||||
+ new com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent(new org.bukkit.craftbukkit.CraftChunk(chunk),
|
||||
+ com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(pending.name()),
|
||||
+ com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(current.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)
|
Loading…
Reference in New Issue
Block a user