Paper/Spigot-API-Patches/0146-Add-Force-Loaded-Chunk-API.patch
Aikar 3c62f3723d
Merge branch 'master' into pre/1.13
* master:
  Remove no longer needed tests due to last change
2018-09-09 01:19:34 -04:00

56 lines
1.8 KiB
Diff

From 8f9a7e82248737f63aea6b2b982d000e36a9c192 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Wed, 29 Aug 2018 00:37:30 -0400
Subject: [PATCH] Add Force-Loaded Chunk API
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
index dc847340f..51bc051f7 100644
--- a/src/main/java/org/bukkit/Chunk.java
+++ b/src/main/java/org/bukkit/Chunk.java
@@ -151,4 +151,20 @@ public interface Chunk {
* @return true if slimes are able to spawn in this chunk
*/
boolean isSlimeChunk();
+
+ // Paper start - Force-Loaded Chunk API
+ /**
+ * Checks if the chunk is currently force-loaded
+ *
+ * @return true if the chunk is force-loaded, otherwise false
+ */
+ boolean isForceLoaded();
+
+ /**
+ * Set's whether a chunk is force-loaded or not
+ *
+ * @param force whether or not to force load this chunk
+ */
+ void setForceLoaded(boolean force);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 53764fae6..00b02e36f 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -201,6 +201,16 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @return true if the chunk has been generated, otherwise false
*/
public boolean isChunkGenerated(int x, int z);
+
+ /**
+ * Checks if a chunk is force-loaded.
+ * Note: This will only return true if the chunk is also generated
+ *
+ * @param x X-coordinate of the chunk
+ * @param z Z-coordinate of the chunk
+ * @return true if the chunk is force-loaded. otherwise false
+ */
+ public boolean isChunkForceLoaded(int x, int z);
// Paper end
/**
--
2.18.0