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

Represents a connection to a Minecraft client. Handles low-level interactions (e.g. networking). More...

+ Inheritance diagram for fCraft.Player:
+ Collaboration diagram for fCraft.Player:

Public Member Functions

void JoinWorld ([NotNull] World newWorld, WorldChangeReason reason)
 
void JoinWorld ([NotNull] World newWorld, WorldChangeReason reason, Position position)
 
void SendNow (Packet packet)
 Send packet to player (not thread safe, sync, immediate). Should NEVER be used from any thread other than this session's ioThread. Not thread-safe (for performance reason).
 
void Send (Packet packet)
 Send packet (thread-safe, async, priority queue). This is used for most packets (movement, chat, etc).
 
void SendLowPriority (Packet packet)
 Send packet (thread-safe, asynchronous, delayed queue). This is currently only used for block updates.
 
void ClearLowPriotityOutputQueue ()
 
void ClearPriorityOutputQueue ()
 
void Kick ([NotNull] string message, LeaveReason leaveReason)
 Kick (asynchronous). Immediately blocks all client input, but waits until client thread has sent the kick packet.
 
void WaitForDisconnect ()
 Blocks the calling thread until this session disconnects.
 
void ParseMessage ([NotNull] string rawMessage, bool fromConsole)
 Parses a message on behalf of this player.
 
void SendToSpectators ([NotNull] string message,[NotNull] params object[] formatArgs)
 Sends a message to all players who are spectating this player, e.g. to forward typed-in commands and PMs. "System color" code (&S) will be prepended to the message. If the message does not fit on one line, prefix ">" is prepended to each wrapped line.
 
void MessageWoMAlert ([NotNull] string message,[NotNull] params object[] formatArgs)
 Sends a message as a WoM alert. Players who use World of Minecraft client will see this message on the left side of the screen. Other players will receive it as a normal message. "System color" code (&S) will be prepended to the message.
 
void Message ([NotNull] string message,[NotNull] params object[] formatArgs)
 Sends a text message to this player. "System color" code (&S) will be prepended to the message. If the message does not fit on one line, prefix ">" is prepended to each wrapped line.
 
void MessagePrefixed ([NotNull] string prefix,[NotNull] string message,[NotNull] params object[] formatArgs)
 Sends a text message to this player, prefixing each line.
 
void MessageNoPlayer ([NotNull] string playerName)
 Prints "No players found matching ___" message.
 
void MessageNoWorld ([NotNull] string worldName)
 Prints "No worlds found matching ___" message.
 
void MessageManyMatches ([NotNull] string itemType,[NotNull] IEnumerable< IClassy > items)
 Prints a comma-separated list of matches (up to 30): "More than one ___ matched: ___, ___, ..."
 
void MessageNoAccess ([NotNull] params Permission[] permissions)
 Prints "This command requires ___+ rank" message.
 
void MessageNoAccess ([NotNull] CommandDescriptor cmd)
 Prints "This command requires ___+ rank" message.
 
void MessageNoRank ([NotNull] string rankName)
 Prints "Unrecognized rank ___" message.
 
void MessageUnsafePath ()
 Prints "You cannot access files outside the map folder." message.
 
void MessageNoZone ([NotNull] string zoneName)
 Prints "No zones found matching ___" message.
 
void MessageInvalidWorldName ([NotNull] string worldName)
 Prints "Unacceptable world name" message, and requirements for world names.
 
void MessageInvalidPlayerName ([NotNull] string playerName)
 Prints "___ is not a valid player name" message.
 
void MessageMuted ()
 Prints "You are muted for ___ longer" message.
 
void MessageMaxTimeSpan ()
 Prints "Specify a time range up to ___" message
 
bool IsIgnoring ([NotNull] PlayerInfo other)
 Checks whether this player is currently ignoring a given PlayerInfo.
 
bool Ignore ([NotNull] PlayerInfo other)
 Adds a given PlayerInfo to the ignore list. Not that ignores are not persistent, and are reset when a player disconnects.
 
bool Unignore ([NotNull] PlayerInfo other)
 Removes a given PlayerInfo from the ignore list.
 
void Confirm ([NotNull] CommandReader cmd,[NotNull] string message,[NotNull] params object[] formatArgs)
 Request player to confirm continuing with the command. Player is prompted to type "/ok", and when he/she does, the command is called again with IsConfirmed flag set.
 
void Confirm ([NotNull] ConfirmationCallback callback,[CanBeNull] object callbackParameter,[NotNull] string message,[NotNull] params object[] formatArgs)
 Request player to confirm an action. Player is prompted to type "/ok", and when he/she does, custom callback will be called
 
bool ConfirmCancel ()
 Cancels any pending confirmation (/ok) prompt.
 
bool PlaceBlock (Vector3I coord, ClickAction action, Block type)
 Handles manually-placed/deleted blocks. Returns true if player's action should result in a kick.
 
void SendBlock (Vector3I coords, Block block)
 Sends a block change to THIS PLAYER ONLY. Does not affect the map.
 
void RevertBlock (Vector3I coords)
 Gets the block from given location in player's world, and sends it (async) to the player. Used to undo player's attempted block placement/deletion.
 
