Package com.velocitypowered.api.proxy
Interface ProxyServer
-
- All Superinterfaces:
net.kyori.adventure.audience.Audience
public interface ProxyServer extends net.kyori.adventure.audience.Audience
Provides an interface to a Minecraft server proxy.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Collection<Player>
getAllPlayers()
Retrieves all players currently connected to this proxy.java.util.Collection<RegisteredServer>
getAllServers()
Retrieves allRegisteredServer
s registered with this proxy.java.net.SocketAddress
getBoundAddress()
Gets the address that this proxy is bound to.ChannelRegistrar
getChannelRegistrar()
Gets theChannelRegistrar
instance.CommandManager
getCommandManager()
Gets theCommandManager
instance.ProxyConfig
getConfiguration()
Gets theProxyConfig
instance.ConsoleCommandSource
getConsoleCommandSource()
Returns an instance ofCommandSource
that can be used to determine if the command is being invoked by the console or a console-like executor.EventManager
getEventManager()
Gets theEventManager
instance.java.util.Optional<Player>
getPlayer(java.lang.String username)
Retrieves the player currently connected to this proxy by their Minecraft username.java.util.Optional<Player>
getPlayer(java.util.UUID uuid)
Retrieves the player currently connected to this proxy by their Minecraft UUID.int
getPlayerCount()
Returns the number of players currently connected to this proxy.PluginManager
getPluginManager()
Gets thePluginManager
instance.Scheduler
getScheduler()
Gets theScheduler
instance.java.util.Optional<RegisteredServer>
getServer(java.lang.String name)
Retrieves a registeredRegisteredServer
instance by its name.ProxyVersion
getVersion()
Returns the version of the proxy.java.util.Collection<Player>
matchPlayer(java.lang.String partialName)
Matches allPlayer
s whose names start with the provided partial name.java.util.Collection<RegisteredServer>
matchServer(java.lang.String partialName)
Matches allRegisteredServer
s whose names start with the provided partial name.RegisteredServer
registerServer(ServerInfo server)
Registers a server with this proxy.void
shutdown()
Shuts down the proxy, kicking players with the default reason.void
shutdown(net.kyori.adventure.text.Component reason)
Shuts down the proxy, kicking players with the specifiedreason
.void
unregisterServer(ServerInfo server)
Unregisters this server from the proxy.-
Methods inherited from interface net.kyori.adventure.audience.Audience
clearTitle, hideBossBar, openBook, openBook, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, showBossBar, showTitle, stopSound
-
-
-
-
Method Detail
-
shutdown
void shutdown(net.kyori.adventure.text.Component reason)
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.
-
getPlayer
java.util.Optional<Player> getPlayer(java.lang.String username)
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
Optional
with the player, which may be empty
-
getPlayer
java.util.Optional<Player> getPlayer(java.util.UUID uuid)
Retrieves the player currently connected to this proxy by their Minecraft UUID.- Parameters:
uuid
- the UUID- Returns:
- an
Optional
with the player, which may be empty
-
getAllPlayers
java.util.Collection<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
java.util.Optional<RegisteredServer> getServer(java.lang.String name)
Retrieves a registeredRegisteredServer
instance by its name. The search is case-insensitive.- Parameters:
name
- the name of the server- Returns:
- the registered server, which may be empty
-
getAllServers
java.util.Collection<RegisteredServer> getAllServers()
Retrieves allRegisteredServer
s registered with this proxy.- Returns:
- the servers registered with this proxy
-
matchPlayer
java.util.Collection<Player> matchPlayer(java.lang.String partialName)
Matches allPlayer
s whose names start with the provided partial name.- Parameters:
partialName
- the partial name to check for- Returns:
- a collection of mathed
Player
s
-
matchServer
java.util.Collection<RegisteredServer> matchServer(java.lang.String partialName)
Matches allRegisteredServer
s whose names start with the provided partial name.- Parameters:
partialName
- the partial name to check for- Returns:
- a collection of mathed
RegisteredServer
s
-
registerServer
RegisteredServer registerServer(ServerInfo server)
Registers a server with this proxy. A server with this name should not already exist.- Parameters:
server
- the server to register- Returns:
- the newly registered server
-
unregisterServer
void unregisterServer(ServerInfo server)
Unregisters this server from the proxy.- Parameters:
server
- the server to unregister
-
getConsoleCommandSource
ConsoleCommandSource getConsoleCommandSource()
Returns an instance ofCommandSource
that 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 ownCommandSource
instead of using the console invoker.- Returns:
- the console command invoker
-
getPluginManager
PluginManager getPluginManager()
Gets thePluginManager
instance.- Returns:
- the plugin manager instance
-
getEventManager
EventManager getEventManager()
Gets theEventManager
instance.- Returns:
- the event manager instance
-
getCommandManager
CommandManager getCommandManager()
Gets theCommandManager
instance.- Returns:
- the command manager
-
getChannelRegistrar
ChannelRegistrar getChannelRegistrar()
Gets theChannelRegistrar
instance.- Returns:
- the channel registrar
-
getBoundAddress
java.net.SocketAddress 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 theProxyConfig
instance.- Returns:
- the proxy config
-
getVersion
ProxyVersion getVersion()
Returns the version of the proxy.- Returns:
- the proxy version
-
-