From fd9442b0777137e591649a0a5921049a68c451ac Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sat, 27 Mar 2021 10:29:53 +0100 Subject: [PATCH] Minor jd changes in ViaAPI, fix typo --- .../java/us/myles/ViaVersion/api/ViaAPI.java | 44 +++++++++++-------- .../api/protocol/ProtocolManager.java | 2 +- .../us/myles/ViaVersion/ViaManagerImpl.java | 6 +-- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/api/src/main/java/us/myles/ViaVersion/api/ViaAPI.java b/api/src/main/java/us/myles/ViaVersion/api/ViaAPI.java index 01232b81f..9487f8a09 100644 --- a/api/src/main/java/us/myles/ViaVersion/api/ViaAPI.java +++ b/api/src/main/java/us/myles/ViaVersion/api/ViaAPI.java @@ -23,18 +23,26 @@ package us.myles.ViaVersion.api; import io.netty.buffer.ByteBuf; +import us.myles.ViaVersion.ViaManager; import us.myles.ViaVersion.api.boss.BossBar; import us.myles.ViaVersion.api.boss.BossColor; import us.myles.ViaVersion.api.boss.BossStyle; +import us.myles.ViaVersion.api.platform.ViaConnectionManager; +import us.myles.ViaVersion.api.platform.ViaPlatform; +import us.myles.ViaVersion.api.protocol.ProtocolManager; import us.myles.ViaVersion.api.protocol.ServerProtocolVersion; import java.util.SortedSet; import java.util.UUID; /** - * Represents the ViaAPI + * General api point. For more specialized api methods, see {@link Via#getManager()}. * * @param The player type for the specific platform, for bukkit it's {@code ViaAPI} + * @see ViaManager + * @see ProtocolManager + * @see ViaConnectionManager + * @see ViaPlatform */ public interface ViaAPI { @@ -46,19 +54,19 @@ public interface ViaAPI { ServerProtocolVersion getServerVersion(); /** - * Get protocol version number from a player. - * Will also retrieve version from ProtocolSupport if it's being used. + * Returns the protocol version from a player. + * This will also retrieve the version from ProtocolSupport if it's being used. * - * @param player Platform player object, eg. Bukkit this is Player - * @return Protocol ID, For example (47=1.8-1.8.8, 107=1.9, 108=1.9.1), or -1 if no longer connected + * @param player the platform's player object, e.g. Bukkit this is Player + * @return protocol version, for example (47=1.8-1.8.8, 107=1.9, 108=1.9.1), or -1 if no longer connected */ int getPlayerVersion(T player); /** - * Get protocol number from a player. + * Returns the protocol version from a player. * * @param uuid UUID of a player - * @return Protocol ID, For example (47=1.8-1.8.8, 107=1.9, 108=1.9.1), or -1 if not connected + * @return protocol version, for example (47=1.8-1.8.8, 107=1.9, 108=1.9.1), or -1 if not connected */ int getPlayerVersion(UUID uuid); @@ -76,7 +84,7 @@ public interface ViaAPI { } /** - * Returns if Via injected into this player connection + * Returns if Via injected into this player connection. * * @param playerUUID UUID of a player * @return true if Via has a cached UserConnection for this player @@ -84,26 +92,26 @@ public interface ViaAPI { boolean isInjected(UUID playerUUID); /** - * Get the version of the plugin + * Returns the version of the plugin. * - * @return Plugin version + * @return plugin version */ String getVersion(); /** - * Send a raw packet to the player (Use new IDs) + * Sends a raw packet to the player. * - * @param player Platform player object, eg. Bukkit this is Player - * @param packet The packet, you need a VarInt ID then the packet contents. + * @param player the platform's player object, e.g. for Bukkit this is Player + * @param packet the packet; you need a VarInt Id, then the packet contents * @throws IllegalArgumentException if the player is not injected by Via */ void sendRawPacket(T player, ByteBuf packet); /** - * Send a raw packet to the player (Use new IDs) + * Sends a raw packet to the player. * - * @param uuid The uuid from the player to send packet - * @param packet The packet, you need a VarInt ID then the packet contents. + * @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 the player is not injected by Via */ void sendRawPacket(UUID uuid, ByteBuf packet); @@ -130,7 +138,7 @@ public interface ViaAPI { BossBar createBossBar(String title, float health, BossColor color, BossStyle style); /** - * Get the supported protocol versions + * Returns the supported protocol versions. * This method removes any blocked protocol versions. * * @return a list of protocol versions @@ -139,7 +147,7 @@ public interface ViaAPI { SortedSet getSupportedVersions(); /** - * Get the supported protocol versions, including blocked protocols. + * Returns the supported protocol versions, including blocked protocols. * * @return a list of protocol versions */ diff --git a/api/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolManager.java b/api/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolManager.java index b1a85cd87..3076eb33d 100644 --- a/api/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolManager.java +++ b/api/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolManager.java @@ -99,7 +99,7 @@ public interface ProtocolManager { /** * Sets the maximum protocol path size applied to {@link #getProtocolPath(int, int)}. - * Its default it 50. + * Its default is 50. * * @param maxProtocolPathSize maximum protocol path size */ diff --git a/common/src/main/java/us/myles/ViaVersion/ViaManagerImpl.java b/common/src/main/java/us/myles/ViaVersion/ViaManagerImpl.java index 9526f0f5b..849aa7362 100644 --- a/common/src/main/java/us/myles/ViaVersion/ViaManagerImpl.java +++ b/common/src/main/java/us/myles/ViaVersion/ViaManagerImpl.java @@ -115,10 +115,8 @@ public class ViaManagerImpl implements ViaManager { ServerProtocolVersion protocolVersion = protocolManager.getServerProtocolVersion(); if (protocolVersion.isKnown()) { if (platform.isProxy()) { - platform.getLogger().info("ViaVersion detected lowest supported versions by the proxy: " - + ProtocolVersion.getProtocol(protocolVersion.lowestSupportedVersion()) - + "\nHighest supported version by the proxy: " - + ProtocolVersion.getProtocol(protocolVersion.highestSupportedVersion())); + platform.getLogger().info("ViaVersion detected lowest supported version by the proxy: " + ProtocolVersion.getProtocol(protocolVersion.lowestSupportedVersion())); + platform.getLogger().info("Highest supported version by the proxy: " + ProtocolVersion.getProtocol(protocolVersion.highestSupportedVersion())); if (debug) { platform.getLogger().info("Supported version range: " + Arrays.toString(protocolVersion.supportedVersions().toArray(new int[0]))); }