void Bind (Block type, Block replacement)
 
void ResetBind (Block type)
 
void ResetBind ([NotNull] params Block[] types)
 
Block GetBind (Block type)
 
void ResetAllBinds ()
 
bool Can ([NotNull] params Permission[] permissions)
 Returns true if player has ALL of the given permissions.
 
bool CanAny ([NotNull] params Permission[] permissions)
 Returns true if player has ANY of the given permissions.
 
bool Can (Permission permission)
 Returns true if player has the given permission.
 
bool Can (Permission permission,[NotNull] Rank other)
 Returns true if player has the given permission, and is allowed to affect players of the given rank.
 
bool CanDraw (int volume)
 Returns true if player is allowed to run draw commands that affect a given number of blocks.
 
bool CanJoin ([NotNull] World worldToJoin)
 Returns true if player is allowed to join a given world.
 
CanPlaceResult CanPlace ([NotNull] Map map, Vector3I coords, Block newBlock, BlockChangeContext context)
 Checks whether player is allowed to place a block on the current world at given coordinates. Raises the PlayerPlacingBlock event.
 
bool CanSee ([NotNull] Player other)
 Whether this player can currently see another player as being online. Players can always see themselves. Super players (e.g. Console) can see all. Hidden players can only be seen by those of sufficient rank.
 
bool CanSeeMoving ([NotNull] Player otherPlayer)
 Whether this player can currently see another player moving. Behaves very similarly to CanSee method, except when spectating: Spectators and spectatee cannot see each other. Spectators can only be seen by those who'd be able to see them hidden.
 
bool CanSee ([NotNull] World world)
 Whether this player should see a given world on the /Worlds list by default.
 
UndoState UndoPop ()
 
UndoState DrawBegin ([CanBeNull] DrawOperation op)
 
void UndoClear ()
 
void RedoClear ()
 
void SelectionAddMark (Vector3I pos, bool announce, bool executeCallbackIfNeeded)
 
void SelectionExecute ()
 
void SelectionStart (int marksExpected,[NotNull] SelectionCallback callback,[CanBeNull] object args,[CanBeNull] params Permission[] requiredPermissions)
 
void SelectionResetMarks ()
 
void SelectionCancel ()
 
CopyState GetCopyState ()
 Gets CopyState for currently-selected slot. May be null.
 
CopyState GetCopyState (int slot)
 Gets CopyState for the given slot. May be null.
 
CopyState SetCopyState ([CanBeNull] CopyState state)
 Stores given CopyState at the currently-selected slot.
 
CopyState SetCopyState ([CanBeNull] CopyState state, int slot)
 Stores given CopyState at the given slot.
 
bool Spectate ([NotNull] Player target)
 Starts spectating the given player.
 
bool StopSpectating ()
 Stops spectating.
 
void TeleportTo (Position pos)
 Teleports player to a given coordinate within this map.
 
void ResetIdleTimer ()
 Resets the IdleTimer to 0.
 
void Kick ([NotNull] Player player,[CanBeNull] string reason, LeaveReason context, bool announce, bool raiseEvents, bool recordToPlayerDB)
 Advanced kick command.
 
override string ToString ()
 Name formatted for the debugger.
 

Static Public Member Functions

static AccountType CheckPaidStatus ([NotNull] string name)
 Checks whether a given player has a paid minecraft.net account.
 
static bool IsValidName ([NotNull] string name)
 Ensures that a player name has the correct length and character set.
 
static bool ContainsValidCharacters ([NotNull] string name)
 Ensures that a player name has the correct length and character set.
 

Public Attributes

const int FullPositionUpdateIntervalDefault = 20
 
readonly bool IsSuper
 
Position Position
 Player's position in the current world.
 

Static Public Attributes

static int FullPositionUpdateInterval = FullPositionUpdateIntervalDefault
 
static Player Console
 The godly pseudo-player for commands called from the server console. Console has all the permissions granted. Note that Player.Console.World is always null, and that prevents console from calling certain commands (like /TP).
 
static int AntispamMessageCount = 3
 Number of messages in a AntiSpamInterval seconds required to trigger the anti-spam filter
 
static int AntispamInterval = 4
 Interval in seconds to record number of message for anti-spam filter
 

Properties

static int SocketTimeout [get, set]
 
static bool RelayAllUpdates [get, set]
 
LeaveReason LeaveReason [get, set]
 Reason that this player is about to leave / has left the server. Set by Kick. This value is undefined until the player is about to disconnect.
 
IPAddress IP [get, set]
 Remote IP address of this player.
 
BandwidthUseMode BandwidthUseMode [get, set]
 
int BytesSent [get, set]
 Total bytes sent (to the client) this session.
 
int BytesReceived [get, set]
 Total bytes received (from the client) this session.
 
double BytesSentRate [get, set]
 Bytes sent (to the client) per second, averaged over the last several seconds.
 
double BytesReceivedRate [get, set]
 Bytes received (from the client) per second, averaged over the last several seconds.
 
SessionState State [get, set]
 Whether the player has completed the login sequence.
 
