fCraft  0.638
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
fCraft.PlayerDB Class Reference

Persistent database of player information. More...

Static Public Member Functions

static PlayerInfo AddFakeEntry ([NotNull] string name, RankChangeType rankChangeType)
 
static void Save ()
 
static PlayerInfo FindOrCreateInfoForPlayer ([NotNull] string name,[NotNull] IPAddress lastIP)
 
static PlayerInfo[] FindPlayers ([NotNull] IPAddress address)
 
static PlayerInfo[] FindPlayers ([NotNull] IPAddress address, int limit)
 
static PlayerInfo[] FindPlayersCidr ([NotNull] IPAddress address, byte range)
 
static PlayerInfo[] FindPlayersCidr ([NotNull] IPAddress address, byte range, int limit)
 
static PlayerInfo[] FindPlayers ([NotNull] Regex regex)
 
static PlayerInfo[] FindPlayers ([NotNull] Regex regex, int limit)
 
static PlayerInfo[] FindPlayers ([NotNull] string namePart)
 
static PlayerInfo[] FindPlayers ([NotNull] string namePart, int limit)
 
static PlayerInfo FindPlayerInfoExact ([NotNull] string fullName)
 Finds player by exact name.
 
static PlayerInfo FindPlayerInfoOrPrintMatches ([NotNull] Player player,[NotNull] string partialName, bool includeSelf)
 Searches for player names starting with namePart. If exactly one player matched, returns the corresponding PlayerInfo object. If name format is incorrect, or if no matches were found, an appropriate message is printed to the player. If multiple players were found matching the partialName, first 25 matches are printed.
 
static string FindExactClassyName ([CanBeNull] string name)
 
static int GetNextID ()
 
static PlayerInfo FindPlayerInfoByID (int id)
 Finds PlayerInfo by ID. Returns null of not found.
 
static int MassRankChange ([NotNull] Player player,[NotNull] Rank from,[NotNull] Rank to,[NotNull] string reason)
 
static StringBuilder AppendEscaped ([NotNull] this StringBuilder sb,[CanBeNull] string str)
 Escapes special characters (comma, newline, carriage return) and appends the processed string to the given StringBuilder. Used on all string fields of PlayerInfo and IPBanInfo.
 
static string Escape ([CanBeNull] string str)
 Escapes special characters (comma, newline, carriage return) in the given string.
 
static string Unescape ([NotNull] string str)
 Restores escaped special characters (comma, newline, carriage return). Used on all string fields of PlayerInfo and IPBanInfo records, at load time.
 

Public Attributes

const int FormatVersion = 5
 

Properties

static PlayerInfo[] PlayerInfoList [get, set]
 Cached list of all players in the database. May be quite long. Make sure to copy a reference to the list before accessing it in a loop, since this array be frequently be replaced by an updated one.
 
static bool IsLoaded [get, set]
 Whether PlayerDB has been loaded. Ranks cannot be modified after PlayerDB is loaded.
 
static TimeSpan SaveInterval [get, set]
 Interval at which PlayerDB should be saved. Default is 90s.
 
static int BannedCount [get]
 
static float BannedPercentage [get]
 
static int Size [get]
 

Detailed Description

Persistent database of player information.

Member Function Documentation

static PlayerInfo fCraft.PlayerDB.AddFakeEntry ( [NotNull] string  name,
RankChangeType  rankChangeType 
)
static
static StringBuilder fCraft.PlayerDB.AppendEscaped ( [NotNull] this StringBuilder  sb,
[CanBeNull] string  str 
)
static

Escapes special characters (comma, newline, carriage return) and appends the processed string to the given StringBuilder. Used on all string fields of PlayerInfo and IPBanInfo.

Parameters
sbStringBuilder to which string should be appended. May not be null.
strString to process and append. If this string is null or empty, nothing is appended.
Returns
A reference to the given StringBuilder (sb).
Exceptions
ArgumentNullExceptionsb is null.
static string fCraft.PlayerDB.Escape ( [CanBeNull] string  str)
static

