diff --git a/common/src/main/java/us/myles/ViaVersion/ViaManager.java b/common/src/main/java/us/myles/ViaVersion/ViaManager.java index c93b93856..370885753 100644 --- a/common/src/main/java/us/myles/ViaVersion/ViaManager.java +++ b/common/src/main/java/us/myles/ViaVersion/ViaManager.java @@ -2,6 +2,7 @@ package us.myles.ViaVersion; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.data.UserConnection; +import us.myles.ViaVersion.api.platform.ViaConnectionManager; import us.myles.ViaVersion.api.platform.ViaInjector; import us.myles.ViaVersion.api.platform.ViaPlatform; import us.myles.ViaVersion.api.platform.ViaPlatformLoader; @@ -130,6 +131,9 @@ public class ViaManager { return platform.getConnectionManager().getConnectedClients(); } + /** + * @see ViaConnectionManager#isClientConnected(UUID) + */ public boolean isClientConnected(UUID player) { return platform.getConnectionManager().isClientConnected(player); } @@ -176,6 +180,9 @@ public class ViaManager { return subPlatforms; } + /** + * @see ViaConnectionManager#getConnectedClient(UUID) + */ public UserConnection getConnection(UUID playerUUID) { return platform.getConnectionManager().getConnectedClient(playerUUID); } diff --git a/common/src/main/java/us/myles/ViaVersion/api/Via.java b/common/src/main/java/us/myles/ViaVersion/api/Via.java index 6cef5663a..1edd82b7c 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/Via.java +++ b/common/src/main/java/us/myles/ViaVersion/api/Via.java @@ -7,7 +7,6 @@ import us.myles.ViaVersion.api.platform.ViaPlatform; public class Via { private static ViaPlatform platform; private static ViaManager manager; - private static boolean cacheJsonMappings; /** * Register the ViaManager associated with the platform. diff --git a/common/src/main/java/us/myles/ViaVersion/api/ViaAPI.java b/common/src/main/java/us/myles/ViaVersion/api/ViaAPI.java index 52ef3ebdb..b5a469953 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/ViaAPI.java +++ b/common/src/main/java/us/myles/ViaVersion/api/ViaAPI.java @@ -38,8 +38,8 @@ public interface ViaAPI { * * @param playerUUID UUID of a player * @return true if Via has a cached userconnection for this player - * @deprecated as of 0.9.9, because all players are ported use {@link #getPlayerVersion(UUID)}, - * or use {@link #isInjected(UUID)} + * @deprecated use {@link #isInjected(UUID)} + * @see #isInjected(UUID) */ @Deprecated default boolean isPorted(UUID playerUUID) { @@ -66,18 +66,18 @@ public interface ViaAPI { * * @param player Platform player object, eg. Bukkit this is Player * @param packet The packet, you need a VarInt ID then the packet contents. - * @throws IllegalArgumentException If not on 1.9 throws IllegalArg + * @throws IllegalArgumentException if the player is not injected by Via */ - void sendRawPacket(T player, ByteBuf packet) throws IllegalArgumentException; + void sendRawPacket(T player, ByteBuf packet); /** * Send a raw packet to the player (Use new IDs) * * @param uuid The uuid from the player to send packet * @param packet The packet, you need a VarInt ID then the packet contents. - * @throws IllegalArgumentException If not on 1.9 throws IllegalArg + * @throws IllegalArgumentException if the player is not injected by Via */ - void sendRawPacket(UUID uuid, ByteBuf packet) throws IllegalArgumentException; + void sendRawPacket(UUID uuid, ByteBuf packet); /** * Create a new bossbar instance diff --git a/common/src/main/java/us/myles/ViaVersion/api/platform/ViaConnectionManager.java b/common/src/main/java/us/myles/ViaVersion/api/platform/ViaConnectionManager.java index f44fb777e..c73eb0e15 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/platform/ViaConnectionManager.java +++ b/common/src/main/java/us/myles/ViaVersion/api/platform/ViaConnectionManager.java @@ -47,6 +47,9 @@ public class ViaConnectionManager { * Returns null when there isn't a server or connection was not found * When ViaVersion is reloaded, this method may not return some players. * May not return ProtocolSupport players. + *

+ * Note that connections are removed as soon as their channel is closed, + * so avoid using this method during player quits for example. */ public UserConnection getConnectedClient(UUID clientIdentifier) { return clients.get(clientIdentifier); @@ -63,6 +66,12 @@ public class ViaConnectionManager { return Collections.unmodifiableSet(connections); } + /** + * Returns if Via injected into this player connection. + * + * @param playerId player uuid + * @return true if the player is handled by Via + */ public boolean isClientConnected(UUID playerId) { return clients.containsKey(playerId); }