[This is preliminary documentation and is subject to change.]
Object representing volatile state ("session") of a connected player.
For persistent state of a known player account, see PlayerInfo.
Represents a connection to a Minecraft client. Handles low-level interactions (e.g. networking).
Namespace: fCraftAssembly: fCraft (in fCraft.dll) Version: 0.6.3.1 (0.6.3.1)
Syntax
| C# |
public sealed class Player : IClassy
Members
| All Members | Fields | Properties | Methods | Events |
| Member | Description | |
|---|---|---|
| AntispamInterval | Interval in seconds to record number of message for anti-spam filter | |
| AntispamMessageCount | Number of messages in a AntiSpamInterval seconds required to trigger the anti-spam filter | |
| AutoRank | 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). | |
| BandwidthUseMode | ||
| 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. | |
| Bind(Block, Block) | ||
| Brush | ||
| BytesReceived | Total bytes received (from the client) this session. | |
| BytesReceivedRate | Bytes received (from the client) per second, averaged over the last several seconds. | |
| BytesSent | Total bytes sent (to the client) this session. | |
| BytesSentRate | Bytes sent (to the client) per second, averaged over the last several seconds. | |
| Can(Permission) | Returns true if player has the given permission. | |
| Can(array<Permission>[]()[][]) | Returns true if player has ALL of the given permissions. | |
| Can(Permission, Rank) | Returns true if player has the given permission,
and is allowed to affect players of the given rank. | |
| CanAny(array<Permission>[]()[][]) | Returns true if player has ANY of the given permissions. | |
| CanDraw(Int32) | Returns true if player is allowed to run
draw commands that affect a given number of blocks. | |
| CanJoin(World) | Returns true if player is allowed to join a given world. | |
| CanPlace(Map, Vector3I, Block, BlockChangeContext) | Checks whether player is allowed to place a block on the current world at given coordinates.
Raises the PlayerPlacingBlock event. | |
| CanSee(Player) | 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. | |
| CanSee(World) | Whether this player should see a given world on the /Worlds list by default. | |
| CanSeeMoving(Player) | 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. | |
| CheckPaidStatus(String) | Checks whether a given player has a paid minecraft.net account. | |
| ClassyName | Name formatted for display in chat. | |
| ClearLowPriotityOutputQueue()()()() | ||
| ClearPriorityOutputQueue()()()() | ||
| Clicked | Occurs after a player has clicked a block.
Note that a click will not necessarily result in a block being placed or deleted. | |
| Clicking | Occurs when player clicked a block (cancelable).
Note that a click will not necessarily result in a block being placed or deleted. | |
| Confirm(CommandReader, String, array<Object>[]()[][]) | 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. | |
| Confirm(ConfirmationCallback, Object, String, array<Object>[]()[][]) | Request player to confirm an action.
Player is prompted to type "/ok", and when he/she does, custom callback will be called | |
| ConfirmCallback | Callback to be called when player types in "/ok" to confirm an action.
Use Player.Confirm(...) methods to set this. | |
| ConfirmParameter | Custom parameter to be passed to Player.ConfirmCallback. | |
| ConfirmRequestTime | Time when the confirmation was requested. UTC. | |
| 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 | |
| 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. | |
| 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). | |
| ContainsValidCharacters(String) | Ensures that a player name has the correct length and character set. | |
| CopyInformation | ||
| CopySlot | ||
| DisableClickToMark | Whether clicks should be registered towards selection marks. | |
| Disconnected | Occurs when a player disconnects. | |
| DrawBegin(DrawOperation) | ||
| Equals(Object) | (Inherited from Object.) | |
| Finalize()()()() |
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.) | |
| FullPositionUpdateInterval | ||
| FullPositionUpdateIntervalDefault | ||
| GetBind(Block) | ||
| GetCopyInformation()()()() | ||
| GetHashCode()()()() |
Serves as a hash function for a particular type.
(Inherited from Object.) | |
| GetType()()()() |
Gets the Type of the current instance.
(Inherited from Object.) | |
| HasFullyConnected | Whether the player registered and then finished loading the world. | |
| HasRegistered | Whether the player has completed the login sequence. | |
| HideChanged | Happens after a player has hidden or unhidden. | |
| IdleTime | Time since the player was last active (moved, talked, or clicked). | |
| Ignore(PlayerInfo) | Adds a given PlayerInfo to the ignore list.
Not that ignores are not persistent, and are reset when a player disconnects. | |
| IgnoreList | Returns a list of all currently-ignored players. | |
| Info | Persistent information record associated with this player. | |
| IP | ||
| IsDeaf | Whether player has blocked all incoming chat.
Deaf players can't hear anything. | |
| IsIgnoring(PlayerInfo) | Checks whether this player is currently ignoring a given PlayerInfo. | |
| IsMakingSelection | Whether player is currently making a selection. | |
| IsOnline | Whether the client is currently connected. | |
| IsPainting | Whether the player is in paint mode (deleting blocks replaces them). Used by /Paint. | |
| IsRepeatingSelection | Whether player is repeating a selection (/static) | |
| IsSpectating | ||
| IsSuper | ||
| IsUsingWoM | Whether the client supports advanced WoM client functionality. | |
| IsValidName(String) | Ensures that a player name has the correct length and character set. | |
| IsVerified | Whether the player name was verified at login. | |
| JoinedWorld | Occurs after a player has joined a world. | |
| JoiningWorld | Occurs when a player intends to join a world (cancelable). | |
| JoinWorld(World, WorldChangeReason) | ||
| JoinWorld(World, WorldChangeReason, Position) | ||
| Kick(String, LeaveReason) | Kick (asynchronous). Immediately blocks all client input, but waits
until client thread has sent the kick packet. | |
| Kick(Player, String, LeaveReason, Boolean, Boolean, Boolean) | Advanced kick command. | |
| 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. | |
| LastActiveTime | Last time when the player was active (moving/messaging). UTC. | |
| LastCommand | Last command called by the player. | |
| LastDrawOp | ||
| LastPatrolTime | Last time when this player was patrolled by someone. | |
| LastSpectatedPlayer | ||
| LastUsedBlockType | Last blocktype used by the player.
Make sure to use in conjunction with Player.GetBind() to ensure that bindings are properly applied. | |
| LastUsedPlayerName | ||
| LastUsedWorldName | ||
| LeaveReason | ||
| ListName | Name formatted for display in the player list. | |
| LoginTime | Time when the session connected. | |
| MaxBlockPlacementRange | Max distance that player may be from a block to reach it (hack detection). | |
| MemberwiseClone()()()() |
Creates a shallow copy of the current Object.
(Inherited from Object.) | |
| Message(String, array<Object>[]()[][]) | ||
| MessageInvalidPlayerName(String) | Prints "___ is not a valid player name" message. | |
| MessageInvalidWorldName(String) | Prints "Unacceptable world name" message, and requirements for world names. | |
| MessageManyMatches(String, IEnumerable<(Of <<'(IClassy>)>>)) | Prints a comma-separated list of matches (up to 30): "More than one ___ matched: ___, ___, ..." | |
| MessageMaxTimeSpan()()()() | Prints "Specify a time range up to ___" message | |
| MessageMuted()()()() | Prints "You are muted for ___ longer" message. | |
| MessageNoAccess(CommandDescriptor) | Prints "This command requires ___+ rank" message. | |
| MessageNoAccess(array<Permission>[]()[][]) | Prints "This command requires ___+ rank" message. | |
| MessageNoPlayer(String) | Prints "No players found matching ___" message. | |
| MessageNoRank(String) | Prints "Unrecognized rank ___" message. | |
| MessageNoWorld(String) | Prints "No worlds found matching ___" message. | |
| MessageNoZone(String) | Prints "No zones found matching ___" message. | |
| MessagePrefixed(String, String, array<Object>[]()[][]) | ||
| MessageUnsafePath()()()() | Prints "You cannot access files outside the map folder." message. | |
| MessageWoMAlert(String, array<Object>[]()[][]) | ||
| Metadata | Metadata associated with the session/player. | |
| Moved | Occurs when player has moved. | |
| Moving | Occurs when player is about to move (cancelable). | |
| Name | Plain version of the name (no formatting). | |
| ParseMessage(String, Boolean) | Parses a message on behalf of this player. | |
| PlaceBlock(Vector3I, ClickAction, Block) | Handles manually-placed/deleted blocks.
Returns true if player's action should result in a kick. | |
| PlacedBlock | Occurs when a player has placed a block.
This event does not occur if the block placement was disallowed. | |
| 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. | |
| Position | Player's position in the current world. | |
| 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 | |
| RedoClear()()()() | ||
| RelayAllUpdates | ||
| ResetAllBinds()()()() | ||
| ResetBind(Block) | ||
| ResetBind(array<Block>[]()[][]) | ||
| ResetIdleTimer()()()() | Resets the IdleTimer to 0. | |
| RevertBlock(Vector3I) | 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. | |
| SelectionAddMark(Vector3I, Boolean) | ||
| SelectionCancel()()()() | ||
| SelectionExecute()()()() | ||
| SelectionMarkCount | Number of selection marks so far. | |
| SelectionMarksExpected | Number of marks expected to complete the selection. | |
| SelectionResetMarks()()()() | ||
| SelectionStart(Int32, SelectionCallback, Object, array<Permission>[]()[][]) | ||
| Send(Packet) | Send packet (thread-safe, async, priority queue).
This is used for most packets (movement, chat, etc). | |
| SendBlock(Vector3I, Block) | Sends a block change to THIS PLAYER ONLY. Does not affect the map. | |
| SendLowPriority(Packet) | Send packet (thread-safe, asynchronous, delayed queue).
This is currently only used for block updates. | |
| SendNow(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). | |
| SendToSpectators(String, array<Object>[]()[][]) | Sends a message to all players who are spectating this player, e.g. to forward typed-in commands and PMs. | |
| SetCopyInformation(CopyState) | ||
| SocketTimeout | ||
| Spectate(Player) | ||
| SpectatedPlayer | Player currently being spectated. Use Spectate/StopSpectate methods to set. | |
| State | Whether the player has completed the login sequence. | |
| StopSpectating()()()() | ||
| TeleportTo(Position) | Teleports player to a given coordinate within this map. | |
| ToString()()()() | Name formatted for the debugger. (Overrides Object..::..ToString()()()().) | |
| UndoClear()()()() | ||
| UndoPop()()()() | ||
| Unignore(PlayerInfo) | Removes a given PlayerInfo from the ignore list. | |
| WaitForDisconnect()()()() | Blocks the calling thread until this session disconnects. | |
| World | The world that the player is currently on. May be null.
Use .JoinWorld() to make players teleport to another world. | |
| WorldMap | 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. |