bool HasRegistered [get, set]
 Whether the player has completed the login sequence.
 
bool HasFullyConnected [get, set]
 Whether the player registered and then finished loading the world.
 
bool IsOnline [get]
 Whether the client is currently connected.
 
bool IsVerified [get, set]
 Whether the player name was verified at login.
 
PlayerInfo Info [get, set]
 Persistent information record associated with this player.
 
bool IsPainting [get, set]
 Whether the player is in paint mode (deleting blocks replaces them). Used by /Paint.
 
bool IsDeaf [get, set]
 Whether player has blocked all incoming chat. Deaf players can't hear anything.
 
World World [get, set]
 The world that the player is currently on. May be null. Use .JoinWorld() to make players teleport to another world.
 
Map WorldMap [get]
 Map from the world that the player is on. Throws PlayerOpException if player does not have a world. Loads the map if it's not loaded. Guaranteed to not return null.
 
DateTime LoginTime [get, set]
 Time when the session connected.
 
DateTime LastActiveTime [get, set]
 Last time when the player was active (moving/messaging). UTC.
 
DateTime LastPatrolTime [get, set]
 Last time when this player was patrolled by someone.
 
CommandReader LastCommand [get, set]
 Last command called by the player.
 
string Name [get]
 Plain version of the name (no formatting).
 
string ListName [get]
 Name formatted for display in the player list.
 
string ClassyName [get]
 Name formatted for display in chat.
 
bool IsUsingWoM [get, set]
 Whether the client supports advanced WoM client functionality.
 
MetadataCollection< object > Metadata [get, set]
 Metadata associated with the session/player.
 
PlayerInfo[] IgnoreList [get]
 Returns a list of all currently-ignored players.
 
ConfirmationCallback ConfirmCallback [get, set]
 Callback to be called when player types in "/ok" to confirm an action. Use Player.Confirm(...) methods to set this.
 
object ConfirmParameter [get, set]
 Custom parameter to be passed to Player.ConfirmCallback.
 
DateTime ConfirmRequestTime [get, set]
 Time when the confirmation was requested. UTC.
 
Block LastUsedBlockType [get, set]
 Last blocktype used by the player. Make sure to use in conjunction with Player.GetBind() to ensure that bindings are properly applied.
 
static int MaxBlockPlacementRange [get, set]
 Max distance that player may be from a block to reach it (hack detection).
 
IBrush Brush [get, set]
 
DrawOperation LastDrawOp [get, set]
 
bool DisableClickToMark [get, set]
 Whether clicks should be registered towards selection marks.
 
bool IsMakingSelection [get]
 Whether player is currently making a selection.
 
int SelectionMarkCount [get]
 Number of selection marks so far.
 
int SelectionMarksExpected [get, set]
 Number of marks expected to complete the selection.
 
bool IsRepeatingSelection [get, set]
 Whether player is repeating a selection (/static)
 
CopyState[] CopyStates [get]
 Returns a list of all CopyStates, indexed by slot.
 
int CopySlot [get, set]
 Gets or sets the currently selected copy slot number. Should be between 0 and (MaxCopySlots-1). Note that fCraft adds 1 to CopySlot number when presenting it to players. So 0th slot is shown as "1st" by /CopySlot and related commands; 1st is shown as "2nd", etc.
 
int MaxCopySlots [get, set]
 Gets or sets the maximum number of copy slots allocated to this player. Should be nonnegative. CopyStates are preserved when increasing the maximum. When decreasing the value, any CopyStates in slots that fall outside the new maximum are lost.
 
Player SpectatedPlayer [get]
 Player currently being spectated. Use Spectate/StopSpectate methods to set.
 
PlayerInfo LastSpectatedPlayer [get, set]
 While spectating, currently-specated player. When not spectating, most-recently-spectated player.
 
bool IsSpectating [get]
 Whether this player is currently spectating someone.
 
TimeSpan IdleTime [get]
 Time since the player was last active (moved, talked, or clicked).
 
string LastUsedPlayerName [get, set]
 
string LastUsedWorldName [get, set]
 
- Properties inherited from fCraft.IClassy
string ClassyName [get]
 Name optionally formatted with minecraft color codes or other decorations.
 

Events

static EventHandler
< PlayerConnectingEventArgs
Connecting
 Occurs when a player is connecting (cancelable). Player name is verified and bans are checked before this event is raised, but before the player is registered with the server. Player's state at this point is SessionState.Connecting.
 
static EventHandler
< PlayerConnectedEventArgs
Connected
 Occurs when a player has connected, but before the player has joined any world. Allows changing the player's starting world. Player's state at this point is SessionState.Connecting, and about to change to SessionState.LoadingMain
 
static EventHandler
< PlayerEventArgs
Ready
 Occurs after a player has connected and joined the starting world. Player's state at this point has just changed from SessionState.LoadingMain to SessionState.Online
 
static EventHandler
< PlayerMovingEventArgs
Moving
 Occurs when player is about to move (cancelable).
 
static EventHandler
< PlayerMovedEventArgs
Moved
 Occurs when player has moved.
 