Escapes special characters (comma, newline, carriage return) in the given string.

Parameters
strString to process. If this string is null, an empty string is returned.
Returns
Processed string.
static string fCraft.PlayerDB.FindExactClassyName ( [CanBeNull] string  name)
static
static PlayerInfo fCraft.PlayerDB.FindOrCreateInfoForPlayer ( [NotNull] string  name,
[NotNull] IPAddress  lastIP 
)
static
static PlayerInfo fCraft.PlayerDB.FindPlayerInfoByID ( int  id)
static

Finds PlayerInfo by ID. Returns null of not found.

static PlayerInfo fCraft.PlayerDB.FindPlayerInfoExact ( [NotNull] string  fullName)
static

Finds player by exact name.

Parameters
fullNameFull, case-insensitive name of the player.
Returns
PlayerInfo object if the player was found. Null if not found.
static PlayerInfo fCraft.PlayerDB.FindPlayerInfoOrPrintMatches ( [NotNull] Player  player,
[NotNull] string  partialName,
bool  includeSelf 
)
static

Searches for player names starting with namePart. If exactly one player matched, returns the corresponding PlayerInfo object. If name format is incorrect, or if no matches were found, an appropriate message is printed to the player. If multiple players were found matching the partialName, first 25 matches are printed.

Parameters
playerPlayer to print feedback to.
partialNamePartial or full player name.
includeSelfWhether player themself should be considered.
Returns
PlayerInfo object if one player was found. Null if no or multiple matches were found.
static PlayerInfo [] fCraft.PlayerDB.FindPlayers ( [NotNull] IPAddress  address)
static
static PlayerInfo [] fCraft.PlayerDB.FindPlayers ( [NotNull] IPAddress  address,
int  limit 
)
static
static PlayerInfo [] fCraft.PlayerDB.FindPlayers ( [NotNull] Regex  regex)
static
static PlayerInfo [] fCraft.PlayerDB.FindPlayers ( [NotNull] Regex  regex,
int  limit 
)
static
static PlayerInfo [] fCraft.PlayerDB.FindPlayers ( [NotNull] string  namePart)
static
static PlayerInfo [] fCraft.PlayerDB.FindPlayers ( [NotNull] string  namePart,
int  limit 
)
static
static PlayerInfo [] fCraft.PlayerDB.FindPlayersCidr ( [NotNull] IPAddress  address,
byte  range 
)
static
static PlayerInfo [] fCraft.PlayerDB.FindPlayersCidr ( [NotNull] IPAddress  address,
byte  range,
int  limit 
)
static
static int fCraft.PlayerDB.GetNextID ( )
static
static int fCraft.PlayerDB.MassRankChange ( [NotNull] Player  player,
[NotNull] Rank  from,
[NotNull] Rank  to,
[NotNull] string  reason 
)
static
static void fCraft.PlayerDB.Save ( )
static
static string fCraft.PlayerDB.Unescape ( [NotNull] string  str)
static

Restores escaped special characters (comma, newline, carriage return). Used on all string fields of PlayerInfo and IPBanInfo records, at load time.

Parameters
strString to unescape.
Returns
Procesed string, with the escaped special character restored.
Exceptions
ArgumentNullExceptionstr is null.

Member Data Documentation

const int fCraft.PlayerDB.FormatVersion = 5

Property Documentation

int fCraft.PlayerDB.BannedCount
staticget
float fCraft.PlayerDB.BannedPercentage
staticget
bool fCraft.PlayerDB.IsLoaded
staticgetset

Whether PlayerDB has been loaded. Ranks cannot be modified after PlayerDB is loaded.

PlayerInfo [] fCraft.PlayerDB.PlayerInfoList
staticgetset

Cached list of all players in the database. May be quite long. Make sure to copy a reference to the list before accessing it in a loop, since this array be frequently be replaced by an updated one.

TimeSpan fCraft.PlayerDB.SaveInterval
staticgetset

Interval at which PlayerDB should be saved. Default is 90s.

int fCraft.PlayerDB.Size
staticget

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