SPIGOT-7920: Expose enderpearls of Player

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2024-10-23 07:20:07 +11:00
parent d3a23f42c3
commit a24f08778b

View file

@ -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<EnderPearl> getEnderPearls() {
return getHandle().getEnderPearls().stream().map((e) -> (EnderPearl) e.getBukkitEntity()).collect(Collectors.toList());
}
@Override
public Location getBedLocation() {
Preconditions.checkState(isSleeping(), "Not sleeping");