fCraft  0.636
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
fCraft.World Class Reference

World instance. Manages the player list, manages access/build security, stores metadata. More...

Inheritance diagram for fCraft.World:
Inheritance graph
[legend]
Collaboration diagram for fCraft.World:
Collaboration graph
[legend]

Public Member Functions

Map LoadMap ()
 Loads the map file, if needed. Generates a default map if mapfile is missing or not loadable. Guaranteed to return a Map object.
 
void SaveMap ()
 Forces the map to be saved to file. Acquires SyncRoot.
 
World ChangeMap ([NotNull] Map newMap)
 Creates a new World for the given Map, with same properties as this world.
 
void Flush ()
 Intiates a map flush, in which all block drawings are completed. All users are held in limbo until completion, and then resent the map.
 
Map AcceptPlayer ([NotNull] Player player, bool announce)
 
bool ReleasePlayer ([NotNull] Player player)
 
Player[] FindPlayers ([NotNull] Player player,[NotNull] string playerName)
 
Player FindPlayerExact ([NotNull] string playerName)
 Gets player by name (without autocompletion)
 
int CountPlayers (bool includeHiddenPlayers)
 Counts all players (optionally includes all hidden players).
 
int CountVisiblePlayers ([NotNull] Player observer)
 Counts only the players who are not hidden from a given observer.
 
bool Lock ([NotNull] Player player)
 Locks the current world, which prevents blocks in the world from being updated.
 
bool Unlock ([NotNull] Player player)
 Unlocks the current world, which allows blocks in the world to be changed once more.
 
Player GetNextPatrolTarget ([NotNull] Player observer)
 Selects the next player to teleport to while patroling. Sets target's LastPatrolTime automatically.
 
Player GetNextPatrolTarget ([NotNull] Player observer,[NotNull] Predicate< Player > predicate, bool setLastPatrolTime)
 Selects the next player to teleport to while patroling. Includes additional inclusion check (predicate).
 
bool SaveBackup ([NotNull] string targetName)
 Makes a copy of the current map file associated with this world. This does NOT save map to disk, and does NOT guarantee that the most up-to-date copy of the map was backed up.
 
string GenerateWoMConfig (bool sendMotd)
 Creates a WOM configuration string.
 
override string ToString ()
 

Static Public Member Functions

static bool IsValidName ([NotNull] string name)
 Ensures that player name has the correct length (2-16 characters) and character set (alphanumeric chars and underscores allowed).
 

Public Attributes

int CloudColor = -1
 Color of the clouds (RGB packed into an int). Set to -1 to use client defaults.
 
int FogColor = -1
 Color of the fog (RGB packed into an int). Set to -1 to use client defaults.
 
int SkyColor = -1
 Color of the sky (RGB packed into an int). Set to -1 to use client defaults.
 
int EdgeLevel = -1
 Elevation of the "ocean" that surrounds maps. Set to -1 to use client default (halfway up the map).
 
Block EdgeBlock = Block.Water
 The block which will be displayed in the background for the client.
 

Properties

string Name [get, set]
 World name (no formatting). Use WorldManager.RenameWorld() method to change this.
 
bool IsHidden [get, set]
 Whether the world shows up on the /Worlds list. Can be assigned directly.
 
bool IsPendingMapUnload [get, set]
 Whether this world is currently pending unload (waiting for block updates to finish processing before unloading).
 
SecurityController AccessSecurity [get, set]
 Controls which players may access this world.
 
SecurityController BuildSecurity [get, set]
 Controls which players may build in this world.
 
DateTime LoadedOn [get, set]
 Date (UTC) that this world was created on.
 
string LoadedBy [get, set]
 Name of the player/entity who created this world, null if the player is unknown.
 
string LoadedByClassy [get]
 
DateTime MapChangedOn [get, set]
 Date (UTC) of the most recent map change.
 
string MapChangedBy [get, set]
 Name of the player/entity who last loaded this map, Null if the player is unknown or if map has never been changed.
 
string MapChangedByClassy [get]
 
string Greeting [get, set]
 Message shown to players who join this map. Null if no message is set.
 
BlockDB BlockDB [get, set]
 BlockDB instance used to store/lookup block changes for this world.
 
Map Map [get, set]
 Map of this world. May be null if world is not loaded.
 
bool IsLoaded [get]
 Whether the map is currently loaded.
 
string MapFileName [get]
 Returns the map file name, including MapPath.
 
bool Preload [get, set]
 Controls if the map should be loaded before players enter. Map is immediately loaded when Preload is set to true. Map is unloaded if Preloaded is set to false, and there are no players on this world.
 
bool IsFlushing [get, set]
 Whether this world is currently being flushed.
 
