Package net.md_5.bungee.api
Class ProxyServer
java.lang.Object
net.md_5.bungee.api.ProxyServer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
Deprecated.abstract void
broadcast
(BaseComponent message) Send the specified message to the console and all connected players.abstract void
broadcast
(BaseComponent... message) Send the specified message to the console and all connected players.abstract ServerInfo
constructServerInfo
(String name, InetSocketAddress address, String motd, boolean restricted) Factory method to construct an implementation specific server info instance.abstract ServerInfo
constructServerInfo
(String name, SocketAddress address, String motd, boolean restricted) Factory method to construct an implementation specific server info instance.abstract Title
Creates a new empty title configuration.abstract Collection<String>
Get an immutable set of all registered plugin channels.abstract ProxyConfig
Gets BungeeCord's core config.abstract ConfigurationAdapter
Returns the currently in use configuration adapter.abstract CommandSender
Returns the console overlord for this proxy.abstract Collection<String>
Gets the commands which are disabled and will not be run on this proxy.abstract String
Deprecated.abstract Logger
Gets the main logger which can be used as a suitable replacement forSystem.out
andSystem.err
.abstract String
getName()
Gets the name of the currently running proxy software.abstract int
Get the current number of connected users.abstract ProxiedPlayer
Gets a connected player via their unique username.abstract ProxiedPlayer
Gets a connected player via their UUIDabstract Collection<ProxiedPlayer>
Return all players currently connected.abstract PluginManager
Get thePluginManager
associated with loading plugins and dispatching events.abstract File
Return the folder used to load plugins from.abstract int
Deprecated.abstract ReconnectHandler
Get the currently in use reconnect handler.abstract TaskScheduler
Get the scheduler instance for this proxy.abstract ServerInfo
getServerInfo
(String name) Gets the server info of a server.abstract Map<String,
ServerInfo> Return all servers registered to this proxy, keyed by name.abstract String
getTranslation
(String name, Object... args) Gets a localized string from the .properties file.abstract String
Gets the version of the currently running proxy software.abstract Collection<ProxiedPlayer>
matchPlayer
(String match) Attempts to match any players with the given name, and returns a list of all possible matches.abstract void
registerChannel
(String channel) Register a channel for use with plugin messages.abstract void
Set the configuration adapter to be used.static void
setInstance
(ProxyServer instance) Sets the proxy instance.abstract void
setReconnectHandler
(ReconnectHandler handler) Sets the reconnect handler to be used for subsequent connections.abstract void
stop()
Gracefully mark this instance for shutdown.abstract void
Gracefully mark this instance for shutdown.abstract void
unregisterChannel
(String channel) Unregister a previously registered channel.
-
Constructor Details
-
ProxyServer
public ProxyServer()
-
-
Method Details
-
setInstance
Sets the proxy instance. This method may only be called once per an application.- Parameters:
instance
- the new instance to set
-
getName
Gets the name of the currently running proxy software.- Returns:
- the name of this instance
-
getVersion
Gets the version of the currently running proxy software.- Returns:
- the version of this instance
-
getTranslation
Gets a localized string from the .properties file.- Parameters:
name
- translation nameargs
- translation arguments- Returns:
- the localized string
-
getLogger
Gets the main logger which can be used as a suitable replacement forSystem.out
andSystem.err
.- Returns:
- the
Logger
instance
-
getPlayers
Return all players currently connected.- Returns:
- all connected players
-
getPlayer
Gets a connected player via their unique username.- Parameters:
name
- of the player- Returns:
- their player instance
-
getPlayer
Gets a connected player via their UUID- Parameters:
uuid
- of the player- Returns:
- their player instance
-
getServers
Return all servers registered to this proxy, keyed by name. Unlike the methods inConfigurationAdapter.getServers()
, this will not return a fresh map each time.- Returns:
- all registered remote server destinations
-
getServerInfo
Gets the server info of a server.- Parameters:
name
- the name of the configured server- Returns:
- the server info belonging to the specified server
-
getPluginManager
Get thePluginManager
associated with loading plugins and dispatching events. It is recommended that implementations use the provided PluginManager class.- Returns:
- the plugin manager
-
getConfigurationAdapter
Returns the currently in use configuration adapter.- Returns:
- the used configuration adapter
-
setConfigurationAdapter
Set the configuration adapter to be used. Must be called fromPlugin.onLoad()
.- Parameters:
adapter
- the adapter to use
-
getReconnectHandler
Get the currently in use reconnect handler.- Returns:
- the in use reconnect handler
-
setReconnectHandler
Sets the reconnect handler to be used for subsequent connections.- Parameters:
handler
- the new handler
-
stop
public abstract void stop()Gracefully mark this instance for shutdown. -
stop
Gracefully mark this instance for shutdown.- Parameters:
reason
- the reason for stopping. This will be shown to players.
-
registerChannel
Register a channel for use with plugin messages. This is required by some server / client implementations.- Parameters:
channel
- the channel to register
-
unregisterChannel
Unregister a previously registered channel.- Parameters:
channel
- the channel to unregister
-
getChannels
Get an immutable set of all registered plugin channels.- Returns:
- registered plugin channels
-
getGameVersion
Deprecated.Get the Minecraft version supported by this proxy.- Returns:
- the supported Minecraft version
-
getProtocolVersion
Deprecated.Get the Minecraft protocol version supported by this proxy.- Returns:
- the Minecraft protocol version
-
constructServerInfo
public abstract ServerInfo constructServerInfo(String name, InetSocketAddress address, String motd, boolean restricted) Factory method to construct an implementation specific server info instance.- Parameters:
name
- name of the serveraddress
- connectable Minecraft address + port of the servermotd
- the motd when used as a forced serverrestricted
- whether the server info restricted property will be set- Returns:
- the constructed instance
-
constructServerInfo
public abstract ServerInfo constructServerInfo(String name, SocketAddress address, String motd, boolean restricted) Factory method to construct an implementation specific server info instance.- Parameters:
name
- name of the serveraddress
- connectable Minecraft address + port of the servermotd
- the motd when used as a forced serverrestricted
- whether the server info restricted property will be set- Returns:
- the constructed instance
-
getConsole
Returns the console overlord for this proxy. Being the console, this command server cannot have permissions or groups, and will be able to execute anything.- Returns:
- the console command sender of this proxy
-
getPluginsFolder
Return the folder used to load plugins from.- Returns:
- the folder used to load plugin
-
getScheduler
Get the scheduler instance for this proxy.- Returns:
- the in use scheduler
-
getOnlineCount
public abstract int getOnlineCount()Get the current number of connected users. The default implementation is more efficient thangetPlayers()
as it does not take a lock or make a copy.- Returns:
- the current number of connected players
-
broadcast
Deprecated.Send the specified message to the console and all connected players.- Parameters:
message
- the message to broadcast
-
broadcast
Send the specified message to the console and all connected players.- Parameters:
message
- the message to broadcast
-
broadcast
Send the specified message to the console and all connected players.- Parameters:
message
- the message to broadcast
-
getDisabledCommands
Gets the commands which are disabled and will not be run on this proxy.- Returns:
- the set of disabled commands
-
getConfig
Gets BungeeCord's core config.- Returns:
- the config.
-
matchPlayer
Attempts to match any players with the given name, and returns a list of all possible matches. The exact algorithm to use to match players is implementation specific, but in general you can expect this method to return player's whose names begin with the specified prefix.- Parameters:
match
- the (partial) name to match- Returns:
- list of all possible players, singleton if there is an exact match
-
createTitle
Creates a new empty title configuration. In most cases you will want toTitle.reset()
the current title first so your title won't be affected by a previous one.- Returns:
- A new empty title configuration.
- See Also:
-