diff options
author | Nassim Jahnke <[email protected]> | 2024-12-03 21:24:17 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-12-03 21:24:17 +0100 |
commit | d7d2f88893ce4c10d5e77c606b06173463c8613d (patch) | |
tree | c1bb9633652384c18cb4948795b1338e69c2b21f /patches/server/1037-API-for-checking-sent-chunks.patch | |
parent | dc74c6f19e0f47926cd9998a5153b8ef6708e717 (diff) | |
download | Paper-d7d2f88893ce4c10d5e77c606b06173463c8613d.tar.gz Paper-d7d2f88893ce4c10d5e77c606b06173463c8613d.zip |
Apply remaining patches, fix API
Diffstat (limited to 'patches/server/1037-API-for-checking-sent-chunks.patch')
-rw-r--r-- | patches/server/1037-API-for-checking-sent-chunks.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/patches/server/1037-API-for-checking-sent-chunks.patch b/patches/server/1037-API-for-checking-sent-chunks.patch new file mode 100644 index 0000000000..67f4f99ba6 --- /dev/null +++ b/patches/server/1037-API-for-checking-sent-chunks.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Flo0 <[email protected]> +Date: Mon, 8 Apr 2024 16:43:16 +0200 +Subject: [PATCH] API for checking sent chunks + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 79d72a2f6cd85f18c644bd48801fdda86f9d235a..84c494ca81b8f58604b372ac7236147776817a4f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -3485,6 +3485,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + // Paper end + ++ // Paper start - Add chunk view API ++ @Override ++ public Set<java.lang.Long> getSentChunkKeys() { ++ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks"); ++ return it.unimi.dsi.fastutil.longs.LongSets.unmodifiable( ++ this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().clone() ++ ); ++ } ++ ++ @Override ++ public Set<org.bukkit.Chunk> getSentChunks() { ++ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks"); ++ final it.unimi.dsi.fastutil.longs.LongOpenHashSet rawChunkKeys = this.getHandle().moonrise$getChunkLoader().getSentChunksRaw(); ++ final it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<org.bukkit.Chunk> chunks = new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(rawChunkKeys.size()); ++ final org.bukkit.World world = this.getWorld(); ++ ++ final it.unimi.dsi.fastutil.longs.LongIterator iter = this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().longIterator(); ++ while (iter.hasNext()) chunks.add(world.getChunkAt(iter.nextLong(), false)); ++ ++ return it.unimi.dsi.fastutil.objects.ObjectSets.unmodifiable(chunks); ++ } ++ ++ @Override ++ public boolean isChunkSent(final long chunkKey) { ++ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks"); ++ return this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().contains(chunkKey); ++ } ++ // Paper end ++ + public Player.Spigot spigot() + { + return this.spigot; |