public interface Server
| Modifier and Type | Interface and Description |
|---|---|
static class |
Server.Type
The server type
|
| Modifier and Type | Method and Description |
|---|---|
void |
addArea(Area area)
Adds an
Area to the server. |
void |
banPlayer(long playerUID,
java.lang.String reason,
int duration)
Bans the player with the specified UID for a given amount of time.
|
void |
broadcastTextMessage(java.lang.String message)
Broadcasts a text message, i.e. send it to all players.
|
void |
broadcastYellMessage(java.lang.String message)
Broadcasts a yell message, i.e. send it to all players.
|
Player |
findNearestPlayer(Vector3f position)
Gets the player who has the shortest distance to a world position.
|
java.util.Collection<Area> |
getAllAreas()
Gets a collection containing all
Areas that are currently
registered with the server. |
java.util.Collection<CustomImage> |
getAllCustomImages()
Gets a list containing all custom images (creates a new list).
|
java.util.Collection<CustomImage> |
getAllCustomImages(long playerUID)
Gets a list containing all custom images which were uploaded by a particular player.
|
java.util.Collection<java.lang.String> |
getAllPermissionGroups()
Gets all available permission group names.
|
java.util.Collection<Player> |
getAllPlayers()
Gets a collection containing all players that are currently connected to the server.
|
int |
getBuild()
Gets the current build of the game as an int (e.g. 201807210).
|
Weather |
getCurrentWeather()
Gets the current weather.
|
CustomImage |
getCustomImage(int id)
Gets a custom image.
|
CustomItem |
getCustomItem(java.lang.String uuid)
Gets the registered custom item with the specified UUID.
|
CustomRecipe |
getCustomRecipe(java.lang.String targetUUID,
int targetVariation)
Gets the custom recipe which corresponds to the provided item UUID and variation.
|
Inventory |
getDefaultSpawnInventory()
Gets the default spawn inventory (i.e. the items you always spawn with).
|
Vector3f |
getDefaultSpawnPosition()
Gets the global default spawn position.
|
Quaternion |
getDefaultSpawnRotation()
Gets the default spawn rotation.
|
Time |
getGameTime()
Gets the internal time object which manages the ingame time and date.
|
int |
getGameTime(Time.Unit unit)
Gets the current ingame time.
|
float |
getGameTimeSpeed()
Gets the game time speed.
|
java.lang.String |
getIP()
Gets the server ip.
|
int |
getMaxPlayerCount()
Gets the maximum amount of players allowed on this server.
|
java.lang.String |
getName()
Gets the server name.
|
Weather |
getNextWeather()
Gets the next weather type.
|
java.lang.String |
getOption(java.lang.String key)
Gets a server option from the "server.properties" file.
|
Player |
getPlayer(int playerid)
Gets a player object representing the player with the provided playerid.
|
Player |
getPlayer(long playerUID)
Gets a player object representing the player with the provided unique ID
(for Steam users, this is the SteamID64).
|
Player |
getPlayer(java.lang.String playername)
Gets a player object representing the player with the provided playername.
|
int |
getPlayerCount()
Gets the amount of players that are currently connected to this server.
|
int |
getPort()
Gets the server port.
|
float |
getRunningTime()
Gets the amount of seconds that have passed since serverstart.
|
long |
getSteamID()
Gets the SteamID64 of the server.
|
Server.Type |
getType()
Gets the current type of the server.
|
java.lang.String |
getVersion()
Gets the current game version as a String (e.g. "0.9.1.5").
|
float |
getWeatherTransition()
Gets the transition between the current weather type (0.0) and the next
weather type (1.0).
|
boolean |
isPassworded()
Gets whether or not this server is password protected.
|
boolean |
isPlayerAdmin(long playerUID)
Gets whether the particular player is an admin or not.
|
boolean |
isPlayerBanned(long playerUID)
Gets whether the particular player (who has the provided UID) is banned or not.
|
boolean |
isPlayerConnected(int playerid)
Gets whether or not this player is connected to the server.
|
boolean |
isPlayerConnected(java.lang.String playername)
Gets whether or not this player is connected to the server.
|
boolean |
isSteam()
Gets whether or not this is a Steam server.
|
boolean |
isWeatherEnabled()
Gets whether or not the weather is enabled.
|
void |
registerCustomItem(CustomItem item)
Registers a new custom item.
|
void |
registerCustomRecipe(CustomRecipe recipe)
Registers a new custom crafting recipe.
|
void |
removeArea(Area area)
Removes an
Area that has been added to the server previously. |
void |
removeCustomImage(int id)
Deletes a custom image (and also removes all placed instances in the world).
|
void |
saveAll()
Forces the server to save all pending changes (world, players, npcs, storages etc).
|
void |
saveNpcs()
Forces the server to save all npcs.
|
void |
savePlayers()
Forces the server to save all players and inventories.
|
void |
saveStorages()
Forces the server to save all storages (chests etc).
|
void |
sendInputCommand(java.lang.String input)
Sends an input command to the InputStream (System.in) of the server.
|
void |
setDefaultSpawnInventory(Inventory inventory)
Sets the default spawn inventory (i.e. the items you always spawn with).
|
void |
setDefaultSpawnPosition(float x,
float y,
float z)
Sets the global default spawn position.
|
void |
setDefaultSpawnPosition(Vector3f position)
Sets the global default spawn position.
|
void |
setDefaultSpawnRotation(float pitch,
float yaw,
float roll)
Sets the default spawn rotation.
|
void |
setDefaultSpawnRotation(Quaternion quaternion)
Sets the default spawn rotation.
|
void |
setGameTime(int hour,
int min)
Sets the ingame time.
|
void |
setGameTimeSpeed(float value)
Changes the game time speed.
|
void |
setWeather(Weather newWeather,
boolean instant)
Sets the weather.
|
void |
setWeatherEnabled(boolean enabled)
Enables or disables the weather.
|
void |
shutdown()
Forces the server to shutdown gracefully.
|
void |
unbanPlayer(long playerUID)
Unbans the player with the specified name (i.e. removes him from the ban list).
|
Server.Type getType()
boolean isSteam()
getSteamID()long getSteamID()
isSteam()java.lang.String getName()
java.lang.String getIP()
int getPort()
boolean isPassworded()
float getRunningTime()
java.lang.String getOption(java.lang.String key)
key - the name of the option key.java.util.Collection<java.lang.String> getAllPermissionGroups()
java.lang.String getVersion()
int getBuild()
getVersion()void saveAll()
void savePlayers()
void saveStorages()
void saveNpcs()
void sendInputCommand(java.lang.String input)
input - the input command.void shutdown()
System.exit(0); instead.void setDefaultSpawnPosition(Vector3f position)
position - the new spawn position.void setDefaultSpawnPosition(float x,
float y,
float z)
x - the new x coordinate.y - the new y coordinate.z - the new z coordinate.Vector3f getDefaultSpawnPosition()
void setDefaultSpawnRotation(Quaternion quaternion)
Quaternion.IDENTITY
if the spawn rotation should face towards north.quaternion - the spawn rotation as a Quaternion.void setDefaultSpawnRotation(float pitch,
float yaw,
float roll)
pitch - pitch (euler x)yaw - yaw (euler y)roll - roll (euler z)Quaternion getDefaultSpawnRotation()
void setDefaultSpawnInventory(Inventory inventory)
inventory - the default spawn inventory.Inventory getDefaultSpawnInventory()
void setGameTime(int hour,
int min)
hour - hours (0-23)min - minutes (0-59)int getGameTime(Time.Unit unit)
unit - the time unit you want to get (e.g. hours, minutes, days etc)Time getGameTime()
void setGameTimeSpeed(float value)
value - the amount of realtime seconds one ingame minute should take.float getGameTimeSpeed()
void setWeather(Weather newWeather, boolean instant)
newWeather - the new weather type.instant - if set to true, the weather will change instantly. Otherwise,
there will be a smooth transition between the current weather type and the new
weather type.Weather getCurrentWeather()
Weather getNextWeather()
void setWeatherEnabled(boolean enabled)
enabled - true to enable weather, false to disable it.boolean isWeatherEnabled()
float getWeatherTransition()
int getPlayerCount()
int getMaxPlayerCount()
boolean isPlayerConnected(int playerid)
playerid - the player ID (not the database ID).boolean isPlayerConnected(java.lang.String playername)
playername - the name of the player.Player getPlayer(int playerid)
playerid - the player ID (neither the database ID nor the unique ID)Player getPlayer(long playerUID)
playerUID - the unique player ID.Player getPlayer(java.lang.String playername)
playername - the name of the player.java.util.Collection<Player> getAllPlayers()
boolean isPlayerBanned(long playerUID)
playerUID - the unique id of the player (for Steam users, it's the SteamID64).boolean isPlayerAdmin(long playerUID)
playerUID - the unique id of the player (for Steam users, it's the SteamID64).void banPlayer(long playerUID,
java.lang.String reason,
int duration)
playerUID - the unique id of the player you want to ban
(for Steam users, it's the SteamID64).reason - a string containing the reason why the player was banned.duration - the duration (in minutes) how long the player will be banned. Use
'-1' to ban the player permanently.void unbanPlayer(long playerUID)
playerUID - the unique id of the player you want to unban
(for Steam users, it's the SteamID64).Player findNearestPlayer(Vector3f position)
position - the world position.void addArea(Area area)
Area to the server. Once an area is added to the server,
PlayerEnterAreaEvent and PlayerLeaveAreaEvent events
will be triggered when a player enters/leaves an area.area - the Area you want to add to the server.removeArea(net.risingworld.api.utils.Area)void removeArea(Area area)
Area that has been added to the server previously.
Once an area is removed, events like PlayerEnterAreaEvent or
PlayerLeaveAreaEvent will no longer be triggered for this area.area - the Area you want to remove from the server. Note:
you can still re-add the area to the server at any time.addArea(net.risingworld.api.utils.Area)java.util.Collection<Area> getAllAreas()
Areas that are currently
registered with the server. CustomImage getCustomImage(int id)
id - the image id.void removeCustomImage(int id)
id - the image id.java.util.Collection<CustomImage> getAllCustomImages()
java.util.Collection<CustomImage> getAllCustomImages(long playerUID)
playerUID - the player UID (see Player.getUID()).void registerCustomItem(CustomItem item)
onEnable() method).
If a custom item is added to the player inventory, it will be treated like a
regular item, i.e it's stored in the database automatically. This means the
player is also able to store it in chests, for example. Internally, a custom
item is treated as an abstract "API item", with a reference to the item UUID.item - the custom item you want to register.CustomItem getCustomItem(java.lang.String uuid)
uuid - the UUID of the custom item.void registerCustomRecipe(CustomRecipe recipe)
onEnable() method). recipe - the custom recipe you want to register.CustomRecipe getCustomRecipe(java.lang.String targetUUID, int targetVariation)
targetUUID - the UUID of the target item.targetVariation - the variation of the target item (by default 0)void broadcastTextMessage(java.lang.String message)
Player.sendTextMessage(java.lang.String)
for every player.message - the message you want to broadcast.Player.sendTextMessage(java.lang.String)void broadcastYellMessage(java.lang.String message)
Player.sendYellMessage(java.lang.String)
for every player.message - the yell message you want to broadcast.Player.sendYellMessage(java.lang.String)