Package net.md_5.bungee.api
Class ProxyServer
java.lang.Object
net.md_5.bungee.api.ProxyServer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidSend the specified message to the console and all connected players.abstract ServerInfoconstructServerInfo(String name, InetSocketAddress address, String motd, boolean restricted) Factory method to construct an implementation specific server info instance.abstract ConfigurationAdapterReturns the currently in use configuration adapter.abstract CommandSenderReturns the console overlord for this proxy.abstract Collection<String> Gets the commands which are disabled and will not be run on this proxy.abstract StringGet the Minecraft version supported by this proxy.abstract LoggerGets the main logger which can be used as a suitable replacement forSystem.outandSystem.err.abstract StringgetName()Gets the name of the currently running proxy software.abstract intGet the current number of connected users.abstract ProxiedPlayerGets a connected player via their unique username.abstract Collection<ProxiedPlayer> Return all players currently connected.abstract PluginManagerGet thePluginManagerassociated with loading plugins and dispatching events.abstract FileReturn the folder used to load plugins from.abstract byteGet the Minecraft protocol version supported by this proxy.abstract ReconnectHandlerGet the currently in use reconnect handler.abstract TaskSchedulerGet the scheduler instance for this proxy.abstract ServerInfogetServerInfo(String name) Gets the server info of a server.abstract Map<String, ServerInfo> Return all servers registered to this proxy, keyed by name.abstract StringgetTranslation(String name, Object... args) Gets a localized string from the .properties file.abstract StringGets the version of the currently running proxy software.abstract voidSet the configuration adapter to be used.static voidsetInstance(ProxyServer instance) Sets the proxy instance.abstract voidsetReconnectHandler(ReconnectHandler handler) Sets the reconnect handler to be used for subsequent connections.abstract voidstart()Start this instance so that it may accept connections.abstract voidstop()Gracefully mark this instance for shutdown.
-
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.- Returns:
- the localized string
-
getLogger
Gets the main logger which can be used as a suitable replacement forSystem.outandSystem.err.- Returns:
- the
Loggerinstance
-
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
-
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 thePluginManagerassociated 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. -
start
Start this instance so that it may accept connections.- Throws:
Exception- any exception thrown during startup causing the instance to fail to boot
-
getGameVersion
Get the Minecraft version supported by this proxy.- Returns:
- the supported Minecraft version
-
getProtocolVersion
public abstract byte getProtocolVersion()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
-
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
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
-