3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00
Dieser Commit ist enthalten in:
lexikiq 2021-06-11 23:32:49 -04:00
Ursprung 56a46d051b
Commit 4003666c27
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: AE6C11E94FDBB116
2 geänderte Dateien mit 12 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -28,7 +28,6 @@ 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.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent;
@ -284,15 +283,6 @@ 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::getDisplayName)
.build();
}
@Override
default @NotNull Key key() {
return Key.key("player");

Datei anzeigen

@ -94,6 +94,7 @@ import java.util.concurrent.ThreadLocalRandom;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.bossbar.BossBar;
import net.kyori.adventure.identity.Identity;
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;
@ -105,6 +106,7 @@ 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 {
@ -142,6 +144,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
private final Queue<ResourcePackInfo> outstandingResourcePacks = new ArrayDeque<>();
private @Nullable ResourcePackInfo pendingResourcePack;
private @Nullable ResourcePackInfo appliedResourcePack;
private final @NotNull Pointers pointers = Player.super.pointers().toBuilder()
.withDynamic(Identity.UUID, this::getUniqueId)
.withDynamic(Identity.NAME, this::getUsername)
.withDynamic(Identity.DISPLAY_NAME, this::getDisplayName)
.build();
ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection,
@Nullable InetSocketAddress virtualHost, boolean onlineMode) {
@ -1069,6 +1076,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
return minecraftOrFmlMessage || knownChannels.contains(message.getChannel());
}
@Override
public @NotNull Pointers pointers() {
return pointers;
}
private class IdentityImpl implements Identity {
@Override
public @NonNull UUID uuid() {