Some javadoc changes

This commit is contained in:
KennyTV 2020-04-24 11:39:11 +02:00
parent 32826467d3
commit 4b9a15b003
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
4 changed files with 22 additions and 7 deletions

View File

@ -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);
}

View File

@ -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.

View File

@ -38,8 +38,8 @@ public interface ViaAPI<T> {
*
* @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<T> {
*
* @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

View File

@ -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.
* <p>
* 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);
}