Class ProxyServer


  • public abstract class ProxyServer
    extends Object
    • Constructor Detail

      • ProxyServer

        public ProxyServer()
    • Method Detail

      • setInstance

        public static void setInstance​(ProxyServer instance)
        Sets the proxy instance. This method may only be called once per an application.
        Parameters:
        instance - the new instance to set
      • getName

        public abstract String getName()
        Gets the name of the currently running proxy software.
        Returns:
        the name of this instance
      • getVersion

        public abstract String getVersion()
        Gets the version of the currently running proxy software.
        Returns:
        the version of this instance
      • getTranslation

        public abstract String getTranslation​(String name,
                                              Object... args)
        Gets a localized string from the .properties file.
        Parameters:
        name - translation name
        args - translation arguments
        Returns:
        the localized string
      • getLogger

        public abstract Logger getLogger()
        Gets the main logger which can be used as a suitable replacement for System.out and System.err.
        Returns:
        the Logger instance
      • getPlayers

        public abstract Collection<ProxiedPlayer> getPlayers()
        Return all players currently connected.
        Returns:
        all connected players
      • getPlayer

        public abstract ProxiedPlayer getPlayer​(String name)
        Gets a connected player via their unique username.
        Parameters:
        name - of the player
        Returns:
        their player instance
      • getPlayer

        public abstract ProxiedPlayer getPlayer​(UUID uuid)
        Gets a connected player via their UUID
        Parameters:
        uuid - of the player
        Returns:
        their player instance
      • getServers

        @Deprecated
        public abstract Map<String,​ServerInfo> getServers()
        Deprecated.
        The returned map is part of the proxy's internal state, and may be modified concurrently by the proxy. The safe alternative is getServersCopy().
        Return all servers registered to this proxy, keyed by name. Unlike the methods in ConfigurationAdapter.getServers(), this will not return a fresh map each time.
        Returns:
        all registered remote server destinations
      • getServersCopy

        public abstract Map<String,​ServerInfo> getServersCopy()
        Return all servers registered to this proxy, keyed by name. The returned map is an immutable snapshot of the actual server collection. It cannot be modified, and it will not change.
        Returns:
        all registered remote server destinations
      • getServerInfo

        public abstract ServerInfo getServerInfo​(String name)
        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

        public abstract PluginManager getPluginManager()
        Get the PluginManager associated with loading plugins and dispatching events. It is recommended that implementations use the provided PluginManager class.
        Returns:
        the plugin manager
      • getConfigurationAdapter

        public abstract ConfigurationAdapter getConfigurationAdapter()
        Returns the currently in use configuration adapter.
        Returns:
        the used configuration adapter
      • setConfigurationAdapter

        public abstract void setConfigurationAdapter​(ConfigurationAdapter adapter)
        Set the configuration adapter to be used. Must be called from Plugin.onLoad().
        Parameters:
        adapter - the adapter to use
      • getReconnectHandler

        public abstract ReconnectHandler getReconnectHandler()
        Get the currently in use reconnect handler.
        Returns:
        the in use reconnect handler
      • setReconnectHandler

        public abstract void setReconnectHandler​(ReconnectHandler handler)
        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

        public abstract void stop​(String reason)
        Gracefully mark this instance for shutdown.
        Parameters:
        reason - the reason for stopping. This will be shown to players.
      • registerChannel

        public abstract void registerChannel​(String channel)
        Register a channel for use with plugin messages. This is required by some server / client implementations.
        Parameters:
        channel - the channel to register
      • unregisterChannel

        public abstract void unregisterChannel​(String channel)
        Unregister a previously registered channel.
        Parameters:
        channel - the channel to unregister
      • getChannels

        public abstract Collection<String> getChannels()
        Get an immutable set of all registered plugin channels.
        Returns:
        registered plugin channels
      • getGameVersion

        @Deprecated
        public abstract String getGameVersion()
        Deprecated.
        Get the Minecraft version supported by this proxy.
        Returns:
        the supported Minecraft version
      • getProtocolVersion

        @Deprecated
        public abstract int 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 server
        address - connectable Minecraft address + port of the server
        motd - the motd when used as a forced server
        restricted - 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 server
        address - connectable Minecraft address + port of the server
        motd - the motd when used as a forced server
        restricted - whether the server info restricted property will be set
        Returns:
        the constructed instance
      • getConsole

        public abstract CommandSender 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

        public abstract File getPluginsFolder()
        Return the folder used to load plugins from.
        Returns:
        the folder used to load plugin
      • getScheduler

        public abstract TaskScheduler 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 than getPlayers() as it does not take a lock or make a copy.
        Returns:
        the current number of connected players
      • broadcast

        @Deprecated
        public abstract void broadcast​(String message)
        Deprecated.
        Send the specified message to the console and all connected players.
        Parameters:
        message - the message to broadcast
      • broadcast

        public abstract void broadcast​(BaseComponent... message)
        Send the specified message to the console and all connected players.
        Parameters:
        message - the message to broadcast
      • broadcast

        public abstract void broadcast​(BaseComponent message)
        Send the specified message to the console and all connected players.
        Parameters:
        message - the message to broadcast
      • getDisabledCommands

        public abstract Collection<String> getDisabledCommands()
        Gets the commands which are disabled and will not be run on this proxy.
        Returns:
        the set of disabled commands
      • getConfig

        public abstract ProxyConfig getConfig()
        Gets BungeeCord's core config.
        Returns:
        the config.
      • matchPlayer

        public abstract Collection<ProxiedPlayer> matchPlayer​(String match)
        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

        public abstract Title createTitle()
        Creates a new empty title configuration. In most cases you will want to Title.reset() the current title first so your title won't be affected by a previous one.
        Returns:
        A new empty title configuration.
        See Also:
        Title
      • getInstance

        public static ProxyServer getInstance()