From 931d790702700262ea2ee4d314c2bff6ce4f7b82 Mon Sep 17 00:00:00 2001 From: Kieran Wallbanks Date: Fri, 12 Mar 2021 15:36:22 +0000 Subject: [PATCH] Make player implement Identified --- src/main/java/net/minestom/server/entity/Player.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/entity/Player.java b/src/main/java/net/minestom/server/entity/Player.java index 1340c6fb0..f36d207d5 100644 --- a/src/main/java/net/minestom/server/entity/Player.java +++ b/src/main/java/net/minestom/server/entity/Player.java @@ -3,6 +3,7 @@ package net.minestom.server.entity; import com.google.common.collect.Queues; import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.bossbar.BossBar; +import net.kyori.adventure.identity.Identified; import net.kyori.adventure.identity.Identity; import net.kyori.adventure.inventory.Book; import net.kyori.adventure.sound.SoundStop; @@ -72,6 +73,7 @@ import net.minestom.server.utils.time.TimeUnit; import net.minestom.server.utils.time.UpdateOption; import net.minestom.server.utils.validate.Check; import net.minestom.server.world.DimensionType; +import org.checkerframework.checker.nullness.qual.NonNull; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -88,7 +90,7 @@ import java.util.function.UnaryOperator; *

* You can easily create your own implementation of this and use it with {@link ConnectionManager#setPlayerProvider(PlayerProvider)}. */ -public class Player extends LivingEntity implements CommandSender, Localizable, HoverEventSource { +public class Player extends LivingEntity implements CommandSender, Localizable, HoverEventSource, Identified { private long lastKeepAlive; private boolean answerKeepAlive; @@ -2697,6 +2699,11 @@ public class Player extends LivingEntity implements CommandSender, Localizable, settings.locale = locale == null ? null : locale.toLanguageTag(); } + @Override + public @NonNull Identity identity() { + return Identity.identity(this.uuid); + } + /** * Represents the main or off hand of the player. */