static EventHandler
< PlayerClickingEventArgs
Clicking
 Occurs when player clicked a block (cancelable). Note that a click will not necessarily result in a block being placed or deleted.
 
static EventHandler
< PlayerClickedEventArgs
Clicked
 Occurs after a player has clicked a block. Note that a click will not necessarily result in a block being placed or deleted.
 
static EventHandler
< PlayerPlacingBlockEventArgs
PlacingBlock
 Occurs when a player is about to place a block. Permission checks are done before calling this event, and their result may be overridden.
 
static EventHandler
< PlayerPlacedBlockEventArgs
PlacedBlock
 Occurs when a player has placed a block. This event does not occur if the block placement was disallowed.
 
static EventHandler
< PlayerBeingKickedEventArgs
BeingKicked
 Occurs before a player is kicked (cancelable). Kick may be caused by /Kick, /Ban, /BanIP, or /BanAll commands, or by idling. Callbacks may override whether the kick will be announced or recorded in PlayerDB.
 
static EventHandler
< PlayerKickedEventArgs
Kicked
 Occurs after a player has been kicked. Specifically, it happens after kick has been announced and recorded to PlayerDB (if applicable), just before the target player disconnects. Kick may be caused by /Kick, /Ban, /BanIP, or /BanAll commands, or by idling.
 
static EventHandler
< PlayerHideChangedEventArgs
HideChanged
 Happens after a player has hidden or unhidden.
 
static EventHandler
< PlayerDisconnectedEventArgs
Disconnected
 Occurs when a player disconnects.
 
static EventHandler
< PlayerJoiningWorldEventArgs
JoiningWorld
 Occurs when a player intends to join a world (cancelable).
 
static EventHandler
< PlayerJoinedWorldEventArgs
JoinedWorld
 Occurs after a player has joined a world.
 

Detailed Description

Represents a connection to a Minecraft client. Handles low-level interactions (e.g. networking).

Object representing volatile state ("session") of a connected player. For persistent state of a known player account, see PlayerInfo.

Member Function Documentation

void fCraft.Player.Bind ( Block  type,
Block  replacement 
)
bool fCraft.Player.Can ( [NotNull] params Permission[]  permissions)

Returns true if player has ALL of the given permissions.

bool fCraft.Player.Can ( Permission  permission)

Returns true if player has the given permission.

bool fCraft.Player.Can ( Permission  permission,
[NotNull] Rank  other 
)

Returns true if player has the given permission, and is allowed to affect players of the given rank.

bool fCraft.Player.CanAny ( [NotNull] params Permission[]  permissions)

Returns true if player has ANY of the given permissions.

bool fCraft.Player.CanDraw ( int  volume)

Returns true if player is allowed to run draw commands that affect a given number of blocks.

bool fCraft.Player.CanJoin ( [NotNull] World  worldToJoin)

Returns true if player is allowed to join a given world.

CanPlaceResult fCraft.Player.CanPlace ( [NotNull] Map  map,
Vector3I  coords,
Block  newBlock,
BlockChangeContext  context 
)

Checks whether player is allowed to place a block on the current world at given coordinates. Raises the PlayerPlacingBlock event.

bool fCraft.Player.CanSee ( [NotNull] Player  other)

Whether this player can currently see another player as being online. Players can always see themselves. Super players (e.g. Console) can see all. Hidden players can only be seen by those of sufficient rank.

bool fCraft.Player.CanSee ( [NotNull] World  world)

Whether this player should see a given world on the /Worlds list by default.

bool fCraft.Player.CanSeeMoving ( [NotNull] Player  otherPlayer)

Whether this player can currently see another player moving. Behaves very similarly to CanSee method, except when spectating: Spectators and spectatee cannot see each other. Spectators can only be seen by those who'd be able to see them hidden.

static AccountType fCraft.Player.CheckPaidStatus ( [NotNull] string  name)
static

Checks whether a given player has a paid minecraft.net account.

Returns
True if the account is paid. False if it is not paid, or if information is unavailable.
void fCraft.Player.ClearLowPriotityOutputQueue ( )
void fCraft.Player.ClearPriorityOutputQueue ( )
void fCraft.Player.Confirm ( [NotNull] CommandReader  cmd,
[NotNull] string  message,
[NotNull] params object[]  formatArgs 
)

Request player to confirm continuing with the command. Player is prompted to type "/ok", and when he/she does, the command is called again with IsConfirmed flag set.

Parameters
cmdCommand that needs confirmation.
messageMessage to print before "Type /ok to continue".
formatArgsOptional String.Format() arguments, for the message.
Exceptions
ArgumentNullExceptioncmd, message, or formatArgs is null.
void fCraft.Player.Confirm ( [NotNull] ConfirmationCallback  callback,
[CanBeNull] object  callbackParameter,
[NotNull] string  message,
[NotNull] params object[]  formatArgs 
)

Request player to confirm an action. Player is prompted to type "/ok", and when he/she does, custom callback will be called

Parameters
callbackMethod to call when player confirms.
callbackParameterArgument to pass to the callback. May be null.
messageMessage to print before "Type /ok to continue".
formatArgsOptional String.Format() arguments, for the message.
Exceptions
ArgumentNullExceptioncallback, message, or formatArgs is null.
bool fCraft.Player.ConfirmCancel ( )

