The Player
class represents either an online player or a virtual player (e.g. console)
General guidelines:
- Keep in mind that virtual players have some restrictions
- Prefer Set/Update methods instead of directly setting fields
Virtual players refers to any players that aren't an online/human player
Some examples of virtual players
- The server console (accessible via
Player.Console
) - Executing commands from a relay bot (e.g. a user ran
.x help me
from IRC)
[TODO level restrictions] [TODO IsSuper]
Unique and persistent ID number associated with the name of this player
Remarks
- This field is valid even for virtual players
The IGameSession instance of this online player's current session
Remarks
- For virtual players this field is null
- Generally methods in this class should be used instead of using the
Session
field directly
Sends data directly to this online player's client
Remarks
- For virtual players using this method throws an exception
- Generally other methods should be preferred over using the
Send()
method. For example -
- In Player class: Message, SendBlockchange, SendCpeMessage, SendPosition
-
- In IGameSession class: SendSetReach, SendSpawnEntity etc
- Be careful when using
Send()
, because it allows sending invalid data to clients
Sends a block change/update at the given coordinates to this player
Remarks:
- Does nothing if the given coordinates are outside this player's current level boundaries
Sends a position and orientation update request to this player
Remarks:
- Because of network latency, it usually takes some time before
Pos
field is updated
The name of the Brush this player is currently using
Remarks
- Cannot be null, defaults to
"Normal"
####string DefaultBrushArgs
The default arguments passed to the Brush when the player does not provide explicit arguments to a drawing command
Remarks
- Cannot be null, defaults to
""
The Transform instance this player is currently using
Remarks
- Cannot be null, defaults to
NoTransform.Instance