Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-09-08 13:52:50 +02:00
Minor jd changes in ViaAPI, fix typo
Dieser Commit ist enthalten in:
Ursprung
a63f2ab6fe
Commit
fd9442b077
@ -23,18 +23,26 @@
|
|||||||
package us.myles.ViaVersion.api;
|
package us.myles.ViaVersion.api;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import us.myles.ViaVersion.ViaManager;
|
||||||
import us.myles.ViaVersion.api.boss.BossBar;
|
import us.myles.ViaVersion.api.boss.BossBar;
|
||||||
import us.myles.ViaVersion.api.boss.BossColor;
|
import us.myles.ViaVersion.api.boss.BossColor;
|
||||||
import us.myles.ViaVersion.api.boss.BossStyle;
|
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 us.myles.ViaVersion.api.protocol.ServerProtocolVersion;
|
||||||
|
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the ViaAPI
|
* General api point. For more specialized api methods, see {@link Via#getManager()}.
|
||||||
*
|
*
|
||||||
* @param <T> The player type for the specific platform, for bukkit it's {@code ViaAPI<Player>}
|
* @param <T> The player type for the specific platform, for bukkit it's {@code ViaAPI<Player>}
|
||||||
|
* @see ViaManager
|
||||||
|
* @see ProtocolManager
|
||||||
|
* @see ViaConnectionManager
|
||||||
|
* @see ViaPlatform
|
||||||
*/
|
*/
|
||||||
public interface ViaAPI<T> {
|
public interface ViaAPI<T> {
|
||||||
|
|
||||||
@ -46,19 +54,19 @@ public interface ViaAPI<T> {
|
|||||||
ServerProtocolVersion getServerVersion();
|
ServerProtocolVersion getServerVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get protocol version number from a player.
|
* Returns the protocol version from a player.
|
||||||
* Will also retrieve version from ProtocolSupport if it's being used.
|
* This will also retrieve the version from ProtocolSupport if it's being used.
|
||||||
*
|
*
|
||||||
* @param player Platform player object, eg. Bukkit this is Player
|
* @param player the platform's player object, e.g. 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
|
* @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);
|
int getPlayerVersion(T player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get protocol number from a player.
|
* Returns the protocol version from a player.
|
||||||
*
|
*
|
||||||
* @param uuid UUID of 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);
|
int getPlayerVersion(UUID uuid);
|
||||||
|
|
||||||
@ -76,7 +84,7 @@ public interface ViaAPI<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if Via injected into this player connection
|
* Returns if Via injected into this player connection.
|
||||||
*
|
*
|
||||||
* @param playerUUID UUID of a player
|
* @param playerUUID UUID of a player
|
||||||
* @return true if Via has a cached UserConnection for this player
|
* @return true if Via has a cached UserConnection for this player
|
||||||
@ -84,26 +92,26 @@ public interface ViaAPI<T> {
|
|||||||
boolean isInjected(UUID playerUUID);
|
boolean isInjected(UUID playerUUID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the version of the plugin
|
* Returns the version of the plugin.
|
||||||
*
|
*
|
||||||
* @return Plugin version
|
* @return plugin version
|
||||||
*/
|
*/
|
||||||
String getVersion();
|
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 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.
|
* @param packet the packet; you need a VarInt Id, then the packet contents
|
||||||
* @throws IllegalArgumentException if the player is not injected by Via
|
* @throws IllegalArgumentException if the player is not injected by Via
|
||||||
*/
|
*/
|
||||||
void sendRawPacket(T player, ByteBuf packet);
|
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 uuid the uuid from the player to send packet
|
||||||
* @param packet The packet, you need a VarInt ID then the packet contents.
|
* @param packet the packet; you need a VarInt Id, then the packet contents
|
||||||
* @throws IllegalArgumentException if the player is not injected by Via
|
* @throws IllegalArgumentException if the player is not injected by Via
|
||||||
*/
|
*/
|
||||||
void sendRawPacket(UUID uuid, ByteBuf packet);
|
void sendRawPacket(UUID uuid, ByteBuf packet);
|
||||||
@ -130,7 +138,7 @@ public interface ViaAPI<T> {
|
|||||||
BossBar createBossBar(String title, float health, BossColor color, BossStyle style);
|
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.
|
* This method removes any blocked protocol versions.
|
||||||
*
|
*
|
||||||
* @return a list of protocol versions
|
* @return a list of protocol versions
|
||||||
@ -139,7 +147,7 @@ public interface ViaAPI<T> {
|
|||||||
SortedSet<Integer> getSupportedVersions();
|
SortedSet<Integer> getSupportedVersions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the supported protocol versions, including blocked protocols.
|
* Returns the supported protocol versions, including blocked protocols.
|
||||||
*
|
*
|
||||||
* @return a list of protocol versions
|
* @return a list of protocol versions
|
||||||
*/
|
*/
|
||||||
|
@ -99,7 +99,7 @@ public interface ProtocolManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum protocol path size applied to {@link #getProtocolPath(int, int)}.
|
* 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
|
* @param maxProtocolPathSize maximum protocol path size
|
||||||
*/
|
*/
|
||||||
|
@ -115,10 +115,8 @@ public class ViaManagerImpl implements ViaManager {
|
|||||||
ServerProtocolVersion protocolVersion = protocolManager.getServerProtocolVersion();
|
ServerProtocolVersion protocolVersion = protocolManager.getServerProtocolVersion();
|
||||||
if (protocolVersion.isKnown()) {
|
if (protocolVersion.isKnown()) {
|
||||||
if (platform.isProxy()) {
|
if (platform.isProxy()) {
|
||||||
platform.getLogger().info("ViaVersion detected lowest supported versions by the proxy: "
|
platform.getLogger().info("ViaVersion detected lowest supported version by the proxy: " + ProtocolVersion.getProtocol(protocolVersion.lowestSupportedVersion()));
|
||||||
+ ProtocolVersion.getProtocol(protocolVersion.lowestSupportedVersion())
|
platform.getLogger().info("Highest supported version by the proxy: " + ProtocolVersion.getProtocol(protocolVersion.highestSupportedVersion()));
|
||||||
+ "\nHighest supported version by the proxy: "
|
|
||||||
+ ProtocolVersion.getProtocol(protocolVersion.highestSupportedVersion()));
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
platform.getLogger().info("Supported version range: " + Arrays.toString(protocolVersion.supportedVersions().toArray(new int[0])));
|
platform.getLogger().info("Supported version range: " + Arrays.toString(protocolVersion.supportedVersions().toArray(new int[0])));
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren