Interface Server

All Superinterfaces:
Audience, ForwardingAudience, Pointered

public interface Server extends ForwardingAudience
  • Method Details

    • getName

      @Contract(pure=true) String getName()
      Gets the server name.
      Returns:
      server name
      Since:
      0.1.0
    • minecraftVersion

      String minecraftVersion()
    • protocolVersion

      int protocolVersion()
    • scheduler

      RegionizedScheduler scheduler()
    • commands

      CommandRegistry commands()
    • events

      EventBus events()
    • favicon

      @Contract(pure=true) Optional<Favicon> favicon()
      Gets the server's favicon shown in the status ping.
      Returns:
      the server favicon
      Since:
      0.1.0
    • favicon

      @Contract(mutates="this") void favicon(Favicon favicon)
      Sets the server's favicon shown in the status ping.
      Parameters:
      favicon - the server favicon
      Since:
      0.1.0
    • description

      @Contract(pure=true) Component description()
      Gets the server description shown in the status ping.
      Returns:
      server description
      Since:
      0.1.0
    • description

      @Contract(mutates="this") void description(Component description)
      Sets the server description shown in the status ping.
      Parameters:
      description - server description
      Since:
      0.1.0
    • maxPlayers

      @Contract(pure=true) int maxPlayers()
      Gets the maximum player count shown in the status ping.
      Returns:
      maximum player count
      Since:
      0.1.0
    • maxPlayers

      @Contract(mutates="this") void maxPlayers(int maxPlayers)
      Sets the maximum player count shown in the status ping.
      Parameters:
      maxPlayers - maximum player count
      Since:
      0.1.0
    • playerCount

      @Contract(pure=true) int playerCount()
      Gets the current online player count.
      Returns:
      online player count
      Since:
      0.1.0
    • services

      ServiceRegistry services()
    • plugins

      PluginManager plugins()
    • permissions

      PermissionRegistry permissions()
      Gets the server-wide permission registry.
      Returns:
      the permission registry
      Since:
      0.1.0
    • worlds

      Collection<? extends World> worlds()
    • world

      Optional<? extends World> world(Key key)
    • createWorld

      @Contract(mutates="this") World createWorld(WorldBuilder spec)
      Creates a new world from the given specification.

      If a world is already registered under the spec's key, that existing world is returned unchanged and the rest of the spec (seed, generator) is ignored; this call is therefore idempotent with respect to the world key. Otherwise a new world is registered using the spec's generator, or the server's built-in default generator when the spec supplies none.

      The returned world is immediately usable: it participates in ticking and its chunks are generated on demand through the configured generator.

      Parameters:
      spec - the description of the world to create
      Returns:
      the newly created world, or the existing world sharing the same key
      Since:
      0.1.0
    • createWorld

      @Contract(mutates="this") default World createWorld(Key key, WorldGenerator generator)
      Parameters:
      key - the world key
      generator - the chunk generator to drive the new world
      Returns:
      the newly created world, or the existing world sharing the same key
      Since:
      0.1.0
    • unloadWorld

      @Contract(mutates="this") boolean unloadWorld(Key key, boolean save)
      Unloads the world identified by key, optionally saving it to disk first.

      Unloading removes the world from worlds() and stops it being ticked; entities it held are released. The call is refused, returning false without side effects, when:

      • no world is registered under key;
      • the world is the server's primary world, which must always remain loaded; or
      • players are still present in the world — relocate them with another world first.
      Parameters:
      key - the key of the world to unload
      save - whether to save the world before unloading it
      Returns:
      true if the world was unloaded, false if the call was refused
      Since:
      0.1.0
    • onlinePlayers

      Collection<? extends Player> onlinePlayers()
    • player

      Optional<? extends Player> player(UUID uuid)
    • player

      Optional<? extends Player> player(String name)
    • offlinePlayers

      @Contract(pure=true) OfflinePlayers offlinePlayers()
    • isRunning

      boolean isRunning()
    • shutdown

      void shutdown()
    • translationStore

      TranslationStore translationStore()