Jump to content

PlayerDB.txt: Difference between revisions

From fCraft Wiki
 
(6 intermediate revisions by the same user not shown)
Line 3: Line 3:
==Formatting==
==Formatting==
====Numbers====
====Numbers====
:All numbers are nonnegative integers, written out with decimal digits. Empty Int32/Int64 fields are interpreted as 0.
:All numbers are nonnegative integers, written out with decimal digits. Empty string or any invalid value is interpreted as 0.
====Dates====
====Dates====
:Dates are saved as number of seconds since UTC Unix Timestamp. Value of "0" and empty DateTime fields are interpreted as "never" (DateTime.MinValue).  
:Dates are saved as number of seconds since UTC [http://en.wikipedia.org/wiki/Unix_time Unix Epoch]. Value of "0", empty string, or any invalid value is interpreted as "never" (represented internally as DateTime.MinValue).  
====Time spans====
====Time spans====
:Time spans are stored as number of seconds. They cannot be negative.
:Time spans are stored as number of seconds. They cannot be negative. Empty string or any invalid value is interpreted as 0.
====IP Addresses====
====IP Addresses====
:IPs are serialized in dotted decimal notation (e.g. "192.168.1.1"). Only IPv4 addresses are used — no IPv6. Empty string, any invalid value, or "255.255.255.255" are interpreted as "unknown" address.
:IPs are serialized in dotted decimal notation (e.g. "192.168.1.1"). Only IPv4 addresses are used — no IPv6. Empty string, any invalid value, or "255.255.255.255" are interpreted as "unknown" address.
====Strings====
====Strings====
:Strings are encoded as ASCII. Escaped characters are <code>,</code> (comma), <code>\n</code> (new line), and <code>\r</code> (carriage return) &mdash; they are replaced with <code>\xFF</code>, <code>\xFE</code>, and <code>\xFD</code> respectively. There is no limit on string length. Parsing strings ends at the nearest comma.
:Strings are encoded as ASCII. Escaped characters are <code>,</code> (comma), <code>\n</code> (new line), and <code>\r</code> (carriage return) &mdash; they are replaced with <code>\xFF</code>, <code>\xFE</code>, and <code>\xFD</code> respectively. There is no practical limit on string length, aside from [http://stackoverflow.com/a/140749/383361 .NET's internal 1-billion-character limit]. Parsing strings ends at the nearest non-escaped comma.
====Enums====
====Enums====
:Enumerations are represented by one character or digit. They can usually be left blank (which implies using default value).
:Enumerations are represented by one character or digit. Interpretation of empty strings and invalid values varies field-to-field. See the table below for specifics.


==Header==
==Header==
Line 44: Line 44:
|LastIP
|LastIP
|IPAddress
|IPAddress
|For offline players, last IP used to successfully log in. For online players, current IP.
|For offline players, last IP used to successfully log in.
For online players, current IP.
|May be blank ("none") for players whose records were imported.
|May be blank ("none") for players whose records were imported.
|-
|-
Line 130: Line 131:
|
|
|
|
|No longer in use.
|No longer in use. Skip.
|Skip this column.
|
|-
|-
!16
!16
Line 178: Line 179:
|
|
|
|
|No longer in use.
|No longer in use by fCraft. Skip.
|Skip this column.
|Used by 800craft (fCraft mod) for "PromoCount"
|-
|-
!24
!24
|
|
|
|
|No longer in use.
|No longer in use by fCraft. Skip.
|Skip this column.
|Used by 800craft (fCraft mod) for "TitleName"
|-
|-
!25
!25
Line 244: Line 245:
|LastSeen
|LastSeen
|DateTime
|DateTime
|Last time the player has been seen online (last logout for offline players, current time for online players).
|Last time the player has been seen online.
Last logout date for offline players; current time for online players.
|May be "never" if player has never been online.
|May be "never" if player has never been online.
|-
|-

Latest revision as of 07:31, 28 February 2014

File PlayerDB.txt is used by fCraft to store persistent player information. Each line in the file (after the header) represents one player record.

Formatting

Numbers

All numbers are nonnegative integers, written out with decimal digits. Empty string or any invalid value is interpreted as 0.

Dates

Dates are saved as number of seconds since UTC Unix Epoch. Value of "0", empty string, or any invalid value is interpreted as "never" (represented internally as DateTime.MinValue).

Time spans

Time spans are stored as number of seconds. They cannot be negative. Empty string or any invalid value is interpreted as 0.

IP Addresses

IPs are serialized in dotted decimal notation (e.g. "192.168.1.1"). Only IPv4 addresses are used — no IPv6. Empty string, any invalid value, or "255.255.255.255" are interpreted as "unknown" address.

Strings

Strings are encoded as ASCII. Escaped characters are , (comma), \n (new line), and \r (carriage return) — they are replaced with \xFF, \xFE, and \xFD respectively. There is no practical limit on string length, aside from .NET's internal 1-billion-character limit. Parsing strings ends at the nearest non-escaped comma.

Enums

Enumerations are represented by one character or digit. Interpretation of empty strings and invalid values varies field-to-field. See the table below for specifics.

First line of PlayerDB.txt is the header. It starts with two numbers:

  • MaxID
Next available player ID number. In practice the value is not used, since the server re-computes the number (by finding highest used ID) every time it loads PlayerDB.
  • FormatVersion
PlayerDB file format version. fCraft 0.600 and later releases use version 5. This article describes only this current format.

The rest of the header line describes the row format. For example:

7383 5 fCraft PlayerDB | Row format: Name,IPAddress,Rank,RankChangeDate,RankChangedBy,Banned,BanDate,BannedBy,UnbanDate,UnbannedBy,BanReason,UnbanReason,LastFailedLoginDate,LastFailedLoginIP,UNUSED,FirstLoginDate,LastLoginDate,TotalTime,BlocksBuilt,BlocksDeleted,TimesVisited,MessagesWritten,UNUSED,UNUSED,PreviousRank,RankChangeReason,TimesKicked,TimesKickedOthers,TimesBannedOthers,ID,RankChangeType,LastKickDate,LastSeen,BlocksDrawn,LastKickBy,LastKickReason,BannedUntil,IsFrozen,FrozenBy,FrozenOn,MutedUntil,MutedBy,Password,IsOnline,BandwidthUseMode,IsHidden,LastModified,DisplayedName,AccountType,Email

Columns

Each row after the header represents one player record. Fields are comma-separated. Note that column numbers in this table start with 1, not 0.

Order Name Data Type Purpose Remarks
1 Name String Player's account name. Invalid values cause whole record to be skipped. Regex used to verify validity:

^([a-zA-Z0-9._]{2,16}|[a-zA-Z0-9._]{1,15}@\d*)$

2 LastIP IPAddress For offline players, last IP used to successfully log in.

For online players, current IP.

May be blank ("none") for players whose records were imported.
3 Rank String Player's current rank. Full rank name. Saved as "RankName#UUID", where UUID is rank's alphanumeric universally unique identifier.

fCraft always saves ranks in this "full" format, but it can read rank name without ID as well.

If parsing fails, default rank is assigned to player. Rank name is case-insensitive, but UUID is case-sensitive.

String not escaped.

4 RankChangeDate DateTime Date of the most recent promotion/demotion. Defaults to "never" for players who have never been ranked.
5 RankChangedBy String Name of the player or entity who most recently promoted/demoted this player. Not necessarily a valid player name. May be blank. Escaped.
6 BanStatus Enum Player's current BanStatus: Banned, NotBanned, or Exempt. One or zero characters long.
  • b = player is currently banned.
  • x = player is exempt from all bans.
  • Any other value = neither banned nor exempt.
7 BanDate DateTime Date of most recent ban. Defaults to "never" for players who have never been banned.
8 BannedBy String Name of the player or entity who most recently banned this player. Only read if BanDate was set. May be blank. Not necessarily a valid player name. Escaped.
9 UnbanDate DateTime Date of most recent unban. Defaults to "never" for players who have never been unbanned.
10 UnbannedBy String Name of the player or entity who most recently unbanned this player. Only read if UnbanDate was set. May be blank. Not necessarily a valid player name. Escaped.
11 BanReason String Reason given for the most recent ban. Only read if BanDate was set. May be blank. Escaped.
12 UnbanReason String Reason given for the most recent unban. Only read if UnbanDate was set. May be blank. Escaped.
13 LastFailedLoginDate DateTime Date of most recent failed attempt to log in.
14 LastFailedLoginIP IPAddress IP from which player most recently tried (and failed) to log in.
15 No longer in use. Skip.
16 FirstLoginDate DateTime First time the player ever attempted to log in. May be "never" for players whose records were imported.
17 LastLoginDate DateTime Most recent time the player successfully logged in. May be "never" for players whose records were imported.
18 TotalTime TimeSpan Total amount of time the player spent on this server. May be 0 for players whose records were imported.
19 BlocksBuilt Int32 Total number of blocks manually built or painted by the player.
20 BlocksDeleted Int32 Total number of blocks manually deleted by the player.
21 TimesVisited Int32 Number of sessions/logins. May be 0 for players whose records were imported.
22 MessagesWritten Int32 Total number of chat messages written.
23 No longer in use by fCraft. Skip. Used by 800craft (fCraft mod) for "PromoCount"
24 No longer in use by fCraft. Skip. Used by 800craft (fCraft mod) for "TitleName"
25 PreviousRank String Player's previous rank. Same parsing rules as the "Rank" column.
26 RankChangeReason String Reason given for the most recent promotion/demotion. May be blank. Escaped.
27 TimesKicked Int32 Number of times that this player has been manually kicked.
28 TimesKickedOthers Int32 Number of kicks issues by this player.
29 TimesBannedOthers Int32 Number of bans issued by this player.
30 ID Int32 Player's unique numeric ID. Issued on first join. IDs 0-255 are reserved. Player IDs start with 256. If anyone's ID in file is below 256, a new one is assigned on-load.
31 RankChangeType Enum Type of the most recent promotion/demotion. One digit long.
  • 0 = Default (never been promoted or demoted)
  • 1 = Promoted (manually by another player or by console)
  • 2 = Demoted (manually by another player or by console)
  • 3 = AutoPromoted (e.g. by AutoRank)
  • 4 = AutoDemoted (e.g. by AutoRank)

If blank or unrecognized value is given, either "Default", "Promoted", or "Demoted" is chosen based on values of Rank and PreviousRank.

32 LastKickDate DateTime Date of the most recent kick.
33 LastSeen DateTime Last time the player has been seen online.

Last logout date for offline players; current time for online players.

May be "never" if player has never been online.
34 BlocksDrawn Int64 Total number of blocks modified using draw and copy/paste commands.
35 LastKickBy String Name of the player or entity who most recently kicked this player. May be blank. Not necessarily a valid player name. Escaped.
36 LastKickReason String Reason given for the most recent kick. May be blank. Escaped.
37 BannedUntil DateTime Reserved for future use (temp bans). Currently unused.
38 IsFrozen Enum Whether this player is currently frozen. One or zero characters long.
  • f = this player is frozen.
  • Any other value = not frozen.
39 FrozenBy String Name of the player or entity who most recently froze this player. May be blank. Not necessarily a valid player name. Escaped.
40 FrozenOn DateTime Date of the most recent freezing of this player. May be "never" if this player has never been frozen.
41 MutedUntil DateTime Date until which the player is muted. If the date is "never" or is in the past, player is NOT muted.
42 MutedBy String Name of the player or entity who most recently froze this player. May be blank. Not necessarily a valid player name. Escaped.
43 Password String Reserved for future use (IRC or account passwords). Currently unused.
44 IsOnline Enum Whether this player is currently online. One or zero characters long.
  • o = this player was online at the time PlayerDB was saved.
  • Any other value = player was offline.

Hidden players who may appear offline in-game are still shown as "online" in this column.

45 BandwidthUseMode Enum Player's custom bandwidth use mode. Zero or one digit long.
  • 0 = Use server default
  • 1 = VeryLow
  • 2 = Low
  • 3 = Normal
  • 4 = High
  • 5 = VeryHigh

See BandwidthUseMode config key documentation for a detailed explanation of the options.

All columns prior to this are mandatory. 46th and later columns are "optional", in the sense that current version of fCraft is able to read files without them, for compatibility reasons. These columns have been added in fCraft versions 0.600 and later.

Order Name Data Type Purpose Remarks
46 IsHidden Enum Whether the player is currently hidden. One or zero characters long.
  • h = this player is hidden.
  • Any other value = player is not hidden.
47 LastModified DateTime Time of most recent modification of this record's fields.
48 DisplayedName String Replaces Name when printing name in chat. May be blank (meaning "use normal Name"). Escaped.
49 AccountType Enum Minecraft.net account type (paid/free/unknown). One or zero characters long.
  • 1 = Free minecraft.net account (may some day be upgraded to "Paid").
  • 2 = Paid minecraft.net account.
  • Any other value = Unknown account type (could be free or paid).
50 Email String For Mojang accounts, player's email address. Blank for all regular accounts. Escaped.