diff --git a/paper-api/src/main/java/org/bukkit/Chunk.java b/paper-api/src/main/java/org/bukkit/Chunk.java index a25f112f4d..20ed1c4043 100644 --- a/paper-api/src/main/java/org/bukkit/Chunk.java +++ b/paper-api/src/main/java/org/bukkit/Chunk.java @@ -6,6 +6,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; import org.bukkit.generator.structure.GeneratedStructure; import org.bukkit.generator.structure.Structure; import org.bukkit.persistence.PersistentDataHolder; @@ -285,6 +286,17 @@ public interface Chunk extends PersistentDataHolder { @NotNull Collection getStructures(@NotNull Structure structure); + /** + * Get a list of all players who are can view the chunk from their client + *

+ * This list will be empty if no players are viewing the chunk, or the chunk + * is unloaded. + * + * @return collection of players who can see the chunk + */ + @NotNull + public Collection getPlayersSeeingChunk(); + /** * An enum to specify the load level of a chunk. */ diff --git a/paper-api/src/main/java/org/bukkit/World.java b/paper-api/src/main/java/org/bukkit/World.java index a1f398fa4c..e82e4d49d5 100644 --- a/paper-api/src/main/java/org/bukkit/World.java +++ b/paper-api/src/main/java/org/bukkit/World.java @@ -314,6 +314,33 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Deprecated public boolean refreshChunk(int x, int z); + /** + * Get a list of all players who are can view the specified chunk from their + * client + *

+ * This list will be empty if no players are viewing the chunk, or the chunk + * is unloaded. + * + * @param chunk the chunk to check + * @return collection of players who can see the chunk + */ + @NotNull + public Collection getPlayersSeeingChunk(@NotNull Chunk chunk); + + /** + * Get a list of all players who are can view the specified chunk from their + * client + *

+ * This list will be empty if no players are viewing the chunk, or the chunk + * is unloaded. + * + * @param x X-coordinate of the chunk + * @param z Z-coordinate of the chunk + * @return collection of players who can see the chunk + */ + @NotNull + public Collection getPlayersSeeingChunk(int x, int z); + /** * Gets whether the chunk at the specified chunk coordinates is force * loaded.