public class ProtocolRegistry extends Object
Modifier and Type | Field and Description |
---|---|
static Protocol |
BASE_PROTOCOL |
static int |
maxProtocolPathSize |
static int |
SERVER_PROTOCOL |
Constructor and Description |
---|
ProtocolRegistry() |
Modifier and Type | Method and Description |
---|---|
static void |
addMappingLoaderFuture(Class<? extends Protocol> protocolClass,
Class<? extends Protocol> dependsOn,
Runnable runnable) |
static void |
addMappingLoaderFuture(Class<? extends Protocol> protocolClass,
Runnable runnable) |
static boolean |
checkForMappingCompletion()
Shuts down the executor and uncaches mappings if all futures have been completed.
|
static void |
completeMappingDataLoading(Class<? extends Protocol> protocolClass)
Ensure that mapping data for that protocol has already been loaded, completes it otherwise.
|
static Protocol |
getBaseProtocol(int serverVersion) |
static @Nullable CompletableFuture<Void> |
getMappingLoaderFuture(Class<? extends Protocol> protocolClass) |
static @Nullable Protocol |
getProtocol(Class<? extends Protocol> protocolClass)
Returns a protocol instance by its class.
|
static @Nullable List<Pair<Integer,Protocol>> |
getProtocolPath(int clientVersion,
int serverVersion)
Calculate a path from a client version to server version.
|
static SortedSet<Integer> |
getSupportedVersions()
Get the versions compatible with the server.
|
static void |
init() |
static boolean |
isBaseProtocol(Protocol protocol) |
static boolean |
isWorkingPipe()
Check if this plugin is useful to the server.
|
static void |
onServerLoaded()
Called when the server is enabled, to register any non registered listeners.
|
static void |
refreshVersions() |
static void |
registerBaseProtocol(Protocol baseProtocol,
com.google.common.collect.Range<Integer> supportedProtocols)
Registers a base protocol.
|
static void |
registerProtocol(Protocol protocol,
List<Integer> supported,
int output)
Register a protocol
|
static void |
registerProtocol(Protocol protocol,
ProtocolVersion supported,
ProtocolVersion output)
Register a protocol
|
public static final Protocol BASE_PROTOCOL
public static int SERVER_PROTOCOL
public static int maxProtocolPathSize
public static void init()
public static void registerProtocol(Protocol protocol, ProtocolVersion supported, ProtocolVersion output)
protocol
- The protocol to register.supported
- Supported client versions.output
- The output server version it converts to.public static void registerProtocol(Protocol protocol, List<Integer> supported, int output)
protocol
- The protocol to register.supported
- Supported client versions.output
- The output server version it converts to.public static void registerBaseProtocol(Protocol baseProtocol, com.google.common.collect.Range<Integer> supportedProtocols)
baseProtocol
- Base Protocol to registersupportedProtocols
- Versions that baseProtocol supportspublic static void refreshVersions()
public static SortedSet<Integer> getSupportedVersions()
public static boolean isWorkingPipe()
public static void onServerLoaded()
@Nullable public static @Nullable List<Pair<Integer,Protocol>> getProtocolPath(int clientVersion, int serverVersion)
clientVersion
- The input client versionserverVersion
- The desired output server version@Nullable public static @Nullable Protocol getProtocol(Class<? extends Protocol> protocolClass)
protocolClass
- class of the protocolpublic static Protocol getBaseProtocol(int serverVersion)
public static boolean isBaseProtocol(Protocol protocol)
public static void completeMappingDataLoading(Class<? extends Protocol> protocolClass) throws Exception
protocolClass
- protocol classException
public static boolean checkForMappingCompletion()
public static void addMappingLoaderFuture(Class<? extends Protocol> protocolClass, Runnable runnable)
public static void addMappingLoaderFuture(Class<? extends Protocol> protocolClass, Class<? extends Protocol> dependsOn, Runnable runnable)
@Nullable public static @Nullable CompletableFuture<Void> getMappingLoaderFuture(Class<? extends Protocol> protocolClass)
Copyright © 2016–2021. All rights reserved.