Cancels any pending confirmation (/ok) prompt.

Returns
True if a confirmation prompt was pending; otherwise false.
static bool fCraft.Player.ContainsValidCharacters ( [NotNull] string  name)
static

Ensures that a player name has the correct length and character set.

UndoState fCraft.Player.DrawBegin ( [CanBeNull] DrawOperation  op)
Block fCraft.Player.GetBind ( Block  type)
CopyState fCraft.Player.GetCopyState ( )

Gets CopyState for currently-selected slot. May be null.

Returns
CopyState or null, depending on whether anything has been copied into the currently-selected slot.
CopyState fCraft.Player.GetCopyState ( int  slot)

Gets CopyState for the given slot. May be null.

Parameters
slotSlot number. Should be between 0 and (MaxCopySlots-1).
Returns
CopyState or null, depending on whether anything has been copied into the given slot.
Exceptions
ArgumentOutOfRangeExceptionslot is not between 0 and (MaxCopySlots-1).
bool fCraft.Player.Ignore ( [NotNull] PlayerInfo  other)

Adds a given PlayerInfo to the ignore list. Not that ignores are not persistent, and are reset when a player disconnects.

Parameters
otherPlayer to ignore.
Returns
True if the player is now ignored, false is the player has already been ignored previously.
bool fCraft.Player.IsIgnoring ( [NotNull] PlayerInfo  other)

Checks whether this player is currently ignoring a given PlayerInfo.

static bool fCraft.Player.IsValidName ( [NotNull] string  name)
static

Ensures that a player name has the correct length and character set.

void fCraft.Player.JoinWorld ( [NotNull] World  newWorld,
WorldChangeReason  reason 
)
void fCraft.Player.JoinWorld ( [NotNull] World  newWorld,
WorldChangeReason  reason,
Position  position 
)
void fCraft.Player.Kick ( [NotNull] string  message,
LeaveReason  leaveReason 
)

Kick (asynchronous). Immediately blocks all client input, but waits until client thread has sent the kick packet.

void fCraft.Player.Kick ( [NotNull] Player  player,
[CanBeNull] string  reason,
LeaveReason  context,
bool  announce,
bool  raiseEvents,
bool  recordToPlayerDB 
)

Advanced kick command.

Parameters
playerPlayer who is kicking.
reasonReason for kicking. May be null or blank if allowed by server configuration.
contextClassification of kick context.
announceWhether the kick should be announced publicly on the server and IRC.
raiseEventsWhether Player.BeingKicked and Player.Kicked events should be raised.
recordToPlayerDBWhether the kick should be counted towards player's record.
void fCraft.Player.Message ( [NotNull] string  message,
[NotNull] params object[]  formatArgs 
)

Sends a text message to this player. "System color" code (&S) will be prepended to the message. If the message does not fit on one line, prefix ">" is prepended to each wrapped line.

Parameters
messageA composite format string for the message. Same semantics as String.Format().
formatArgsAn object array that contains zero or more objects to format.
Exceptions
ArgumentNullExceptionmessage or formatArgs is null.
FormatExceptionMessage format is invalid.
void fCraft.Player.MessageInvalidPlayerName ( [NotNull] string  playerName)

Prints "___ is not a valid player name" message.

Parameters
playerNameGiven player name, deemed to be invalid.
void fCraft.Player.MessageInvalidWorldName ( [NotNull] string  worldName)

Prints "Unacceptable world name" message, and requirements for world names.

Parameters
worldNameGiven world name, deemed to be invalid.
void fCraft.Player.MessageManyMatches ( [NotNull] string  itemType,
[NotNull] IEnumerable< IClassy items 
)

Prints a comma-separated list of matches (up to 30): "More than one ___ matched: ___, ___, ..."

Parameters
itemTypeType of item in the list. Should be singular (e.g. "player" or "world").
itemsList of zero or more matches. ClassyName properties are used in the list.
Exceptions
ArgumentNullExceptionitemType or items is null.
void fCraft.Player.MessageMaxTimeSpan ( )

Prints "Specify a time range up to ___" message

void fCraft.Player.MessageMuted ( )

Prints "You are muted for ___ longer" message.

void fCraft.Player.MessageNoAccess ( [NotNull] params Permission[]  permissions)

Prints "This command requires ___+ rank" message.

Parameters
permissionsList of permissions required for the command.
Exceptions
ArgumentNullExceptionpermissions is null.
ArgumentExceptionpermissions array is empty.
void fCraft.Player.MessageNoAccess ( [NotNull] CommandDescriptor  cmd)

Prints "This command requires ___+ rank" message.

Parameters
cmdCommand to check.
Exceptions
ArgumentNullExceptioncmd is null.
void fCraft.Player.MessageNoPlayer ( [NotNull] string  playerName)

Prints "No players found matching ___" message.

Parameters
playerNameGiven name, for which no players were found.
Exceptions
ArgumentNullExceptionplayerName is null.
void fCraft.Player.MessageNoRank ( [NotNull] string  rankName)

Prints "Unrecognized rank ___" message.

