mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly Paper Changes: 14513c3c Updated Upstream (Bukkit/CraftBukkit)
This commit is contained in:
@@ -1,128 +0,0 @@
|
||||
From 908db90639dd171e257f91d6e339608f1be3414d Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 12 Jul 2019 02:09:58 -0500
|
||||
Subject: [PATCH] Implement ChunkTooLargeEvent
|
||||
|
||||
---
|
||||
.../pl3x/purpur/event/ChunkTooLargeEvent.java | 109 ++++++++++++++++++
|
||||
1 file changed, 109 insertions(+)
|
||||
create mode 100644 src/main/java/net/pl3x/purpur/event/ChunkTooLargeEvent.java
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/event/ChunkTooLargeEvent.java b/src/main/java/net/pl3x/purpur/event/ChunkTooLargeEvent.java
|
||||
new file mode 100644
|
||||
index 00000000..f9d4a42c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/event/ChunkTooLargeEvent.java
|
||||
@@ -0,0 +1,109 @@
|
||||
+package net.pl3x.purpur.event;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an oversized chunk loads or saves
|
||||
+ */
|
||||
+public class ChunkTooLargeEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final String worldName;
|
||||
+ private final World world;
|
||||
+ private final int chunkX;
|
||||
+ private final int chunkZ;
|
||||
+ private final boolean saving;
|
||||
+ private final boolean overzealous;
|
||||
+
|
||||
+ public ChunkTooLargeEvent(@NotNull String worldName, int chunkX, int chunkZ, boolean saving, boolean overzealous) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.worldName = worldName;
|
||||
+ this.world = Bukkit.getWorld(worldName);
|
||||
+ this.chunkX = chunkX;
|
||||
+ this.chunkZ = chunkZ;
|
||||
+ this.saving = saving;
|
||||
+ this.overzealous = overzealous;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the world name according to the save directory
|
||||
+ *
|
||||
+ * @return World name
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getWorldName() {
|
||||
+ return worldName;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the world
|
||||
+ *
|
||||
+ * @return World, or null if world not loaded
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public World getWorld() {
|
||||
+ return world;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the X chunk coordinate
|
||||
+ *
|
||||
+ * @return X chunk coordinate
|
||||
+ */
|
||||
+ public int getChunkX() {
|
||||
+ return chunkX;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the Z chunk coordinate
|
||||
+ *
|
||||
+ * @return Z chunk coordinate
|
||||
+ */
|
||||
+ public int getChunkZ() {
|
||||
+ return chunkZ;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Whether this happened during a save attempt.
|
||||
+ *
|
||||
+ * @return True if saving, false if loading
|
||||
+ */
|
||||
+ public boolean isSaving() {
|
||||
+ return saving;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If saving, was this is overzealous mode
|
||||
+ *
|
||||
+ * @return True if saving in overzealous mode
|
||||
+ */
|
||||
+ public boolean isOverzealous() {
|
||||
+ return overzealous;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the location
|
||||
+ *
|
||||
+ * @return Location, or null if world not loaded
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getLocation() {
|
||||
+ return world == null ? null : new Location(world, chunkX << 4, 128, chunkZ << 4);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.23.0.rc1
|
||||
|
||||
Reference in New Issue
Block a user