Player[] Players [get, set]
 
bool IsFull [get]
 Whether the current world is full, determined by ConfigKey.MaxPlayersPerWorld
 
bool IsLocked [get, set]
 Whether the world is currently locked (in read-only mode).
 
string LockedBy [get, set]
 The name of player/entity who last locked this world.
 
string UnlockedBy [get, set]
 The name of player/entity who last unlocked this world.
 
DateTime LockedOn [get, set]
 Date (UTC) when this world was last locked.
 
DateTime UnlockedOn [get, set]
 Date (UTC) when this world was last locked.
 
bool BackupsEnabled [get]
 Whether timed backups are enabled (either manually or by default) on this world.
 
bool HasChangedSinceBackup [get, set]
 Whether the map was saved since last time it was backed up.
 
YesNoAuto BackupEnabledState [get, set]
 Backup state. Use "Yes" to enable, "No" to disable, and "Auto" to use default settings. If setting to "Yes", make sure to set BackupInterval property value first.
 
TimeSpan BackupInterval [get, set]
 Timed backup interval. If BackupEnabledState is set to "Yes", value must be positive. If BackupEnabledState is set to "No" or "Auto", this property has no effect.
 
static TimeSpan DefaultBackupInterval [get, set]
 Default backup interval, for worlds that have BackupEnabledState set to "Auto".
 
static bool DefaultBackupsEnabled [get]
 Whether timed backups are enabled by default for worlds that have BackupEnabledState set to "Auto".
 
string ClassyName [get]
 Returns a nicely formatted name, with optional color codes.
 
- Properties inherited from fCraft.IClassy
string ClassyName [get]
 Name optionally formatted with minecraft color codes or other decorations.
 

Detailed Description

World instance. Manages the player list, manages access/build security, stores metadata.

Member Function Documentation

Map fCraft.World.AcceptPlayer ( [NotNull] Player  player,
bool  announce 
)
World fCraft.World.ChangeMap ( [NotNull] Map  newMap)

Creates a new World for the given Map, with same properties as this world.

Returns
Newly-created World object, with the new map.
int fCraft.World.CountPlayers ( bool  includeHiddenPlayers)

Counts all players (optionally includes all hidden players).

int fCraft.World.CountVisiblePlayers ( [NotNull] Player  observer)

Counts only the players who are not hidden from a given observer.

Player fCraft.World.FindPlayerExact ( [NotNull] string  playerName)

Gets player by name (without autocompletion)

Player [] fCraft.World.FindPlayers ( [NotNull] Player  player,
[NotNull] string  playerName 
)
void fCraft.World.Flush ( )

Intiates a map flush, in which all block drawings are completed. All users are held in limbo until completion, and then resent the map.

string fCraft.World.GenerateWoMConfig ( bool  sendMotd)

Creates a WOM configuration string.

Parameters
sendMotdDetermines if the motd is sent with the configuration string.
Returns
Configuration settings string to send to client.
Player fCraft.World.GetNextPatrolTarget ( [NotNull] Player  observer)

Selects the next player to teleport to while patroling. Sets target's LastPatrolTime automatically.

Parameters
observerPlayer who is patrolling.
Returns
Player who has been selected to be patrolled.
Exceptions
ArgumentNullExceptionobserver is null.
Player fCraft.World.GetNextPatrolTarget ( [NotNull] Player  observer,
[NotNull] Predicate< Player predicate,
bool  setLastPatrolTime 
)

Selects the next player to teleport to while patroling. Includes additional inclusion check (predicate).

Parameters
observerPlayer who is patrolling.
predicateAdditional inclusion check for patrol targets. Applied after the standard checks. Allows filtering out unwanted players.
setLastPatrolTimeWhether to set target's LastPatrolTime.
Returns
Player who has been selected to be patrolled.
Exceptions
ArgumentNullExceptionobserver or predicate is null.
static bool fCraft.World.IsValidName ( [NotNull] string  name)
static

Ensures that player name has the correct length (2-16 characters) and character set (alphanumeric chars and underscores allowed).

Map fCraft.World.LoadMap ( )

Loads the map file, if needed. Generates a default map if mapfile is missing or not loadable. Guaranteed to return a Map object.

bool fCraft.World.Lock ( [NotNull] Player  player)

Locks the current world, which prevents blocks in the world from being updated.

Parameters
playerPlayer who is issueing the lock.
Returns
True if the world was locked, or false if the world was already locked.
bool fCraft.World.ReleasePlayer ( [NotNull] Player  player)
bool fCraft.World.SaveBackup ( [NotNull] string  targetName)

Makes a copy of the current map file associated with this world. This does NOT save map to disk, and does NOT guarantee that the most up-to-date copy of the map was backed up.

