Interface ProxyServer

  • All Superinterfaces:
    Audience, net.kyori.adventure.pointer.Pointered

    public interface ProxyServer
    extends Audience
    Provides an interface to a Minecraft server proxy.
    • Method Detail

      • shutdown

        void shutdown​(Component reason)
        Shuts down the proxy, kicking players with the specified reason.
        reason - message to kick online players with
      • shutdown

        void shutdown()
        Shuts down the proxy, kicking players with the default reason.
      • getPlayer

        Optional<Player> getPlayer​(String username)
        Retrieves the player currently connected to this proxy by their Minecraft username. The search is case-insensitive.
        username - the username to search for
        an Optional with the player, which may be empty
      • getPlayer

        Optional<Player> getPlayer​(UUID uuid)
        Retrieves the player currently connected to this proxy by their Minecraft UUID.
        uuid - the UUID
        an Optional with the player, which may be empty
      • getAllPlayers

        Collection<Player> getAllPlayers()
        Retrieves all players currently connected to this proxy. This call may or may not be a snapshot of all players online.
        the players online on this proxy
      • getPlayerCount

        int getPlayerCount()
        Returns the number of players currently connected to this proxy.
        the players on this proxy
      • getServer

        Optional<RegisteredServer> getServer​(String name)
        Retrieves a registered RegisteredServer instance by its name. The search is case-insensitive.
        name - the name of the server
        the registered server, which may be empty
      • matchPlayer

        Collection<Player> matchPlayer​(String partialName)
        Matches all Players whose names start with the provided partial name.
        partialName - the partial name to check for
        a collection of mathed Players
      • registerServer

        RegisteredServer registerServer​(ServerInfo server)
        Registers a server with this proxy. A server with this name should not already exist.
        server - the server to register
        the newly registered server
      • unregisterServer

        void unregisterServer​(ServerInfo server)
        Unregisters this server from the proxy.
        server - the server to unregister
      • getConsoleCommandSource

        ConsoleCommandSource getConsoleCommandSource()
        Returns an instance of CommandSource 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 own CommandSource instead of using the console invoker.
        the console command invoker
      • getScheduler

        Scheduler getScheduler()
        Gets the Scheduler instance.
        the scheduler instance
      • getBoundAddress

        InetSocketAddress getBoundAddress()
        Gets the address that this proxy is bound to. This does not necessarily indicate the external IP address of the proxy.
        the address the proxy is bound to
      • getVersion

        ProxyVersion getVersion()
        Returns the version of the proxy.
        the proxy version
      • createBossBar

        @NonNull BossBar createBossBar​(net.kyori.text.Component title,
                                       @NonNull BossBarColor color,
                                       @NonNull BossBarOverlay overlay,
                                       float progress)
        Use BossBar instead
        Creates a new BossBar.
        title - boss bar title
        color - boss bar color
        overlay - boss bar overlay
        progress - boss bar progress
        a completely new and fresh boss bar
      • createResourcePackBuilder

        ResourcePackInfo.Builder createResourcePackBuilder​(String url)
        Creates a builder to build a ResourcePackInfo instance for use with Player.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.

        url - The url where the resource pack can be found
        a ResourcePackInfo builder