Table of Contents

Interface IPlayer

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Represents a player

public interface IPlayer

Properties

ClientId

The players current client id, 0 if not connected. This is the number thats assigned by the server for any connecting player. You probably don't need this number.

int ClientId { get; }

Property Value

int

CurrentBlockSelection

The block the player is currently aiming at

BlockSelection CurrentBlockSelection { get; }

Property Value

BlockSelection

CurrentEntitySelection

The entity the player is currently aiming at

EntitySelection CurrentEntitySelection { get; }

Property Value

EntitySelection

Entitlements

List of the users entitlements, vanilla servers will list VIV and/or VS Team member entitlements

List<Entitlement> Entitlements { get; }

Property Value

List<Entitlement>

Entity

The entity the player currently controls

EntityPlayer Entity { get; }

Property Value

EntityPlayer

Groups

The players player group memberships

PlayerGroupMembership[] Groups { get; }

Property Value

PlayerGroupMembership[]

ImmersiveFpMode

bool ImmersiveFpMode { get; }

Property Value

bool

InventoryManager

Returns the given players inventory manager that let's you do various interesting things with the players inventory.

IPlayerInventoryManager InventoryManager { get; }

Property Value

IPlayerInventoryManager

PlayerName

Get the players character name. The character name can be changed every 60 days in the account manager, so don't consider the players name as a unique identifier for a player. Use PlayerUID instead

string PlayerName { get; }

Property Value

string

PlayerUID

Returns the players identifier that is unique across all registered players and will never change. Use this to uniquely identify a player for all eternity. Shorthand for WorldData.PlayerUID

string PlayerUID { get; }

Property Value

string

Privileges

The list of privileges the player currently has access to (by role or direct assignment) This list is available for the playing player on the client, but not for other players.

string[] Privileges { get; }

Property Value

string[]

Role

Returns the players privilege role

IPlayerRole Role { get; set; }

Property Value

IPlayerRole

WorldData

Some world-specific information about the player. This object is stored with the save game. If you modify it server side, be sure to call player.BroadcastPlayerData() to send it to affected clients.

IWorldPlayerData WorldData { get; }

Property Value

IWorldPlayerData

Methods

GetGroup(int)

Returns the membership data if player is part of this group, otherwise null

PlayerGroupMembership GetGroup(int groupId)

Parameters

groupId int

Returns

PlayerGroupMembership

GetGroups()

Load the players group that he is a member of

PlayerGroupMembership[] GetGroups()

Returns

PlayerGroupMembership[]

HasPrivilege(string)

Check if a player has the given privilege

bool HasPrivilege(string privilegeCode)

Parameters

privilegeCode string

The privilege to check

Returns

bool

true if the player has the given privilege, false otherwise