From a24f08778bd3381c2e75d1cb892fd30f6e7beda8 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 23 Oct 2024 07:20:07 +1100 Subject: [PATCH] SPIGOT-7920: Expose enderpearls of Player By: md_5 --- .../java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 1c9ae250b4..a4cfc6a9da 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -34,6 +34,7 @@ import java.util.WeakHashMap; import java.util.concurrent.CompletableFuture; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.stream.Collectors; import javax.annotation.Nullable; import net.minecraft.advancements.AdvancementProgress; import net.minecraft.core.BlockPosition; @@ -172,6 +173,7 @@ import org.bukkit.craftbukkit.util.CraftChatMessage; import org.bukkit.craftbukkit.util.CraftLocation; import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.craftbukkit.util.CraftNamespacedKey; +import org.bukkit.entity.EnderPearl; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -1186,6 +1188,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } + @Override + public Collection getEnderPearls() { + return getHandle().getEnderPearls().stream().map((e) -> (EnderPearl) e.getBukkitEntity()).collect(Collectors.toList()); + } + @Override public Location getBedLocation() { Preconditions.checkState(isSleeping(), "Not sleeping");