geforkt von Mirrors/Velocity
Move #pointers to Player
It uses fully API methods so it makes sense to me to use it in Player, open to criticism though
Dieser Commit ist enthalten in:
Ursprung
db7e3262a6
Commit
29b409b9f1
@ -28,6 +28,7 @@ import net.kyori.adventure.identity.Identified;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
import net.kyori.adventure.pointer.Pointers;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
@ -285,6 +286,15 @@ public interface Player extends CommandSource, Identified, InboundConnection,
|
||||
@Override
|
||||
boolean sendPluginMessage(ChannelIdentifier identifier, byte[] data);
|
||||
|
||||
@Override
|
||||
default @NotNull Pointers pointers() {
|
||||
return CommandSource.super.pointers().toBuilder()
|
||||
.withDynamic(Identity.UUID, this::getUniqueId)
|
||||
.withDynamic(Identity.NAME, this::getUsername)
|
||||
.withDynamic(Identity.DISPLAY_NAME, this::asComponent)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
default @NotNull Key key() {
|
||||
return Key.key("player");
|
||||
|
@ -95,7 +95,6 @@ import net.kyori.adventure.audience.MessageType;
|
||||
import net.kyori.adventure.bossbar.BossBar;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.permission.PermissionChecker;
|
||||
import net.kyori.adventure.pointer.Pointers;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TranslatableComponent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
@ -108,7 +107,6 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
|
||||
@ -279,15 +277,6 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
return connection.getProtocolVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Pointers pointers() {
|
||||
return Player.super.pointers().toBuilder()
|
||||
.withDynamic(Identity.UUID, this::getUniqueId)
|
||||
.withDynamic(Identity.NAME, this::getUsername)
|
||||
.withDynamic(Identity.DISPLAY_NAME, this::asComponent)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(net.kyori.text.Component component, MessagePosition position) {
|
||||
Preconditions.checkNotNull(component, "component");
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren