public interface Server
| Modifier and Type | Method and Description | 
|---|---|
CompletableFuture<Optional<WorldProperties>> | 
copyWorld(WorldProperties worldProperties,
         String copyName)
Creates a world copy asynchronously using the new name given and returns
 the new world properties if the copy was possible. 
 | 
WorldProperties | 
createWorldProperties(String folderName,
                     WorldArchetype archetype)
Creates a new  
WorldProperties from the given
 WorldArchetype. | 
CompletableFuture<Boolean> | 
deleteWorld(WorldProperties worldProperties)
Deletes the provided world's files asynchronously from the disk. 
 | 
Collection<WorldProperties> | 
getAllWorldProperties()
Gets the properties of all worlds, loaded or otherwise. 
 | 
Optional<InetSocketAddress> | 
getBoundAddress()
Gets the bound  
InetSocketAddress from where this server is
 accepting connections. | 
MessageChannel | 
getBroadcastChannel()
Gets the message channel that server-wide messages are sent through. 
 | 
ChunkLayout | 
getChunkLayout()
Returns information about the chunk layout used by this server
 implementation. 
 | 
ChunkTicketManager | 
getChunkTicketManager()
Gets the ChunkTicketManager used for requesting tickets to force load
 chunks. 
 | 
ConsoleSource | 
getConsole()
Gets the command source used for commands coming from this server's
 console. 
 | 
Optional<ResourcePack> | 
getDefaultResourcePack()
Gets the default resource pack. 
 | 
Optional<WorldProperties> | 
getDefaultWorld()
Gets the properties of default world. 
 | 
String | 
getDefaultWorldName()
Gets the default  
World name that the server creates and loads. | 
GameProfileManager | 
getGameProfileManager()
Gets the  
GameProfileManager for resolving game profiles. | 
int | 
getMaxPlayers()
Gets the max players allowed on this server. 
 | 
Text | 
getMotd()
Gets the default message that is displayed in the server list of the
 client. 
 | 
boolean | 
getOnlineMode()
Tests if this server is set to online mode. 
 | 
Collection<Player> | 
getOnlinePlayers()
Gets the  
Players currently online. | 
Optional<Player> | 
getPlayer(String name)
Gets a  
Player by their name. | 
Optional<Player> | 
getPlayer(UUID uniqueId)
Gets a  
Player by their UUID. | 
int | 
getPlayerIdleTimeout()
Gets the player idle timeout, in minutes. 
 | 
int | 
getRunningTimeTicks()
Gets the time, in ticks, since this server began running for the current
 session. 
 | 
Optional<Scoreboard> | 
getServerScoreboard()
Gets the 'server' scoreboard. 
 | 
double | 
getTicksPerSecond()
Gets the current ticks per second. 
 | 
Collection<WorldProperties> | 
getUnloadedWorlds()
Gets the properties of all unloaded worlds. 
 | 
Optional<World> | 
getWorld(String worldName)
Gets a loaded  
World by name, if it exists. | 
Optional<World> | 
getWorld(UUID uniqueId)
 | 
Optional<WorldProperties> | 
getWorldProperties(String worldName)
Gets the  
WorldProperties of a world. | 
Optional<WorldProperties> | 
getWorldProperties(UUID uniqueId)
Gets the  
WorldProperties of a world. | 
Collection<World> | 
getWorlds()
Gets all currently loaded  
Worlds. | 
boolean | 
hasWhitelist()
Tests if the server has a whitelist enabled. 
 | 
boolean | 
isMainThread()
Checks if the current thread matches the main thread of the server. 
 | 
Optional<World> | 
loadWorld(String worldName)
Loads a  
World from the default storage container. | 
Optional<World> | 
loadWorld(UUID uniqueId)
Loads a  
World from the default storage container. | 
Optional<World> | 
loadWorld(WorldProperties properties)
Loads a  
World from the default storage container. | 
Optional<WorldProperties> | 
renameWorld(WorldProperties worldProperties,
           String newName)
Renames an unloaded world. 
 | 
boolean | 
saveWorldProperties(WorldProperties properties)
Persists the given  
WorldProperties to the world storage for it,
 updating any modified values. | 
void | 
setBroadcastChannel(MessageChannel channel)
Sets the channel that server-wide messages should be sent through. 
 | 
void | 
setHasWhitelist(boolean enabled)
Sets whether the server is utilizing a whitelist. 
 | 
void | 
setPlayerIdleTimeout(int timeout)
Sets the player idle timeout, in minutes. 
 | 
void | 
shutdown()
Shuts down the server, and kicks all players with the default kick
 message. 
 | 
void | 
shutdown(Text kickMessage)
Shuts down the server, and kicks all players with the given message. 
 | 
boolean | 
unloadWorld(World world)
Unloads a  
World, if there are any connected players in the given
 world then no operation will occur. | 
Collection<Player> getOnlinePlayers()
Players currently online.Collection of online playersint getMaxPlayers()
Optional<Player> getPlayer(UUID uniqueId)
Player by their UUID.uniqueId - The UUID to get the player fromPlayer or empty if not foundOptional<Player> getPlayer(String name)
Player by their name.
 This only works for online players.
