Interface ProxyServer
-
Method Summary
Modifier and TypeMethodDescriptionvoidCloses all listening endpoints for this server.createRawRegisteredServer(ServerInfo server) Creates a rawRegisteredServerwithout tying it into the internal server map.Creates a builder to build aResourcePackInfoinstance for use withPlayer.sendResourcePackOffer(ResourcePackInfo).Collection<? extends Player> Retrieves all players currently connected to this proxy.Collection<? extends RegisteredServer> Retrieves allRegisteredServers registered with this proxy.Gets the address that this proxy is bound to.Gets theBridgeChannelused to exchangebtc:bridgemessages with the backend servers.Gets theChannelRegistrarinstance.Gets theClusterPlayerService, used for multi-proxy setups.Gets theClusterProxyService, used for multi-proxy setups.Gets theCommandManagerinstance.Gets theProxyConfiginstance.Returns an instance ofCommandSourcethat can be used to determine if the command is being invoked by the console or a console-like executor.Gets theEventManagerinstance.Retrieves the player currently connected to this proxy by their Minecraft username.Retrieves the player currently connected to this proxy by their Minecraft UUID.intReturns the number of players currently connected to this proxy.Gets thePluginManagerinstance.Gets the identifier of this proxy.Returns the queue manager currently in use.Gets theSchedulerinstance.Optional<? extends RegisteredServer> Retrieves a registeredRegisteredServerinstance by its name.@Nullable StorageServiceGets theStorageServiceused to persist player data and proxy state.Returns the version of the proxy.booleanCheck whether the queue system is enabled for the proxy.booleanReturns whether the proxy is currently shutting down.Collection<? extends Player> matchPlayer(String partialName) Matches allPlayers whose names start with the provided partial name.Collection<? extends RegisteredServer> matchServer(String partialName) Matches allRegisteredServers whose names start with the provided partial name.registerServer(ServerInfo server) Registers a server with this proxy.voidshutdown()Shuts down the proxy, kicking players with the default reason.voidShuts down the proxy, kicking players with the specifiedreason.voidunregisterServer(ServerInfo server) Unregisters this server from the proxy.Methods inherited from interface net.kyori.adventure.audience.Audience
clearResourcePacks, clearTitle, closeDialog, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, sendResourcePacks, sendTitlePart, showBossBar, showDialog, showTitle, stopSound, stopSoundMethods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
-
Method Details
-
shutdown
Shuts down the proxy, kicking players with the specifiedreason.- Parameters:
reason- message to kick online players with
-
shutdown
void shutdown()Shuts down the proxy, kicking players with the default reason. -
isShuttingDown
boolean isShuttingDown()Returns whether the proxy is currently shutting down.- Returns:
trueif the proxy is shutting down,falseotherwise
-
closeListeners
void closeListeners()Closes all listening endpoints for this server. This includes the main minecraft listener and query channel. -
getPlayer
Retrieves the player currently connected to this proxy by their Minecraft username. The search is case-insensitive.- Parameters:
username- the username to search for- Returns:
- an
Optionalwith the player, which may be empty
-
getPlayer
Retrieves the player currently connected to this proxy by their Minecraft UUID.- Parameters:
uuid- the UUID- Returns:
- an
Optionalwith the player, which may be empty
-
getAllPlayers
Collection<? extends Player> getAllPlayers()Retrieves all players currently connected to this proxy. This call may or may not be a snapshot of all players online.- Returns:
- the players online on this proxy
-
getPlayerCount
int getPlayerCount()Returns the number of players currently connected to this proxy.- Returns:
- the players on this proxy
-
getServer
Retrieves a registeredRegisteredServerinstance by its name. The search is case-insensitive.- Parameters:
name- the name of the server- Returns:
- the registered server, which may be empty
-
getAllServers
Collection<? extends RegisteredServer> getAllServers()Retrieves allRegisteredServers registered with this proxy.- Returns:
- the servers registered with this proxy
-
matchPlayer
Matches allPlayers whose names start with the provided partial name.- Parameters:
partialName- the partial name to check for- Returns:
- a collection of matched
Players
-
matchServer
Matches allRegisteredServers whose names start with the provided partial name.- Parameters:
partialName- the partial name to check for- Returns:
- a collection of matched
RegisteredServers
-
createRawRegisteredServer
Creates a rawRegisteredServerwithout tying it into the internal server map.- Parameters:
server- the server to register- Returns:
- the
RegisteredServerimplementation created by the providedServerInfo.
-
registerServer
Registers a server with this proxy. A server with this name should not exist.- Parameters:
server- the server to register- Returns:
- the newly registered server
-
unregisterServer
Unregisters this server from the proxy.- Parameters:
server- the server to unregister
-
getConsoleCommandSource
ConsoleCommandSource getConsoleCommandSource()Returns an instance ofCommandSourcethat can be used to determine if the command is being invoked by the console or a console-like executor. Plugins that execute commands are strongly urged to implement their ownCommandSourceinstead of using the console invoker.- Returns:
- the console command invoker
-
getPluginManager
PluginManager getPluginManager()Gets thePluginManagerinstance.- Returns:
- the plugin manager instance
-
getEventManager
EventManager getEventManager()Gets theEventManagerinstance.- Returns:
- the event manager instance
-
getCommandManager
CommandManager getCommandManager()Gets theCommandManagerinstance.- Returns:
- the command manager
-
isQueueEnabled
boolean isQueueEnabled()Check whether the queue system is enabled for the proxy.- Returns:
- true if the queue system is enabled, otherwise false
-
getQueueManager
QueueManager getQueueManager()Returns the queue manager currently in use. Will throw when the queue is not enabled. Please check this beforehand withisQueueEnabled().- Returns:
- the
QueueManager, or throwsIllegalStateExceptionif not initialized
-
getScheduler
Scheduler getScheduler()Gets theSchedulerinstance.- Returns:
- the scheduler instance
-
getChannelRegistrar
ChannelRegistrar getChannelRegistrar()Gets theChannelRegistrarinstance.- Returns:
- the channel registrar
-
getBoundAddress
InetSocketAddress getBoundAddress()Gets the address that this proxy is bound to. This does not necessarily indicate the external IP address of the proxy.- Returns:
- the address the proxy is bound to
-
getConfiguration
ProxyConfig getConfiguration()Gets theProxyConfiginstance.- Returns:
- the proxy config
-
getVersion
ProxyVersion getVersion()Returns the version of the proxy.- Returns:
- the proxy version
-
getClusterPlayerService
ClusterPlayerService getClusterPlayerService()Gets theClusterPlayerService, used for multi-proxy setups.- Returns:
- the cluster player service
-
getStorageService
Gets theStorageServiceused to persist player data and proxy state.- Returns:
- the storage service, or
nullif PostgreSQL storage is not enabled
-
getBridgeChannel
BridgeChannel getBridgeChannel()Gets theBridgeChannelused to exchangebtc:bridgemessages with the backend servers.- Returns:
- the bridge channel
-
getProxyId
String getProxyId()Gets the identifier of this proxy.When Redis is enabled this is the configured proxy id, otherwise a single-proxy placeholder is returned.
- Returns:
- the proxy identifier
-
getClusterProxyService
ClusterProxyService getClusterProxyService()Gets theClusterProxyService, used for multi-proxy setups.- Returns:
- the multi proxy service
-
createResourcePackBuilder
Creates a builder to build aResourcePackInfoinstance for use withPlayer.sendResourcePackOffer(ResourcePackInfo).Note: The resource-pack location should always: - Use HTTPS with a valid certificate. - Be in a crawler-accessible location. Having it behind Cloudflare or other DoS/Bot/crawler protection may cause issues in downloading. - Be on a web-server with enough bandwidth and reliable connection, so the download does not time out or fail.
Do also make sure that the resource pack is in the correct format for the version of the client. It is also highly recommended to always provide the resource-pack SHA-1 hash of the resource pack with
ResourcePackInfo.Builder.setHash(byte[])whenever possible to save bandwidth. If a hash is present, the client will first check if it already has a resource pack by that hash cached.- Parameters:
url- The url where the resource pack can be found- Returns:
- a ResourcePackInfo builder
-