Parameters
rankNameGiven name, for which no rank was found.
void fCraft.Player.MessageNoWorld ( [NotNull] string  worldName)

Prints "No worlds found matching ___" message.

Parameters
worldNameGiven name, for which no worlds were found.
Exceptions
ArgumentNullExceptionworldName is null.
void fCraft.Player.MessageNoZone ( [NotNull] string  zoneName)

Prints "No zones found matching ___" message.

Parameters
zoneNameGiven name, for which no zones was found.
void fCraft.Player.MessagePrefixed ( [NotNull] string  prefix,
[NotNull] string  message,
[NotNull] params object[]  formatArgs 
)

Sends a text message to this player, prefixing each line.

Parameters
prefixPrefix to prepend to prepend to each line after the 1st, if any line-wrapping occurs. Does NOT get prepended to first line.
messageA composite format string for the message. Same semantics as String.Format().
formatArgsAn object array that contains zero or more objects to format.
Exceptions
ArgumentNullExceptionprefix, message, or formatArgs is null.
FormatExceptionMessage format is invalid.
void fCraft.Player.MessageUnsafePath ( )

Prints "You cannot access files outside the map folder." message.

void fCraft.Player.MessageWoMAlert ( [NotNull] string  message,
[NotNull] params object[]  formatArgs 
)

Sends a message as a WoM alert. Players who use World of Minecraft client will see this message on the left side of the screen. Other players will receive it as a normal message. "System color" code (&S) will be prepended to the message.

Parameters
messageA composite format string for the message. Same semantics as String.Format().
formatArgsAn object array that contains zero or more objects to format.
Exceptions
ArgumentNullExceptionmessage or formatArgs is null.
FormatExceptionMessage format is invalid.
void fCraft.Player.ParseMessage ( [NotNull] string  rawMessage,
bool  fromConsole 
)

Parses a message on behalf of this player.

Parameters
rawMessageMessage to parse.
fromConsoleWhether the message originates from console.
Exceptions
ArgumentNullExceptionrawMessage is null.
bool fCraft.Player.PlaceBlock ( Vector3I  coord,
ClickAction  action,
Block  type 
)

Handles manually-placed/deleted blocks. Returns true if player's action should result in a kick.

void fCraft.Player.RedoClear ( )
void fCraft.Player.ResetAllBinds ( )
void fCraft.Player.ResetBind ( Block  type)
void fCraft.Player.ResetBind ( [NotNull] params Block[]  types)
void fCraft.Player.ResetIdleTimer ( )

Resets the IdleTimer to 0.

void fCraft.Player.RevertBlock ( Vector3I  coords)

Gets the block from given location in player's world, and sends it (async) to the player. Used to undo player's attempted block placement/deletion.

void fCraft.Player.SelectionAddMark ( Vector3I  pos,
bool  announce,
bool  executeCallbackIfNeeded 
)
void fCraft.Player.SelectionCancel ( )
void fCraft.Player.SelectionExecute ( )
void fCraft.Player.SelectionResetMarks ( )
void fCraft.Player.SelectionStart ( int  marksExpected,
[NotNull] SelectionCallback  callback,
[CanBeNull] object  args,
[CanBeNull] params Permission[]  requiredPermissions 
)
void fCraft.Player.Send ( Packet  packet)

Send packet (thread-safe, async, priority queue). This is used for most packets (movement, chat, etc).

void fCraft.Player.SendBlock ( Vector3I  coords,
Block  block 
)

Sends a block change to THIS PLAYER ONLY. Does not affect the map.

Parameters
coordsCoordinates of the block.
blockBlock type to send.
void fCraft.Player.SendLowPriority ( Packet  packet)

Send packet (thread-safe, asynchronous, delayed queue). This is currently only used for block updates.

void fCraft.Player.SendNow ( Packet  packet)

Send packet to player (not thread safe, sync, immediate). Should NEVER be used from any thread other than this session's ioThread. Not thread-safe (for performance reason).

void fCraft.Player.SendToSpectators ( [NotNull] string  message,
[NotNull] params object[]  formatArgs 
)

Sends a message to all players who are spectating this player, e.g. to forward typed-in commands and PMs. "System color" code (&S) will be prepended to the message. If the message does not fit on one line, prefix ">" is prepended to each wrapped line.

Parameters
messageA composite format string for the message. Same semantics as String.Format().
formatArgsAn object array that contains zero or more objects to format.
Exceptions
ArgumentNullExceptionmessage or formatArgs is null.
FormatExceptionMessage format is invalid.
CopyState fCraft.Player.SetCopyState ( [CanBeNull] CopyState  state)

Stores given CopyState at the currently-selected slot.

Parameters
stateNew content for the current slot. May be a CopyState object, or null.
Returns
Previous contents of the current slot. May be null.
CopyState fCraft.Player.SetCopyState ( [CanBeNull] CopyState  state,
int  slot 
)

Stores given CopyState at the given slot.

Parameters
stateNew content for the given slot. May be a CopyState object, or null.
slotSlot number. Should be between 0 and (MaxCopySlots-1).
Returns
Previous contents of the current slot. May be null.
Exceptions
ArgumentOutOfRangeExceptionslot is not between 0 and (MaxCopySlots-1).
bool fCraft.Player.Spectate ( [NotNull] Player  target)

