org.bukkit
public interface Server extends PluginMessageRecipient
Modifier and Type | Field and Description |
---|---|
static String |
BROADCAST_CHANNEL_ADMINISTRATIVE
Used for all administrative messages, such as an operator using a
command.
|
static String |
BROADCAST_CHANNEL_USERS
Used for all announcement messages, such as informing users that a
player has joined.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addRecipe(Recipe recipe)
Adds a recipe to the crafting manager.
|
void |
banIP(String address)
Bans the specified address from the server
|
int |
broadcast(String message,
String permission)
Broadcasts the specified message to every user with the given
permission
|
int |
broadcastMessage(String message)
Broadcast a message to all players.
|
void |
clearRecipes()
Clears the list of crafting recipes.
|
void |
configureDbConfig(com.avaje.ebean.config.ServerConfig config)
Populates a given
ServerConfig with values attributes to this
server |
Inventory |
createInventory(InventoryHolder owner,
int size)
Creates an empty inventory of type
InventoryType.CHEST with the
specified size. |
Inventory |
createInventory(InventoryHolder owner,
int size,
String title)
Creates an empty inventory of type
InventoryType.CHEST with the
specified size and title. |
Inventory |
createInventory(InventoryHolder owner,
InventoryType type)
Creates an empty inventory of the specified type.
|
MapView |
createMap(World world)
Create a new map with an automatically assigned ID.
|
World |
createWorld(WorldCreator creator)
Creates or loads a world with the given name using the specified
options.
|
boolean |
dispatchCommand(CommandSender sender,
String commandLine)
Dispatches a command on the server, and executes it if found.
|
boolean |
getAllowEnd()
Gets whether this server allows the End or not.
|
boolean |
getAllowFlight()
Gets whether this server allows flying or not.
|
boolean |
getAllowNether()
Gets whether this server allows the Nether or not.
|
int |
getAmbientSpawnLimit()
Gets user-specified limit for number of ambient mobs that can spawn in
a chunk
|
int |
getAnimalSpawnLimit()
Gets user-specified limit for number of animals that can spawn in a
chunk
|
BanList |
getBanList(BanList.Type type)
Gets a BanList for the supplied BanList Type
|
Set<OfflinePlayer> |
getBannedPlayers()
Gets a set containing all banned players
|
String |
getBukkitVersion()
Gets the Bukkit version that this server is running.
|
Map<String,String[]> |
getCommandAliases()
Gets a list of command aliases defined in the server properties.
|
long |
getConnectionThrottle()
Gets the value of the connection throttle setting
|
ConsoleCommandSender |
getConsoleSender()
Gets the
ConsoleCommandSender that may be used as an input
source for this server. |
GameMode |
getDefaultGameMode()
Gets the default
GameMode for new players |
boolean |
getGenerateStructures()
Get generate-structures setting
|
HelpMap |
getHelpMap()
Gets the
HelpMap providing help topics for this server. |
int |
getIdleTimeout()
Gets the idle kick timeout.
|
String |
getIp()
Get the IP that this server is bound to or empty string if not
specified
|
Set<String> |
getIPBans()
Gets a set containing all current IPs that are banned
|
ItemFactory |
getItemFactory()
Gets the instance of the item factory (for
ItemMeta ). |
Logger |
getLogger()
Returns the primary logger associated with this server instance
|
MapView |
getMap(short id)
Deprecated.
Magic value
|
int |
getMaxPlayers()
Get the maximum amount of players which can login to this server
|
Messenger |
getMessenger()
Gets the
Messenger responsible for this server. |
int |
getMonsterSpawnLimit()
Gets user-specified limit for number of monsters that can spawn in a
chunk
|
String |
getMotd()
Gets the message that is displayed on the server list
|
String |
getName()
Gets the name of this server implementation
|
OfflinePlayer |
getOfflinePlayer(String name)
Gets the player by the given name, regardless if they are offline or
online.
|
OfflinePlayer[] |
getOfflinePlayers()
Gets every player that has ever played on this server.
|
boolean |
getOnlineMode()
Gets whether the Server is in online mode or not.
|
Player[] |
getOnlinePlayers()
Gets a list of all currently logged in players
|
Set<OfflinePlayer> |
getOperators()
Gets a set containing all player operators
|
Player |
getPlayer(String name)
Gets a player object by the given username
|
Player |
getPlayerExact(String name)
Gets the player with the exact given name, case insensitive
|
PluginCommand |
getPluginCommand(String name)
Gets a
PluginCommand with the given name or alias |
PluginManager |
getPluginManager()
Gets the PluginManager for interfacing with plugins
|
int |
getPort()
Get the game port that the server runs on
|
List<Recipe> |
getRecipesFor(ItemStack result)
Get a list of all recipes for a given item.
|
BukkitScheduler |
getScheduler()
Gets the Scheduler for managing scheduled events
|
ScoreboardManager |
getScoreboardManager()
Gets the instance of the scoreboard manager.
|
CachedServerIcon |
getServerIcon()
Gets an instance of the server's default server-icon.
|
String |
getServerId()
Get an ID of this server.
|
String |
getServerName()
Get the name of this server
|
ServicesManager |
getServicesManager()
Gets a services manager
|
String |
getShutdownMessage()
Gets the default message that is displayed when the server is stopped
|
int |
getSpawnRadius()
Gets the radius, in blocks, around each worlds spawn point to protect
|
int |
getTicksPerAnimalSpawns()
Gets default ticks per animal spawns value
|
int |
getTicksPerMonsterSpawns()
Gets the default ticks per monster spawns value
|
UnsafeValues |
getUnsafe()
Deprecated.
|
String |
getUpdateFolder()
Gets the name of the update folder.
|
File |
getUpdateFolderFile()
Gets the update folder.
|
String |
getVersion()
Gets the version string of this server implementation.
|
int |
getViewDistance()
Get the view distance from this server.
|
Warning.WarningState |
getWarningState()
Gets the current warning state for the server
|
int |
getWaterAnimalSpawnLimit()
Gets user-specified limit for number of water animals that can spawn in
a chunk
|
Set<OfflinePlayer> |
getWhitelistedPlayers()
Gets a list of whitelisted players
|
World |
getWorld(String name)
Gets the world with the given name
|
World |
getWorld(UUID uid)
Gets the world from the given Unique ID
|
File |
getWorldContainer()
Gets the folder that contains all of the various
World s. |
List<World> |
getWorlds()
Gets a list of all worlds on this server
|
String |
getWorldType()
Get world type (level-type setting) for default world
|
boolean |
hasWhitelist()
Gets whether this server has a whitelist or not.
|
boolean |
isHardcore()
Gets whether the server is in hardcore mode or not.
|
boolean |
isPrimaryThread()
Returns true if the current
Thread is the server's primary
thread |
CachedServerIcon |
loadServerIcon(BufferedImage image)
Creates a cached server-icon for the specific image.
|
CachedServerIcon |
loadServerIcon(File file)
Loads an image from a file, and returns a cached image for the specific
server-icon.
|
List<Player> |
matchPlayer(String name)
Attempts to match any players with the given name, and returns a list
of all possibly matches
|
Iterator<Recipe> |
recipeIterator()
Get an iterator through the list of crafting recipes.
|
void |
reload()
Reloads the server, refreshing settings and plugin information
|
void |
reloadWhitelist()
Reloads the whitelist from disk
|
void |
resetRecipes()
Resets the list of crafting recipes to the default.
|
void |
savePlayers()
Writes loaded players to disk
|
void |
setDefaultGameMode(GameMode mode)
Sets the default
GameMode for new players |
void |
setIdleTimeout(int threshold)
Set the idle kick timeout.
|
void |
setSpawnRadius(int value)
Sets the radius, in blocks, around each worlds spawn point to protect
|
void |
setWhitelist(boolean value)
Sets the whitelist on or off
|
void |
shutdown()
Shutdowns the server, stopping everything.
|
void |
unbanIP(String address)
Unbans the specified address from the server
|
boolean |
unloadWorld(String name,
boolean save)
Unloads a world with the given name.
|
boolean |
unloadWorld(World world,
boolean save)
Unloads the given world.
|
boolean |
useExactLoginLocation()
Gets whether to use vanilla (false) or exact behaviour (true).
|
getListeningPluginChannels, sendPluginMessage
static final String BROADCAST_CHANNEL_ADMINISTRATIVE
static final String BROADCAST_CHANNEL_USERS
String getName()
String getVersion()
String getBukkitVersion()
Player[] getOnlinePlayers()
int getMaxPlayers()
int getPort()
int getViewDistance()
String getIp()
String getServerName()
String getServerId()
String getWorldType()
boolean getGenerateStructures()
boolean getAllowEnd()
boolean getAllowNether()
boolean hasWhitelist()
void setWhitelist(boolean value)
value
- true if whitelist is on, otherwise falseSet<OfflinePlayer> getWhitelistedPlayers()
void reloadWhitelist()
int broadcastMessage(String message)
This is the same as calling broadcast(java.lang.String,
java.lang.String)
to BROADCAST_CHANNEL_USERS
message
- the messageString getUpdateFolder()
The update folder name is relative to the plugins folder.
File getUpdateFolderFile()
long getConnectionThrottle()
int getTicksPerAnimalSpawns()
Example Usage:
Note: If set to 0, animal spawning will be disabled. We recommend using spawn-animals to control this instead.
Minecraft default: 400.
int getTicksPerMonsterSpawns()
Example Usage:
Note: If set to 0, monsters spawning will be disabled. We recommend using spawn-monsters to control this instead.
Minecraft default: 1.
Player getPlayer(String name)
This method may not return objects for offline players
name
- Name to look upPlayer getPlayerExact(String name)
name
- Exact name of the player to retrieveList<Player> matchPlayer(String name)
This list is not sorted in any particular order. If an exact match is found, the returned list will only contain a single result.
name
- Name to matchPluginManager getPluginManager()
BukkitScheduler getScheduler()
ServicesManager getServicesManager()
World createWorld(WorldCreator creator)
If the world is already loaded, it will just return the equivalent of getWorld(creator.name()).
creator
- The options to use when creating the world.boolean unloadWorld(String name, boolean save)
name
- Name of the world to unloadsave
- Whether to save the chunks before unloading.boolean unloadWorld(World world, boolean save)
world
- The world to unloadsave
- Whether to save the chunks before unloading.World getWorld(String name)
name
- Name of the world to retrieveWorld getWorld(UUID uid)
uid
- Unique ID of the world to retrieve.@Deprecated MapView getMap(short id)
id
- ID of the map to get.MapView createMap(World world)
world
- The world the map will belong to.void reload()
Logger getLogger()
PluginCommand getPluginCommand(String name)
PluginCommand
with the given name or aliasname
- Name of the command to retrievevoid savePlayers()
boolean dispatchCommand(CommandSender sender, String commandLine) throws CommandException
sender
- The apparent sender of the commandcommandLine
- command + arguments. Example: "test abc 123"CommandException
- Thrown when the executor for the given command
fails with an unhandled exceptionvoid configureDbConfig(com.avaje.ebean.config.ServerConfig config)
ServerConfig
with values attributes to this
serverconfig
- ServerConfig to populateboolean addRecipe(Recipe recipe)
recipe
- The recipe to add.List<Recipe> getRecipesFor(ItemStack result)
result
- The item whose recipes you wantIterator<Recipe> recipeIterator()
void clearRecipes()
void resetRecipes()
Map<String,String[]> getCommandAliases()
int getSpawnRadius()
void setSpawnRadius(int value)
value
- New spawn radius, or 0 if noneboolean getOnlineMode()
boolean getAllowFlight()
boolean isHardcore()
boolean useExactLoginLocation()
void shutdown()
int broadcast(String message, String permission)
message
- Message to broadcastpermission
- Permission the users must have to receive the broadcastOfflinePlayer getOfflinePlayer(String name)
This will return an object even if the player does not exist. To this method, all players will exist.
name
- Name of the player to retrieveSet<String> getIPBans()
void banIP(String address)
address
- IP address to banvoid unbanIP(String address)
address
- IP address to unbanSet<OfflinePlayer> getBannedPlayers()
BanList getBanList(BanList.Type type)
type
- The BanList Type to fetch, cannot be nullSet<OfflinePlayer> getOperators()
GameMode getDefaultGameMode()
GameMode
for new playersvoid setDefaultGameMode(GameMode mode)
GameMode
for new playersmode
- New game modeConsoleCommandSender getConsoleSender()
ConsoleCommandSender
that may be used as an input
source for this server.File getWorldContainer()
World
s.OfflinePlayer[] getOfflinePlayers()
Messenger getMessenger()
Messenger
responsible for this server.HelpMap getHelpMap()
HelpMap
providing help topics for this server.Inventory createInventory(InventoryHolder owner, InventoryType type)
InventoryType.CHEST
, the new inventory has a size of 27; otherwise the
new inventory has the normal size for its type.owner
- The holder of the inventory; can be null if there's no
holder.type
- The type of inventory to create.Inventory createInventory(InventoryHolder owner, int size)
InventoryType.CHEST
with the
specified size.owner
- The holder of the inventory; can be null if there's no
holder.size
- The size of inventory to create; must be a multiple of 9.IllegalArgumentException
- If the size is not a multiple of 9.Inventory createInventory(InventoryHolder owner, int size, String title)
InventoryType.CHEST
with the
specified size and title.owner
- The holder of the inventory; can be null if there's no
holder.size
- The size of inventory to create; must be a multiple of 9.title
- The title of the inventory, to be displayed when it is
viewed.IllegalArgumentException
- If the size is not a multiple of 9.int getMonsterSpawnLimit()
int getAnimalSpawnLimit()
int getWaterAnimalSpawnLimit()
int getAmbientSpawnLimit()
boolean isPrimaryThread()
Thread
is the server's primary
threadString getMotd()
String getShutdownMessage()
Warning.WarningState getWarningState()
ItemFactory getItemFactory()
ItemMeta
).ItemFactory
ScoreboardManager getScoreboardManager()
This will only exist after the first world has loaded.
CachedServerIcon getServerIcon()
CachedServerIcon loadServerIcon(File file) throws IllegalArgumentException, Exception
Size and type are implementation defined. An incompatible file is
guaranteed to throw an implementation-defined Exception
.
file
- the file to load the fromServerListPingEvent.setServerIcon(CachedServerIcon)
IllegalArgumentException
- if image is nullException
- if the image does not meet current server server-icon
specificationsCachedServerIcon loadServerIcon(BufferedImage image) throws IllegalArgumentException, Exception
Size and type are implementation defined. An incompatible file is
guaranteed to throw an implementation-defined Exception
.
image
- the image to useServerListPingEvent.setServerIcon(CachedServerIcon)
IllegalArgumentException
- if image is nullException
- if the image does not meet current server
server-icon specificationsvoid setIdleTimeout(int threshold)
A value of 0 will disable the idle kick timeout.
threshold
- the idle timeout in minutesint getIdleTimeout()
@Deprecated UnsafeValues getUnsafe()
UnsafeValues
Copyright © 2014. All rights reserved.