Parameters
targetNameTarget file name.
Returns
Whether a backup was created or not.
Exceptions
ArgumentNullExceptiontargetName is null.
void fCraft.World.SaveMap ( )

Forces the map to be saved to file. Acquires SyncRoot.

override string fCraft.World.ToString ( )
bool fCraft.World.Unlock ( [NotNull] Player  player)

Unlocks the current world, which allows blocks in the world to be changed once more.

Parameters
playerPlayer who is issueing the unlock.
Returns
True if the world was unlocked, or false if the world was already unlocked.

Member Data Documentation

int fCraft.World.CloudColor = -1

Color of the clouds (RGB packed into an int). Set to -1 to use client defaults.

Block fCraft.World.EdgeBlock = Block.Water

The block which will be displayed in the background for the client.

int fCraft.World.EdgeLevel = -1

Elevation of the "ocean" that surrounds maps. Set to -1 to use client default (halfway up the map).

int fCraft.World.FogColor = -1

Color of the fog (RGB packed into an int). Set to -1 to use client defaults.

int fCraft.World.SkyColor = -1

Color of the sky (RGB packed into an int). Set to -1 to use client defaults.

Property Documentation

SecurityController fCraft.World.AccessSecurity
getset

Controls which players may access this world.

YesNoAuto fCraft.World.BackupEnabledState
getset

Backup state. Use "Yes" to enable, "No" to disable, and "Auto" to use default settings. If setting to "Yes", make sure to set BackupInterval property value first.

TimeSpan fCraft.World.BackupInterval
getset

Timed backup interval. If BackupEnabledState is set to "Yes", value must be positive. If BackupEnabledState is set to "No" or "Auto", this property has no effect.

bool fCraft.World.BackupsEnabled
get

Whether timed backups are enabled (either manually or by default) on this world.

BlockDB fCraft.World.BlockDB
getset

BlockDB instance used to store/lookup block changes for this world.

SecurityController fCraft.World.BuildSecurity
getset

Controls which players may build in this world.

string fCraft.World.ClassyName
get

Returns a nicely formatted name, with optional color codes.

TimeSpan fCraft.World.DefaultBackupInterval
staticgetset

Default backup interval, for worlds that have BackupEnabledState set to "Auto".

bool fCraft.World.DefaultBackupsEnabled
staticget

Whether timed backups are enabled by default for worlds that have BackupEnabledState set to "Auto".

string fCraft.World.Greeting
getset

Message shown to players who join this map. Null if no message is set.

bool fCraft.World.HasChangedSinceBackup
getset

Whether the map was saved since last time it was backed up.

bool fCraft.World.IsFlushing
getset

Whether this world is currently being flushed.

bool fCraft.World.IsFull
get

Whether the current world is full, determined by ConfigKey.MaxPlayersPerWorld

bool fCraft.World.IsHidden
getset

Whether the world shows up on the /Worlds list. Can be assigned directly.

bool fCraft.World.IsLoaded
get

Whether the map is currently loaded.

bool fCraft.World.IsLocked
getset

Whether the world is currently locked (in read-only mode).

bool fCraft.World.IsPendingMapUnload
getset

Whether this world is currently pending unload (waiting for block updates to finish processing before unloading).

string fCraft.World.LoadedBy
getset

Name of the player/entity who created this world, null if the player is unknown.

string fCraft.World.LoadedByClassy
get
DateTime fCraft.World.LoadedOn
getset

Date (UTC) that this world was created on.

string fCraft.World.LockedBy
getset

The name of player/entity who last locked this world.

DateTime fCraft.World.LockedOn
getset

Date (UTC) when this world was last locked.

Map fCraft.World.Map
getset

Map of this world. May be null if world is not loaded.

string fCraft.World.MapChangedBy
getset

Name of the player/entity who last loaded this map, Null if the player is unknown or if map has never been changed.

string fCraft.World.MapChangedByClassy
get
DateTime fCraft.World.MapChangedOn
getset

Date (UTC) of the most recent map change.

string fCraft.World.MapFileName
get

Returns the map file name, including MapPath.

string fCraft.World.Name
getset

World name (no formatting). Use WorldManager.RenameWorld() method to change this.

Player [] fCraft.World.Players
getset
bool fCraft.World.Preload
getset

Controls if the map should be loaded before players enter. Map is immediately loaded when Preload is set to true. Map is unloaded if Preloaded is set to false, and there are no players on this world.

string fCraft.World.UnlockedBy
getset

The name of player/entity who last unlocked this world.

DateTime fCraft.World.UnlockedOn
getset

Date (UTC) when this world was last locked.


The documentation for this class was generated from the following file: