From cbee52aa61456525a0e48e24f746f1afca4da5f8 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 18 Jun 2021 16:18:15 -0400 Subject: [PATCH] Further API tweaks --- .../registry/ProtocolVersionRegistry.java | 10 ++++ .../api/proxy/ProxyServer.java | 11 +++++ .../api/proxy/connection/Player.java | 42 +--------------- .../api/proxy/player/PlatformActions.java | 49 ++++++++++++++++++- .../api/proxy/player/{ => java}/TabList.java | 5 +- .../proxy/player/{ => java}/TabListEntry.java | 5 +- .../proxy/util/DurationUtils.java | 0 .../proxy/util/FileSystemUtils.java | 0 .../proxy/util/collect/CappedSet.java | 0 .../proxy/util/collect/Enum2IntMap.java | 0 .../proxy/util/concurrent/Once.java | 0 proxy/build.gradle | 10 +++- .../command/builtin/VelocityCommand.java | 1 - .../proxy/config/VelocityConfiguration.java | 1 - .../ClientboundAvailableCommandsPacket.java | 11 ++--- .../ClientboundPlayerListItemPacket.java | 2 +- .../clientbound/ClientboundTitlePacket.java | 1 - .../proxy/tablist/VelocityTabList.java | 4 +- .../proxy/tablist/VelocityTabListEntry.java | 4 +- .../tablist/VelocityTabListEntryLegacy.java | 2 +- .../proxy/tablist/VelocityTabListLegacy.java | 2 +- .../util/collect/IdentityHashStrategy.java | 41 ---------------- 22 files changed, 95 insertions(+), 106 deletions(-) rename api/src/main/java/com/velocitypowered/api/proxy/player/{ => java}/TabList.java (92%) rename api/src/main/java/com/velocitypowered/api/proxy/player/{ => java}/TabListEntry.java (97%) rename {proxy => proxy-core}/src/main/java/com/velocitypowered/proxy/util/DurationUtils.java (100%) rename {proxy => proxy-core}/src/main/java/com/velocitypowered/proxy/util/FileSystemUtils.java (100%) rename {proxy => proxy-core}/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java (100%) rename {proxy => proxy-core}/src/main/java/com/velocitypowered/proxy/util/collect/Enum2IntMap.java (100%) rename {proxy => proxy-core}/src/main/java/com/velocitypowered/proxy/util/concurrent/Once.java (100%) delete mode 100644 proxy/src/main/java/com/velocitypowered/proxy/util/collect/IdentityHashStrategy.java diff --git a/api/src/main/java/com/velocitypowered/api/network/registry/ProtocolVersionRegistry.java b/api/src/main/java/com/velocitypowered/api/network/registry/ProtocolVersionRegistry.java index 7d3b6edf9..d51b5921f 100644 --- a/api/src/main/java/com/velocitypowered/api/network/registry/ProtocolVersionRegistry.java +++ b/api/src/main/java/com/velocitypowered/api/network/registry/ProtocolVersionRegistry.java @@ -8,8 +8,18 @@ package com.velocitypowered.api.network.registry; import com.velocitypowered.api.network.PlatformVersion; +import java.util.Collection; import org.checkerframework.checker.nullness.qual.Nullable; public interface ProtocolVersionRegistry { + /** + * Returns a collection of supported protocol versions for the given {@code platform}. The + * collection is expected to be ordered and immutable. + * + * @param platform the platform to look up the versions for + * @return an ordered, immutable collection of supported protocol versions + */ + Collection supported(Platform platform); + @Nullable PlatformVersion lookup(Platform platform, int version); } diff --git a/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java b/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java index 38490200e..760f370c2 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java @@ -16,6 +16,7 @@ import com.velocitypowered.api.plugin.PluginManager; import com.velocitypowered.api.proxy.config.ProxyConfig; import com.velocitypowered.api.proxy.connection.Player; import com.velocitypowered.api.proxy.messages.ChannelRegistrar; +import com.velocitypowered.api.proxy.player.PlayerIdentity; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.scheduler.Scheduler; @@ -60,6 +61,16 @@ public interface ProxyServer extends Audience { */ @Nullable Player player(UUID uuid); + /** + * Retrieves the player currently connected to this proxy by their identity. + * + * @param identity the identity + * @return the player instance, if connected, else {@code null} + */ + @Nullable default Player player(PlayerIdentity identity) { + return player(identity.uuid()); + } + /** * Retrieves all players currently connected to this proxy. This call may or may not be a snapshot * of all players online. diff --git a/api/src/main/java/com/velocitypowered/api/proxy/connection/Player.java b/api/src/main/java/com/velocitypowered/api/proxy/connection/Player.java index 04f2c8a05..ed05cbfcb 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/connection/Player.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/connection/Player.java @@ -15,7 +15,7 @@ import com.velocitypowered.api.proxy.messages.PluginChannelId; import com.velocitypowered.api.proxy.player.ConnectionRequestBuilder; import com.velocitypowered.api.proxy.player.PlatformActions; import com.velocitypowered.api.proxy.player.PlayerIdentity; -import com.velocitypowered.api.proxy.player.TabList; +import com.velocitypowered.api.proxy.player.java.TabList; import com.velocitypowered.api.proxy.player.java.JavaClientSettings; import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity; import com.velocitypowered.api.proxy.server.RegisteredServer; @@ -55,13 +55,6 @@ public interface Player extends CommandSource, Identified, InboundConnection, */ @Nullable ServerConnection connectedServer(); - /** - * Returns the player's client settings. - * - * @return the settings - */ - JavaClientSettings clientSettings(); - /** * Returns the player's mod info if they have a modded client. * @@ -91,13 +84,6 @@ public interface Player extends CommandSource, Identified, InboundConnection, */ ConnectionRequestBuilder createConnectionRequest(RegisteredServer server); - /** - * Sets the player's profile properties. - * - * @param properties the properties - */ - void setGameProfileProperties(List properties); - /** * Returns the player's identity, which depends on what version of Minecraft they are currently * playing. @@ -105,13 +91,6 @@ public interface Player extends CommandSource, Identified, InboundConnection, @Override @NonNull PlayerIdentity identity(); - /** - * Returns the player's tab list. - * - * @return this player's tab list - */ - TabList tabList(); - /** * Disconnects the player with the specified reason. Once this method is called, further calls to * other {@link Player} methods will become undefined. @@ -127,25 +106,6 @@ public interface Player extends CommandSource, Identified, InboundConnection, */ void spoofChatInput(String input); - /** - * Sends the specified resource pack from {@code url} to the user. If at all possible, send the - * resource pack using {@link #sendResourcePack(String, byte[])}. To monitor the status of the - * sent resource pack, subscribe to {@link PlayerResourcePackStatusEvent}. - * - * @param url the URL for the resource pack - */ - void sendResourcePack(String url); - - /** - * Sends the specified resource pack from {@code url} to the user, using the specified 20-byte - * SHA-1 hash. To monitor the status of the sent resource pack, subscribe to - * {@link PlayerResourcePackStatusEvent}. - * - * @param url the URL for the resource pack - * @param hash the SHA-1 hash value for the resource pack - */ - void sendResourcePack(String url, byte[] hash); - /** * Note that this method does not send a plugin message to the server the player * is connected to. You should only use this method if you are trying to communicate diff --git a/api/src/main/java/com/velocitypowered/api/proxy/player/PlatformActions.java b/api/src/main/java/com/velocitypowered/api/proxy/player/PlatformActions.java index 230e9e6c2..29949c678 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/player/PlatformActions.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/player/PlatformActions.java @@ -7,11 +7,58 @@ package com.velocitypowered.api.proxy.player; +import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent; +import com.velocitypowered.api.proxy.player.java.JavaClientSettings; +import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity.Property; +import com.velocitypowered.api.proxy.player.java.TabList; +import java.util.List; +import org.checkerframework.checker.nullness.qual.Nullable; + /** * Provides certain actions that may be implemented across platforms (or not at all). Similar to * Adventure's {@link net.kyori.adventure.audience.Audience}, methods that are not implemented for - * a platform will silently fail. + * a platform will silently fail or return no-op instances as appropriate. */ public interface PlatformActions { + /** + * Sets the player's profile properties. This operation is not applicable to Bedrock Edition. + * + * @param properties the properties + */ + void setGameProfileProperties(List properties); + + /** + * Returns the player's client settings as sent by the client, for Java Edition clients only. + * + * @return the settings + */ + @Nullable JavaClientSettings clientSettings(); + + /** + * Returns the player's tab list, if supported. + * + * @return this player's tab list + */ + TabList tabList(); + + /** + * Sends the specified resource pack from {@code url} to the user, if supported. If possible, + * send the resource pack using {@link #sendResourcePack(String, byte[])}. To monitor the status + * of the sent resource pack, subscribe to {@link PlayerResourcePackStatusEvent}. + * + * @param url the URL for the resource pack + */ + void sendResourcePack(String url); + + /** + * Sends the specified resource pack from {@code url} to the user, if supported, and use the + * 20-byte SHA-1 hash as an unique identifier for this resource oack. To monitor the status of + * the sent resource pack, subscribe to {@link PlayerResourcePackStatusEvent}. + * + * @param url the URL for the resource pack + * @param hash the SHA-1 hash value for the resource pack + */ + void sendResourcePack(String url, byte[] hash); + } diff --git a/api/src/main/java/com/velocitypowered/api/proxy/player/TabList.java b/api/src/main/java/com/velocitypowered/api/proxy/player/java/TabList.java similarity index 92% rename from api/src/main/java/com/velocitypowered/api/proxy/player/TabList.java rename to api/src/main/java/com/velocitypowered/api/proxy/player/java/TabList.java index d080d0585..6473a9a7b 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/player/TabList.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/player/java/TabList.java @@ -5,17 +5,16 @@ * reference the LICENSE file in the api top-level directory. */ -package com.velocitypowered.api.proxy.player; +package com.velocitypowered.api.proxy.player.java; import com.velocitypowered.api.proxy.connection.Player; -import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity; import java.util.Collection; import java.util.UUID; import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.Nullable; /** - * Represents the tab list of a {@link Player}. + * Represents the tab list of a {@link Player}, specifically for Java players only. */ public interface TabList { diff --git a/api/src/main/java/com/velocitypowered/api/proxy/player/TabListEntry.java b/api/src/main/java/com/velocitypowered/api/proxy/player/java/TabListEntry.java similarity index 97% rename from api/src/main/java/com/velocitypowered/api/proxy/player/TabListEntry.java rename to api/src/main/java/com/velocitypowered/api/proxy/player/java/TabListEntry.java index 19f6a60f8..7dc113d31 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/player/TabListEntry.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/player/java/TabListEntry.java @@ -5,14 +5,13 @@ * reference the LICENSE file in the api top-level directory. */ -package com.velocitypowered.api.proxy.player; +package com.velocitypowered.api.proxy.player.java; -import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity; import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.Nullable; /** - * Represents a single entry in a {@link TabList}. + * Represents a single entry in a {@link TabList}, specifically for Java players only. */ public interface TabListEntry { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/DurationUtils.java b/proxy-core/src/main/java/com/velocitypowered/proxy/util/DurationUtils.java similarity index 100% rename from proxy/src/main/java/com/velocitypowered/proxy/util/DurationUtils.java rename to proxy-core/src/main/java/com/velocitypowered/proxy/util/DurationUtils.java diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/FileSystemUtils.java b/proxy-core/src/main/java/com/velocitypowered/proxy/util/FileSystemUtils.java similarity index 100% rename from proxy/src/main/java/com/velocitypowered/proxy/util/FileSystemUtils.java rename to proxy-core/src/main/java/com/velocitypowered/proxy/util/FileSystemUtils.java diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java b/proxy-core/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java similarity index 100% rename from proxy/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java rename to proxy-core/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/collect/Enum2IntMap.java b/proxy-core/src/main/java/com/velocitypowered/proxy/util/collect/Enum2IntMap.java similarity index 100% rename from proxy/src/main/java/com/velocitypowered/proxy/util/collect/Enum2IntMap.java rename to proxy-core/src/main/java/com/velocitypowered/proxy/util/collect/Enum2IntMap.java diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/concurrent/Once.java b/proxy-core/src/main/java/com/velocitypowered/proxy/util/concurrent/Once.java similarity index 100% rename from proxy/src/main/java/com/velocitypowered/proxy/util/concurrent/Once.java rename to proxy-core/src/main/java/com/velocitypowered/proxy/util/concurrent/Once.java diff --git a/proxy/build.gradle b/proxy/build.gradle index d26773bd6..a8aeae750 100644 --- a/proxy/build.gradle +++ b/proxy/build.gradle @@ -137,7 +137,15 @@ shadowJar { exclude 'it/unimi/dsi/fastutil/objects/*Object2Reference*' exclude 'it/unimi/dsi/fastutil/objects/*Object2Short*' exclude 'it/unimi/dsi/fastutil/objects/*ObjectRB*' - exclude 'it/unimi/dsi/fastutil/objects/*Reference*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Byte*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Char*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Double*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Float*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Short*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Long*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Object*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Reference*' + exclude 'it/unimi/dsi/fastutil/objects/*Reference2Boolean*' exclude 'it/unimi/dsi/fastutil/shorts/**' exclude 'org/checkerframework/checker/**' diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java index d6a5179d6..60c08f6e9 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/builtin/VelocityCommand.java @@ -35,7 +35,6 @@ import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.util.ProxyVersion; import com.velocitypowered.proxy.VelocityServer; -import com.velocitypowered.proxy.util.InformationUtils; import java.net.ConnectException; import java.net.UnknownHostException; import java.nio.charset.StandardCharsets; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index 4c8dc2af9..a60a10558 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -27,7 +27,6 @@ import com.google.common.collect.ImmutableMap; import com.google.gson.annotations.Expose; import com.velocitypowered.api.proxy.config.ProxyConfig; import com.velocitypowered.api.util.Favicon; -import com.velocitypowered.proxy.util.AddressUtil; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.File; import java.io.IOException; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundAvailableCommandsPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundAvailableCommandsPacket.java index d669ced09..7c421fe9d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundAvailableCommandsPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundAvailableCommandsPacket.java @@ -41,10 +41,9 @@ import com.velocitypowered.proxy.network.java.serialization.brigadier.ArgumentPr import com.velocitypowered.proxy.network.packet.Packet; import com.velocitypowered.proxy.network.packet.PacketReader; import com.velocitypowered.proxy.network.packet.PacketWriter; -import com.velocitypowered.proxy.util.collect.IdentityHashStrategy; import io.netty.buffer.ByteBuf; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Reference2IntLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Reference2IntMap; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Deque; @@ -118,8 +117,8 @@ public class ClientboundAvailableCommandsPacket implements Packet { public void encode(ByteBuf buf, ProtocolVersion protocolVersion) { // Assign all the children an index. Deque> childrenQueue = new ArrayDeque<>(ImmutableList.of(rootNode)); - Object2IntMap> idMappings = new Object2IntLinkedOpenCustomHashMap<>( - IdentityHashStrategy.instance()); + Reference2IntMap> idMappings = + new Reference2IntLinkedOpenHashMap<>(); while (!childrenQueue.isEmpty()) { CommandNode child = childrenQueue.poll(); if (!idMappings.containsKey(child)) { @@ -137,7 +136,7 @@ public class ClientboundAvailableCommandsPacket implements Packet { } private static void serializeNode(CommandNode node, ByteBuf buf, - Object2IntMap> idMappings) { + Reference2IntMap> idMappings) { byte flags = 0; if (node.getRedirect() != null) { flags |= FLAG_IS_REDIRECT; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundPlayerListItemPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundPlayerListItemPacket.java index 418a9bc38..5c0068c42 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundPlayerListItemPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundPlayerListItemPacket.java @@ -21,7 +21,7 @@ import com.google.common.base.MoreObjects; import com.google.common.base.VerifyException; import com.google.common.collect.ImmutableList; import com.velocitypowered.api.network.ProtocolVersion; -import com.velocitypowered.api.proxy.player.TabListEntry; +import com.velocitypowered.api.proxy.player.java.TabListEntry; import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity; import com.velocitypowered.proxy.network.ProtocolUtils; import com.velocitypowered.proxy.network.java.packet.JavaPacketHandler; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundTitlePacket.java b/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundTitlePacket.java index 3d9a2db2d..9a6871dd4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundTitlePacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/java/packet/clientbound/ClientboundTitlePacket.java @@ -25,7 +25,6 @@ import com.velocitypowered.proxy.network.java.packet.JavaPacketHandler; import com.velocitypowered.proxy.network.packet.Packet; import com.velocitypowered.proxy.network.packet.PacketReader; import com.velocitypowered.proxy.network.packet.PacketWriter; -import com.velocitypowered.proxy.util.DurationUtils; import io.netty.buffer.ByteBuf; import java.util.Arrays; import net.kyori.adventure.title.Title; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java index 3c05d6c66..83f012834 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java @@ -18,8 +18,8 @@ package com.velocitypowered.proxy.tablist; import com.google.common.base.Preconditions; -import com.velocitypowered.api.proxy.player.TabList; -import com.velocitypowered.api.proxy.player.TabListEntry; +import com.velocitypowered.api.proxy.player.java.TabList; +import com.velocitypowered.api.proxy.player.java.TabListEntry; import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntry.java b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntry.java index 5ed098d4e..7e33260ad 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntry.java @@ -17,8 +17,8 @@ package com.velocitypowered.proxy.tablist; -import com.velocitypowered.api.proxy.player.TabList; -import com.velocitypowered.api.proxy.player.TabListEntry; +import com.velocitypowered.api.proxy.player.java.TabList; +import com.velocitypowered.api.proxy.player.java.TabListEntry; import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity; import com.velocitypowered.proxy.network.java.packet.clientbound.ClientboundPlayerListItemPacket; import net.kyori.adventure.text.Component; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntryLegacy.java b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntryLegacy.java index b62c55dc9..ea3a889e5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntryLegacy.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntryLegacy.java @@ -17,7 +17,7 @@ package com.velocitypowered.proxy.tablist; -import com.velocitypowered.api.proxy.player.TabListEntry; +import com.velocitypowered.api.proxy.player.java.TabListEntry; import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity; import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListLegacy.java b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListLegacy.java index c14b94835..e63639078 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListLegacy.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListLegacy.java @@ -18,7 +18,7 @@ package com.velocitypowered.proxy.tablist; import com.google.common.collect.ImmutableList; -import com.velocitypowered.api.proxy.player.TabListEntry; +import com.velocitypowered.api.proxy.player.java.TabListEntry; import com.velocitypowered.api.proxy.player.java.JavaPlayerIdentity; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.network.java.packet.clientbound.ClientboundPlayerListItemPacket; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/collect/IdentityHashStrategy.java b/proxy/src/main/java/com/velocitypowered/proxy/util/collect/IdentityHashStrategy.java deleted file mode 100644 index 516c7cc74..000000000 --- a/proxy/src/main/java/com/velocitypowered/proxy/util/collect/IdentityHashStrategy.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2018 Velocity Contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.velocitypowered.proxy.util.collect; - -import it.unimi.dsi.fastutil.Hash.Strategy; - -public final class IdentityHashStrategy implements Strategy { - - @SuppressWarnings("rawtypes") - private static final IdentityHashStrategy INSTANCE = new IdentityHashStrategy(); - - public static Strategy instance() { - //noinspection unchecked - return INSTANCE; - } - - @Override - public int hashCode(T o) { - return System.identityHashCode(o); - } - - @Override - public boolean equals(T a, T b) { - return a == b; - } -}