geforkt von Mirrors/Velocity
Cache pointers
Dieser Commit ist enthalten in:
Ursprung
56a46d051b
Commit
4003666c27
@ -28,7 +28,6 @@ import net.kyori.adventure.identity.Identified;
|
|||||||
import net.kyori.adventure.identity.Identity;
|
import net.kyori.adventure.identity.Identity;
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
import net.kyori.adventure.key.Keyed;
|
import net.kyori.adventure.key.Keyed;
|
||||||
import net.kyori.adventure.pointer.Pointers;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
import net.kyori.adventure.text.event.HoverEvent;
|
import net.kyori.adventure.text.event.HoverEvent;
|
||||||
@ -284,15 +283,6 @@ public interface Player extends CommandSource, Identified, InboundConnection,
|
|||||||
@Override
|
@Override
|
||||||
boolean sendPluginMessage(ChannelIdentifier identifier, byte[] data);
|
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
|
@Override
|
||||||
default @NotNull Key key() {
|
default @NotNull Key key() {
|
||||||
return Key.key("player");
|
return Key.key("player");
|
||||||
|
@ -94,6 +94,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
import net.kyori.adventure.audience.MessageType;
|
import net.kyori.adventure.audience.MessageType;
|
||||||
import net.kyori.adventure.bossbar.BossBar;
|
import net.kyori.adventure.bossbar.BossBar;
|
||||||
import net.kyori.adventure.identity.Identity;
|
import net.kyori.adventure.identity.Identity;
|
||||||
|
import net.kyori.adventure.pointer.Pointers;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TranslatableComponent;
|
import net.kyori.adventure.text.TranslatableComponent;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
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.MonotonicNonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||||
|
|
||||||
@ -142,6 +144,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
private final Queue<ResourcePackInfo> outstandingResourcePacks = new ArrayDeque<>();
|
private final Queue<ResourcePackInfo> outstandingResourcePacks = new ArrayDeque<>();
|
||||||
private @Nullable ResourcePackInfo pendingResourcePack;
|
private @Nullable ResourcePackInfo pendingResourcePack;
|
||||||
private @Nullable ResourcePackInfo appliedResourcePack;
|
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,
|
ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection,
|
||||||
@Nullable InetSocketAddress virtualHost, boolean onlineMode) {
|
@Nullable InetSocketAddress virtualHost, boolean onlineMode) {
|
||||||
@ -1069,6 +1076,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
return minecraftOrFmlMessage || knownChannels.contains(message.getChannel());
|
return minecraftOrFmlMessage || knownChannels.contains(message.getChannel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Pointers pointers() {
|
||||||
|
return pointers;
|
||||||
|
}
|
||||||
|
|
||||||
private class IdentityImpl implements Identity {
|
private class IdentityImpl implements Identity {
|
||||||
@Override
|
@Override
|
||||||
public @NonNull UUID uuid() {
|
public @NonNull UUID uuid() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren