Jump to content

PlayerDB.txt: Difference between revisions

From fCraft Wiki
Line 51: Line 51:
|String
|String
|Player's current rank.
|Player's current rank.
|Full rank name. Saved as "RankName#UUID", where UUID is rank's universally unique identifier. fCraft can parse rank name without ID as well. If parsing fails, default rank is assigned to player. Not escaped.
|Full rank name. Saved as "RankName#UUID", where UUID is rank's alphanumeric universally unique identifier. fCraft can parse 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
!4

Revision as of 08:33, 22 August 2013

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 Int32/Int64 fields are interpreted as 0.

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).

Time spans

Time spans are stored as number of seconds. They cannot be negative.

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 limit on string length. Parsing strings ends at the nearest comma.

Enums

Enumerations are represented by one character or digit. They can usually be left blank (which implies using default value).

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 can parse 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 this column.
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. Skip this column.
24 No longer in use. Skip this column.
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 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.