Starts spectating the given player.

Parameters
targetPlayer to spectate.
Returns
True if this player is now spectating the target. False if this player has already been spectating the target.
Exceptions
ArgumentNullExceptiontarget is null.
PlayerOpExceptionThis player does not have sufficient permissions, or is trying to spectate self.
bool fCraft.Player.StopSpectating ( )

Stops spectating.

Returns
True if this player was spectating someone (and now stopped). False if this player was not spectating anyone.
void fCraft.Player.TeleportTo ( Position  pos)

Teleports player to a given coordinate within this map.

override string fCraft.Player.ToString ( )

Name formatted for the debugger.

void fCraft.Player.UndoClear ( )
UndoState fCraft.Player.UndoPop ( )
bool fCraft.Player.Unignore ( [NotNull] PlayerInfo  other)

Removes a given PlayerInfo from the ignore list.

Parameters
otherPlayerInfo to unignore.
Returns
True if the player is no longer ignored, false if the player was already not ignored.
void fCraft.Player.WaitForDisconnect ( )

Blocks the calling thread until this session disconnects.

Member Data Documentation

int fCraft.Player.AntispamInterval = 4
static

Interval in seconds to record number of message for anti-spam filter

int fCraft.Player.AntispamMessageCount = 3
static

Number of messages in a AntiSpamInterval seconds required to trigger the anti-spam filter

Player fCraft.Player.Console
static

The godly pseudo-player for commands called from the server console. Console has all the permissions granted. Note that Player.Console.World is always null, and that prevents console from calling certain commands (like /TP).

int fCraft.Player.FullPositionUpdateInterval = FullPositionUpdateIntervalDefault
static
const int fCraft.Player.FullPositionUpdateIntervalDefault = 20
readonly bool fCraft.Player.IsSuper
Position fCraft.Player.Position

Player's position in the current world.

Property Documentation

BandwidthUseMode fCraft.Player.BandwidthUseMode
getset
IBrush fCraft.Player.Brush
getset
int fCraft.Player.BytesReceived
getset

Total bytes received (from the client) this session.

double fCraft.Player.BytesReceivedRate
getset

Bytes received (from the client) per second, averaged over the last several seconds.

int fCraft.Player.BytesSent
getset

Total bytes sent (to the client) this session.

double fCraft.Player.BytesSentRate
getset

Bytes sent (to the client) per second, averaged over the last several seconds.

string fCraft.Player.ClassyName
get

Name formatted for display in chat.

ConfirmationCallback fCraft.Player.ConfirmCallback
getset

Callback to be called when player types in "/ok" to confirm an action. Use Player.Confirm(...) methods to set this.

object fCraft.Player.ConfirmParameter
getset

Custom parameter to be passed to Player.ConfirmCallback.

DateTime fCraft.Player.ConfirmRequestTime
getset

Time when the confirmation was requested. UTC.

int fCraft.Player.CopySlot
getset

Gets or sets the currently selected copy slot number. Should be between 0 and (MaxCopySlots-1). Note that fCraft adds 1 to CopySlot number when presenting it to players. So 0th slot is shown as "1st" by /CopySlot and related commands; 1st is shown as "2nd", etc.

CopyState [] fCraft.Player.CopyStates
get

Returns a list of all CopyStates, indexed by slot.

bool fCraft.Player.DisableClickToMark
getset

Whether clicks should be registered towards selection marks.

bool fCraft.Player.HasFullyConnected
getset

Whether the player registered and then finished loading the world.

bool fCraft.Player.HasRegistered
getset

Whether the player has completed the login sequence.

TimeSpan fCraft.Player.IdleTime
get

Time since the player was last active (moved, talked, or clicked).

PlayerInfo [] fCraft.Player.IgnoreList
get

Returns a list of all currently-ignored players.

PlayerInfo fCraft.Player.Info
getset

Persistent information record associated with this player.

IPAddress fCraft.Player.IP
getset

Remote IP address of this player.

bool fCraft.Player.IsDeaf
getset

Whether player has blocked all incoming chat. Deaf players can't hear anything.

bool fCraft.Player.IsMakingSelection
get

Whether player is currently making a selection.

bool fCraft.Player.IsOnline
get

Whether the client is currently connected.

bool fCraft.Player.IsPainting
getset

Whether the player is in paint mode (deleting blocks replaces them). Used by /Paint.

bool fCraft.Player.IsRepeatingSelection
getset

Whether player is repeating a selection (/static)

bool fCraft.Player.IsSpectating
get

Whether this player is currently spectating someone.

bool fCraft.Player.IsUsingWoM
getset

Whether the client supports advanced WoM client functionality.

bool fCraft.Player.IsVerified
getset

Whether the player name was verified at login.

DateTime fCraft.Player.LastActiveTime
getset

Last time when the player was active (moving/messaging). UTC.

CommandReader fCraft.Player.LastCommand
getset

Last command called by the player.