Note: Do not use names for persistent storage, the Notch of today may not be the Notch of yesterday.
name - The name to get the player fromPlayer or empty if not foundCollection<World> getWorlds()
Worlds.Collection<WorldProperties> getUnloadedWorlds()
Collection<WorldProperties> getAllWorldProperties()
Optional<World> getWorld(UUID uniqueId)
uniqueId - UUID to lookupOptional<World> getWorld(String worldName)
World by name, if it exists.worldName - Name to lookupOptional<WorldProperties> getDefaultWorld()
String getDefaultWorldName()
World name that the server creates and loads.Optional<World> loadWorld(String worldName)
World from the default storage container. If a world with
 the given name is already loaded then it is returned instead.worldName - The name to lookupOptional<World> loadWorld(UUID uniqueId)
World from the default storage container. If a world with
 the given UUID is already loaded then it is returned instead.uniqueId - The UUID to lookupOptional<World> loadWorld(WorldProperties properties)
World from the default storage container. If the world
 associated with the given properties is already loaded then it is
 returned instead.properties - The properties of the world to loadOptional<WorldProperties> getWorldProperties(String worldName)
WorldProperties of a world. If a world with the given
 name is loaded then this is equivalent to calling
 World.getProperties(). However, if no loaded world is found then
 an attempt will be made to match unloaded worlds.worldName - The name to lookupOptional<WorldProperties> getWorldProperties(UUID uniqueId)
WorldProperties of a world. If a world with the given
 UUID is loaded then this is equivalent to calling
 World.getProperties(). However, if no loaded world is found then
 an attempt will be made to match unloaded worlds.uniqueId - The UUID to lookupboolean unloadWorld(World world)
World, if there are any connected players in the given
 world then no operation will occur.
 A world which is unloaded will be removed from memory. However if it
 is still enabled according to WorldProperties.isEnabled() then it
 will be loaded again if the server is restarted.
world - The world to unloadWorldProperties createWorldProperties(String folderName, WorldArchetype archetype) throws IOException
WorldProperties from the given
 WorldArchetype. For the creation of the WorldArchetype please see
 WorldArchetype.Builder.
 If the World exists at the folder name given, the properties
 representing that folder name are returned instead.
Although the world is created it is not loaded at this time. Please see one of the following methods for loading the world.
folderName - The name of the folder for the worldarchetype - The archetype for creationIOException - If there are any io issues creating the properties
      fileCompletableFuture<Optional<WorldProperties>> copyWorld(WorldProperties worldProperties, String copyName)
If the world is already loaded then the following will occur:
worldProperties - The world properties to copycopyName - The name for copied worldOptional containing the properties of the new world
         instance, if the copy was successfulOptional<WorldProperties> renameWorld(WorldProperties worldProperties, String newName)
worldProperties - The world properties to renamenewName - The name that should be used as a replacement for the
        current world nameOptional containing the new WorldProperties
         if the rename was successfulCompletableFuture<Boolean> deleteWorld(WorldProperties worldProperties)
worldProperties - The world properties to deleteboolean saveWorldProperties(WorldProperties properties)
WorldProperties to the world storage for it,
 updating any modified values.properties - The world properties to saveOptional<Scoreboard> getServerScoreboard()
The server scoreboard is used with the Vanilla /scoreboard command, automatic score updating through criteria, and other things.
The server scoreboard may not be available if dimension 0 is not yet loaded. In Vanilla, this will only occur when the server is first starting, as dimension 0 is normally always loaded.
ChunkLayout getChunkLayout()
int getRunningTimeTicks()
This value is not persisted across server restarts, it is set to zero each time the server starts.
MessageChannel getBroadcastChannel()
void setBroadcastChannel(MessageChannel channel)
channel - The broadcast channelOptional<InetSocketAddress> getBoundAddress()
InetSocketAddress from where this server is
 accepting connections.boolean hasWhitelist()
void setHasWhitelist(boolean enabled)
enabled - True to enable the whitelist, false to disableboolean getOnlineMode()
Text getMotd()
void shutdown()
For the Sponge implementation on the client, this will trigger the Integrated Server to shutdown a tick later.
void shutdown(Text kickMessage)
kickMessage - The message to kick players withConsoleSource getConsole()
ChunkTicketManager getChunkTicketManager()
GameProfileManager getGameProfileManager()
GameProfileManager for resolving game profiles.double getTicksPerSecond()
Note: The server aims to limit itself at 20 ticks per second. Lower ticks per second may elude to the server taking more time to process information per tick. Examples of overburdening the server per tick include spawning 10,000 cows in a small area.
Optional<ResourcePack> getDefaultResourcePack()
int getPlayerIdleTimeout()
A return value of 0 disables the player idle timeout.
void setPlayerIdleTimeout(int timeout)
A value of 0 disables the player idle timeout.
timeout - The player idle timeoutboolean isMainThread()