DrawOperation fCraft.Player.LastDrawOp
getset
DateTime fCraft.Player.LastPatrolTime
getset

Last time when this player was patrolled by someone.

PlayerInfo fCraft.Player.LastSpectatedPlayer
getset

While spectating, currently-specated player. When not spectating, most-recently-spectated player.

Block fCraft.Player.LastUsedBlockType
getset

Last blocktype used by the player. Make sure to use in conjunction with Player.GetBind() to ensure that bindings are properly applied.

string fCraft.Player.LastUsedPlayerName
getset
string fCraft.Player.LastUsedWorldName
getset
LeaveReason fCraft.Player.LeaveReason
getset

Reason that this player is about to leave / has left the server. Set by Kick. This value is undefined until the player is about to disconnect.

string fCraft.Player.ListName
get

Name formatted for display in the player list.

DateTime fCraft.Player.LoginTime
getset

Time when the session connected.

int fCraft.Player.MaxBlockPlacementRange
staticgetset

Max distance that player may be from a block to reach it (hack detection).

int fCraft.Player.MaxCopySlots
getset

Gets or sets the maximum number of copy slots allocated to this player. Should be nonnegative. CopyStates are preserved when increasing the maximum. When decreasing the value, any CopyStates in slots that fall outside the new maximum are lost.

MetadataCollection<object> fCraft.Player.Metadata
getset

Metadata associated with the session/player.

string fCraft.Player.Name
get

Plain version of the name (no formatting).

bool fCraft.Player.RelayAllUpdates
staticgetset
int fCraft.Player.SelectionMarkCount
get

Number of selection marks so far.

int fCraft.Player.SelectionMarksExpected
getset

Number of marks expected to complete the selection.

int fCraft.Player.SocketTimeout
staticgetset
Player fCraft.Player.SpectatedPlayer
get

Player currently being spectated. Use Spectate/StopSpectate methods to set.

SessionState fCraft.Player.State
getset

Whether the player has completed the login sequence.

World fCraft.Player.World
getset

The world that the player is currently on. May be null. Use .JoinWorld() to make players teleport to another world.

Map fCraft.Player.WorldMap
get

Map from the world that the player is on. Throws PlayerOpException if player does not have a world. Loads the map if it's not loaded. Guaranteed to not return null.

Event Documentation

EventHandler<PlayerBeingKickedEventArgs> fCraft.Player.BeingKicked
static

Occurs before a player is kicked (cancelable). Kick may be caused by /Kick, /Ban, /BanIP, or /BanAll commands, or by idling. Callbacks may override whether the kick will be announced or recorded in PlayerDB.

EventHandler<PlayerClickedEventArgs> fCraft.Player.Clicked
static

Occurs after a player has clicked a block. Note that a click will not necessarily result in a block being placed or deleted.

EventHandler<PlayerClickingEventArgs> fCraft.Player.Clicking
static

Occurs when player clicked a block (cancelable). Note that a click will not necessarily result in a block being placed or deleted.

EventHandler<PlayerConnectedEventArgs> fCraft.Player.Connected
static

Occurs when a player has connected, but before the player has joined any world. Allows changing the player's starting world. Player's state at this point is SessionState.Connecting, and about to change to SessionState.LoadingMain

EventHandler<PlayerConnectingEventArgs> fCraft.Player.Connecting
static

Occurs when a player is connecting (cancelable). Player name is verified and bans are checked before this event is raised, but before the player is registered with the server. Player's state at this point is SessionState.Connecting.

EventHandler<PlayerDisconnectedEventArgs> fCraft.Player.Disconnected
static

Occurs when a player disconnects.

EventHandler<PlayerHideChangedEventArgs> fCraft.Player.HideChanged
static

Happens after a player has hidden or unhidden.

EventHandler<PlayerJoinedWorldEventArgs> fCraft.Player.JoinedWorld
static

Occurs after a player has joined a world.

EventHandler<PlayerJoiningWorldEventArgs> fCraft.Player.JoiningWorld
static

Occurs when a player intends to join a world (cancelable).

EventHandler<PlayerKickedEventArgs> fCraft.Player.Kicked
static

Occurs after a player has been kicked. Specifically, it happens after kick has been announced and recorded to PlayerDB (if applicable), just before the target player disconnects. Kick may be caused by /Kick, /Ban, /BanIP, or /BanAll commands, or by idling.

EventHandler<PlayerMovedEventArgs> fCraft.Player.Moved
static

Occurs when player has moved.

EventHandler<PlayerMovingEventArgs> fCraft.Player.Moving
static

Occurs when player is about to move (cancelable).

EventHandler<PlayerPlacedBlockEventArgs> fCraft.Player.PlacedBlock
static

Occurs when a player has placed a block. This event does not occur if the block placement was disallowed.

EventHandler<PlayerPlacingBlockEventArgs> fCraft.Player.PlacingBlock
static

Occurs when a player is about to place a block. Permission checks are done before calling this event, and their result may be overridden.

EventHandler<PlayerEventArgs> fCraft.Player.Ready
static

Occurs after a player has connected and joined the starting world. Player's state at this point has just changed from SessionState.LoadingMain to SessionState.Online


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