Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | List of all members
cPlayer Class Reference

#include <Player.h>

Inheritance diagram for cPlayer:
Inheritance graph
[legend]
Collaboration diagram for cPlayer:
Collaboration graph
[legend]

Public Types

typedef cWorldcWorldPtr
 
- Public Types inherited from cEntity
enum  eEntityStatus {
  esGenericHurt = 2, esGenericDead = 3, esIronGolemAttacking = 4, esWolfTaming = 6,
  esWolfTamed = 7, esWolfDryingWater = 8, esPlayerEatingAccepted = 9, esSheepEating = 10,
  esIronGolemGivingPlant = 11, esVillagerBreeding = 12, esVillagerAngry = 13, esVillagerHappy = 14,
  esWitchMagicking = 15, esFireworkExploding = 17, esMobInLove = 18
}
 
enum  eEntityType {
  etEntity, etEnderCrystal, etPlayer, etPickup,
  etMonster, etFallingBlock, etMinecart, etBoat,
  etTNT, etProjectile, etExpOrb, etFloater,
  etItemFrame, etPainting, etLeashKnot, etMob = etMonster
}
 

Public Member Functions

void AbortEating (void)
 Aborts the current eating operation. More...
 
void AddFoodExhaustion (double a_Exhaustion)
 Adds the specified exhaustion to m_FoodExhaustion. More...
 
void AddInventoryPaintSlot (int a_SlotNum)
 Adds a slot to the list for inventory painting. More...
 
virtual void ApplyArmorDamage (int DamageBlocked) override
 Applies damage to the armor after the armor blocked the given amount. More...
 
virtual void AttachTo (cEntity *a_AttachTo) override
 Attaches to the specified entity; detaches from any previous one first. More...
 
unsigned int AwardAchievement (const eStatistic a_Ach)
 Awards the player an achievement. More...
 
void CancelChargingBow (void)
 Cancels the current bow charging. More...
 
virtual bool CanFly (void) const
 Returns wheter the player can fly or not. More...
 
bool CanMobsTarget (void) const
 Returns true if the player can be targeted by Mobs. More...
 
void ClearInventoryPaintSlots (void)
 Clears the list of slots that are being inventory-painted. More...
 
void CloseWindow (bool a_CanRefuse=true)
 Closes the current window, resets current window to m_InventoryWindow. More...
 
void CloseWindowIfID (char a_WindowID, bool a_CanRefuse=true)
 Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow. More...
 
 cPlayer (cClientHandlePtr a_Client, const AString &a_PlayerName)
 
int DeltaExperience (int a_Xp_delta)
 
virtual void Detach (void) override
 Detaches from the currently attached entity, if any. More...
 
bool DoesPlacingBlocksIntersectEntity (const sSetBlockVector &a_Blocks)
 Whether placing the given blocks would intersect any entitiy. More...
 
virtual bool DoMoveToWorld (cWorld *a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition) override
 Moves the player to the specified world. More...
 
bool Feed (int a_Food, double a_Saturation)
 Adds to FoodLevel and FoodSaturationLevel, returns true if any food has been consumed, false if player "full". More...
 
int FinishChargingBow (void)
 Finishes charging the current bow. More...
 
void FinishEating (void)
 Finishes eating the currently equipped item. More...
 
void ForceSetSpeed (const Vector3d &a_Speed)
 Forces the player to move in the given direction. More...
 
void Freeze (const Vector3d &a_Location)
 Prevent the player from moving and lock him into a_Location. More...
 
cWorldGetBedWorld ()
 
cClientHandleGetClientHandle (void) const
 Returns the raw client handle associated with the player. More...
 
cClientHandlePtr GetClientHandlePtr (void) const
 Returns the SharedPtr to client handle associated with the player. More...
 
AString GetColor (void) const
 Returns the full color code to use for this player, based on their rank. More...
 
int GetCurrentXp (void)
 Gets the current experience. More...
 
const AStringGetCustomName (void) const
 Returns the custom name of this player. More...
 
cItemGetDraggingItem (void)
 In UI windows, get the item that the player is dragging. More...
 
eGameMode GetEffectiveGameMode (void) const
 Returns the current effective gamemode (inherited gamemode is resolved before returning) More...
 
cItemGridGetEnderChestContents (void)
 Gets the contents of the player's associated enderchest. More...
 
virtual cItem GetEquippedBoots (void) const override
 Returns the currently equipped boots; empty item if none. More...
 
virtual cItem GetEquippedChestplate (void) const override
 Returns the currently equipped chestplate; empty item if none. More...
 
virtual cItem GetEquippedHelmet (void) const override
 Returns the currently equipped helmet; empty item if none. More...
 
const cItemGetEquippedItem (void) const
 
virtual cItem GetEquippedLeggings (void) const override
 Returns the currently equipped leggings; empty item if none. More...
 
virtual cItem GetEquippedWeapon (void) const override
 Returns the currently equipped weapon; empty item if none. More...
 
double GetEyeHeight (void) const
 
Vector3d GetEyePosition (void) const
 
UInt32 GetFloaterID (void) const
 
double GetFlyingMaxSpeed (void) const
 Gets the flying relative maximum speed. More...
 
double GetFoodExhaustionLevel (void) const
 
int GetFoodLevel (void) const
 
double GetFoodSaturationLevel (void) const
 
int GetFoodTickTimer (void) const
 
eGameMode GetGameMode (void) const
 Returns the current gamemode. More...
 
cInventoryGetInventory (void)
 
const cInventoryGetInventory (void) const
 
const cSlotNumsGetInventoryPaintSlots (void) const
 Returns the list of slots currently stored for inventory painting. More...
 
AString GetIP (void) const
 
Vector3i GetLastBedPos (void) const
 Gets the last position that the player slept in This is initialised to the world spawn point if the player has not slept in a bed as of yet. More...
 
const AStringGetLoadedWorldName ()
 
eMainHand GetMainHand (void) const
 
double GetMaxSpeed (void) const
 Returns the current relative maximum speed (takes current sprinting / flying state into account) More...
 
const AStringGetName (void) const
 
double GetNormalMaxSpeed (void) const
 Gets the normal relative maximum speed. More...
 
virtual cItem GetOffHandEquipedItem (void) const override
 Returns the currently offhand equipped item; empty item if none. More...
 
const AStringVectorGetPermissions (void) const
 Returns all the permissions that the player has assigned to them. More...
 
AString GetPlayerListName (void) const
 Returns the name that is used in the playerlist. More...
 
float GetPlayerRelativeBlockHardness (BLOCKTYPE a_Block)
 Returns the relative block hardness for the block a_Block. More...
 
AString GetPrefix (void) const
 Returns the player name prefix, may contain @ format directives. More...
 
const AStringVectorGetRestrictions (void) const
 Returns all the restrictions that the player has assigned to them. More...
 
int GetSkinParts (void) const
 
double GetSprintingMaxSpeed (void) const
 Gets the sprinting relative maximum speed. More...
 
double GetStance (void) const
 
cStatManagerGetStatManager ()
 Return the associated statistic and achievement manager. More...
 
AString GetSuffix (void) const
 Returns the player name suffix, may contain @ format directives. More...
 
cTeamGetTeam (void)
 Returns the associated team, nullptr if none. More...
 
Vector3d GetThrowSpeed (double a_SpeedCoeff) const
 Returns the initial speed vector of a throw, with a 3D length of a_SpeedCoeff. More...
 
Vector3d GetThrowStartPos (void) const
 Returns the position where projectiles thrown by this player should start, player eye position + adjustment. More...
 
const cUUIDGetUUID (void) const
 Returns the UUID that has been read from the client, or nil if not available. More...
 
cWindowGetWindow (void)
 
const cWindowGetWindow (void) const
 
int GetXpLevel (void)
 Gets the current level - XpLevel. More...
 
int GetXpLifetimeTotal (void)
 Gets the experience total - XpTotal for score on death. More...
 
float GetXpPercentage (void)
 Gets the experience bar percentage - XpP. More...
 
virtual void HandlePhysics (std::chrono::milliseconds a_Dt, cChunk &) override
 Handles the physics of the entity - updates position based on speed, updates speed based on environment. More...
 
bool HasCustomName (void) const
 Returns true if the player has a custom name. More...
 
bool HasPermission (const AString &a_Permission)
 
bool HasSkinPart (eSkinPart a_Part) const
 
virtual void Heal (int a_Health) override
 Heals the player by the specified amount of HPs (positive only); sends health update. More...
 
virtual bool Initialize (OwnedEntity a_Self, cWorld &a_World) override
 Spawns the entity in the world; returns true if spawned, false if not (plugin disallowed). More...
 
bool IsChargingBow (void) const
 Returns true if the player is currently charging the bow. More...
 
bool IsClimbing (void) const
 Returns whether the player is climbing (ladders, vines etc.) More...
 
virtual bool IsCrouched (void) const override
 
bool IsEating (void) const
 Returns true if the player is currently in the process of eating the currently equipped item. More...
 
virtual bool IsFireproof () const override
 Returns true if the player is fireproof Stops players burning in creative or spectator modes. More...
 
bool IsFishing (void) const
 Returns true if the player has thrown out a floater. More...
 
bool IsFlying (void) const
 Returns true if the player is currently flying. More...
 
bool IsFrozen ()
 Is the player frozen? More...
 
bool IsGameModeAdventure (void) const
 Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current world. More...
 
bool IsGameModeCreative (void) const
 Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world. More...
 
bool IsGameModeSpectator (void) const
 Returns true if the player is in Spectator mode, either explicitly, or by inheriting from current world. More...
 
bool IsGameModeSurvival (void) const
 Returns true if the player is in Survival mode, either explicitly, or by inheriting from current world. More...
 
bool IsInBed (void) const
 Returns true if a player is sleeping in a bed. More...
 
virtual bool IsOnGround (void) const override
 Returns whether the entity is on ground or not. More...
 
virtual bool IsRclking (void) const override
 
bool IsSatiated (void) const
 Returns true if the player is satiated, i. More...
 
virtual bool IsSprinting (void) const override
 
bool IsVisible (void) const
 
virtual void Killed (cEntity *a_Victim) override
 Called when the entity kills another entity. More...
 
virtual void KilledBy (TakeDamageInfo &a_TDI) override
 Called when the health drops below zero. More...
 
bool LoadFromDisk (cWorldPtr &a_World)
 Loads the player data from the disk file Sets a_World to the world where the player will spawn, based on the stored world name or the default world by calling LoadFromFile() Returns true on success, false on failure. More...
 
bool LoadFromFile (const AString &a_FileName, cWorldPtr &a_World)
 Loads the player data from the specified file Sets a_World to the world where the player will spawn, based on the stored world name or the default world Returns true on success, false on failure. More...
 
void LoadRank (void)
 (Re)loads the rank and permissions from the cRankManager. More...
 
void NotifyNearbyWolves (cPawn *a_Opponent, bool a_IsPlayerInvolved)
 Notify nearby wolves that the player or one of the player's wolves took damage or did damage to an entity. More...
 
void OpenHorseInventory ()
 Opens the inventory of any tame horse the player is riding. More...
 
void OpenWindow (cWindow &a_Window)
 Opens the specified window; closes the current one first using CloseWindow() More...
 
bool PlaceBlock (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Calls the block-placement hook and places the block in the world, unless refused by the hook. More...
 
bool PlaceBlocks (const sSetBlockVector &a_Blocks)
 Calls the block placement hooks and places the blocks in the world. More...
 
void RemoveClientHandle (void)
 Called by cClientHandle when the client is being destroyed. More...
 
void Respawn (void)
 
bool SaveToDisk (void)
 Saves all player data, such as inventory, to JSON. More...
 
void SendAboveActionBarMessage (const AString &a_Message)
 
void SendAboveActionBarMessage (const cCompositeChat &a_Message)
 
void SendBlocksAround (int a_BlockX, int a_BlockY, int a_BlockZ, int a_Range=1)
 Sends the block in the specified range around the specified coord to the client as a block change packet. More...
 
void SendExperience (void)
 
void SendHealth (void)
 
void SendHotbarActiveSlot (void)
 
void SendMessage (const AString &a_Message)
 
void SendMessage (const cCompositeChat &a_Message)
 
void SendMessageFailure (const AString &a_Message)
 
void SendMessageFatal (const AString &a_Message)
 
void SendMessageInfo (const AString &a_Message)
 
void SendMessagePrivateMsg (const AString &a_Message, const AString &a_Sender)
 
void SendMessageRaw (const AString &a_MessageRaw, eChatType a_Type=eChatType::ctChatBox)
 
void SendMessageSuccess (const AString &a_Message)
 
void SendMessageWarning (const AString &a_Message)
 
void SendRotation (double a_YawDegrees, double a_PitchDegrees)
 Sends the "look" packet to the player, forcing them to set their rotation to the specified values. More...
 
void SendSystemMessage (const AString &a_Message)
 
void SendSystemMessage (const cCompositeChat &a_Message)
 
void SetBedPos (const Vector3i &a_Pos)
 Sets the player's bed (home / respawn) position to the specified position. More...
 
void SetBedPos (const Vector3i &a_Pos, cWorld *a_World)
 Sets the player's bed (home / respawn) position and respawn world to the specified parameters. More...
 
void SetCanFly (bool a_CanFly)
 If true the player can fly even when he's not in creative. More...
 
void SetCapabilities ()
 
void SetCrouch (bool a_IsCrouched)
 Sets the crouch status, broadcasts to all visible players. More...
 
bool SetCurrentExperience (int a_XpTotal)
 Sets the experience total Returns true on success "should" really only be called at init or player death, plugins excepted. More...
 
void SetCustomName (const AString &a_CustomName)
 Sets the custom name of this player. More...
 
void SetDraggingItem (const cItem &a_Item)
 In UI windows, set the item that the player is dragging. More...
 
void SetFlying (bool a_IsFlying)
 Flags the player as flying. More...
 
void SetFlyingMaxSpeed (double a_Speed)
 Sets the flying relative maximum speed. More...
 
void SetFoodExhaustionLevel (double a_FoodExhaustionLevel)
 
void SetFoodLevel (int a_FoodLevel)
 
void SetFoodSaturationLevel (double a_FoodSaturationLevel)
 
void SetFoodTickTimer (int a_FoodTickTimer)
 
void SetGameMode (eGameMode a_GameMode)
 Sets the gamemode for the player. More...
 
void SetIP (const AString &a_IP)
 
void SetIsFishing (bool a_IsFishing, UInt32 a_FloaterID=cEntity::INVALID_ID)
 
void SetIsInBed (bool a_Flag)
 Sets a player's in-bed state We can't be sure plugins will keep this value updated, so no exporting If value is false (not in bed), will update players of the fact that they have been ejected from the bed. More...
 
void SetMainHand (eMainHand a_Hand)
 
void SetName (const AString &a_Name)
 
void SetNormalMaxSpeed (double a_Speed)
 Sets the normal relative maximum speed. More...
 
void SetSkinParts (int a_Parts)
 
void SetSprint (bool a_IsSprinting)
 Starts or stops sprinting, sends the max speed update to the client, if needed. More...
 
void SetSprintingMaxSpeed (double a_Speed)
 Sets the sprinting relative maximum speed. More...
 
void SetStance (const double a_Stance)
 
void SetTeam (cTeam *a_Team)
 Sets the player team, nullptr if none. More...
 
void SetTouchGround (bool a_bTouchGround)
 
void SetVisible (bool a_bVisible)
 
virtual void SpawnOn (cClientHandle &a_Client) override
 Descendants override this function to send a command to the specified client to spawn the entity on the client. More...
 
void StartChargingBow (void)
 Starts charging the equipped bow. More...
 
void StartEating (void)
 Starts eating the currently equipped item. More...
 
virtual void TeleportToCoords (double a_PosX, double a_PosY, double a_PosZ) override
 Teleports to the coordinates specified. More...
 
virtual void Tick (std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
 
void TickFreezeCode ()
 
void TossEquippedItem (char a_Amount=1)
 tosses the item in the selected hotbar slot More...
 
void TossHeldItem (char a_Amount=1)
 tosses the item held in hand (when in UI windows) More...
 
void TossPickup (const cItem &a_Item)
 tosses a pickup newly created from a_Item More...
 
void Unfreeze ()
 Cancels Freeze(...) and allows the player to move naturally. More...
 
void UpdateMovementStats (const Vector3d &a_DeltaPos, bool a_PreviousIsOnGround)
 Update movement-related statistics. More...
 
cTeamUpdateTeam (void)
 Forces the player to query the scoreboard for his team. More...
 
void UseEquippedItem (short a_Damage=1)
 Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted. More...
 
void UseEquippedItem (cItemHandler::eDurabilityLostAction a_Action)
 Damage the player's equipped item by the amount of damage such an item is damaged by when used for a_Action. More...
 
void UseItem (int a_SlotNumber, short a_Damage=1)
 Damage the item in a_SlotNumber by a_Damage, possibly less if the equipped item is enchanted. More...
 
virtual ~cPlayer () override
 
- Public Member Functions inherited from cPawn
void AddEntityEffect (cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier=1)
 Applies an entity effect. More...
 
void ClearEntityEffects (void)
 Removes all currently applied entity effects (used when drinking milk) More...
 
 cPawn (eEntityType a_EntityType, double a_Width, double a_Height)
 
cEntityEffectGetEntityEffect (cEntityEffect::eType a_EffectType)
 Returns the entity effect, if it is currently applied or nullptr if not. More...
 
std::map< cEntityEffect::eType, cEntityEffect * > GetEntityEffects ()
 Returns all entity effects. More...
 
virtual void HandleAir (void) override
 Called in each tick to handle air-related processing i.e. More...
 
virtual void HandleFalling (void)
 
bool HasEntityEffect (cEntityEffect::eType a_EffectType) const
 Returns true, if the entity effect is currently applied. More...
 
virtual bool IsInvisible () const override
 
void NoLongerTargetingMe (cMonster *a_Monster)
 Remove the monster from the list of monsters targeting this pawn. More...
 
void RemoveEntityEffect (cEntityEffect::eType a_EffectType)
 Removes a currently applied entity effect. More...
 
void StopEveryoneFromTargetingMe ()
 Tells all pawns which are targeting us to stop targeting us. More...
 
void TargetingMe (cMonster *a_Monster)
 Add the monster to the list of monsters targeting this pawn. More...
 
virtual ~cPawn () override
 
- Public Member Functions inherited from cEntity
void AddLeashedMob (cMonster *a_Monster)
 Adds a mob to the leashed list of mobs. More...
 
void AddPosition (double a_AddPosX, double a_AddPosY, double a_AddPosZ)
 
void AddPosition (const Vector3d &a_AddPos)
 
void AddPosX (double a_AddPosX)
 
void AddPosY (double a_AddPosY)
 
void AddPosZ (double a_AddPosZ)
 
void AddSpeed (double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeedZ)
 
void AddSpeed (const Vector3d &a_AddSpeed)
 
void AddSpeedX (double a_AddSpeedX)
 
void AddSpeedY (double a_AddSpeedY)
 
void AddSpeedZ (double a_AddSpeedZ)
 
virtual bool ArmorCoversAgainst (eDamageType a_DamageType)
 Returns whether armor will protect against the specified damage type. More...
 
virtual void BroadcastMovementUpdate (const cClientHandle *a_Exclude=nullptr)
 Updates clients of changes in the entity. More...
 
 cEntity (eEntityType a_EntityType, Vector3d a_Pos, double a_Width, double a_Height)
 
virtual void Destroy (bool a_ShouldBroadcast=true)
 Destroys the entity and schedules it for memory freeing; if a_ShouldBroadcast is set to true, broadcasts the DestroyEntity packet. More...
 
void DestroyNoScheduling (bool a_ShouldBroadcast)
 Destroy the entity without scheduling memory freeing. More...
 
virtual void DetectCacti (void)
 Detects the time for application of cacti damage. More...
 
virtual bool DetectPortal (void)
 Detects whether we are in a portal block and begins teleportation procedures if so Returns true if MoveToWorld() was called, false if not. More...
 
virtual bool DoesPreventBlockPlacement (void) const
 Returns whether blocks can be placed intersecting this entities' hitbox. More...
 
float GetAirDrag (void) const
 
int GetAirLevel (void) const
 Gets remaining air of a monster. More...
 
virtual int GetArmorCoverAgainst (const cEntity *a_Attacker, eDamageType a_DamageType, int a_RawDamage)
 Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover. More...
 
cEntityGetAttached ()
 Gets entity (vehicle) attached to this entity. More...
 
int GetChunkX (void) const
 
int GetChunkZ (void) const
 
virtual const char * GetClass (void) const
 Returns the topmost class name for the object. More...
 
virtual void GetDrops (cItems &a_Drops, cEntity *a_Killer=nullptr)
 Returns the list of drops for this pawn when it is killed. More...
 
virtual float GetEnchantmentBlastKnockbackReduction ()
 Returns explosion knock back reduction percent from blast protection level. More...
 
virtual int GetEnchantmentCoverAgainst (const cEntity *a_Attacker, eDamageType a_DamageType, int a_Damage)
 Returns the hitpoints that the currently equipped armor's enchantments would cover. More...
 
eEntityType GetEntityType (void) const
 
float GetGravity (void) const
 
double GetHeadYaw (void) const
 
float GetHealth (void) const
 Returns the health of this entity. More...
 
double GetHeight (void) const
 
int GetInvulnerableTicks (void) const
 Gets the invulnerable ticks from the entity. More...
 
virtual double GetKnockbackAmountAgainst (const cEntity &a_Receiver)
 Returns the knockback amount that the currently equipped items would cause to a_Receiver on a hit. More...
 
Vector3d GetLastSentPos (void) const
 Returns the last position we sent to all the clients. More...
 
Vector3d GetLookVector (void) const
 
double GetMass (void) const
 
float GetMaxHealth (void) const
 
cChunkGetParentChunk ()
 Returns the chunk responsible for ticking this entity. More...
 
const cChunkGetParentChunk () const
 
virtual const char * GetParentClass (void) const
 Returns the topmost class's parent class name for the object. More...
 
double GetPitch (void) const
 
const Vector3dGetPosition (void) const
 Exported in ManualBindings. More...
 
double GetPosX (void) const
 
double GetPosY (void) const
 
double GetPosZ (void) const
 
virtual int GetRawDamageAgainst (const cEntity &a_Receiver)
 Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items. More...
 
double GetRoll (void) const
 
const Vector3dGetSpeed (void) const
 Exported in ManualBindings. More...
 
double GetSpeedX (void) const
 
double GetSpeedY (void) const
 
double GetSpeedZ (void) const
 
long int GetTicksAlive (void) const
 Gets number of ticks this entity has existed for. More...
 
UInt32 GetUniqueID (void) const
 
double GetWidth (void) const
 
cWorldGetWorld (void) const
 
double GetYaw (void) const
 
virtual void HandleSpeedFromAttachee (float a_Forward, float a_Sideways)
 
bool HasAnyMobLeashed () const
 Returs whether the entity has any mob leashed to. More...
 
virtual bool IsA (const char *a_ClassName) const
 Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true) More...
 
bool IsAttachedTo (const cEntity *a_Entity) const
 Returns true if this entity is attached to the specified entity. More...
 
bool IsBoat (void) const
 
bool IsDestroyed () const
 Deprecated. More...
 
bool IsEnderCrystal (void) const
 
bool IsExpOrb (void) const
 
bool IsFallingBlock (void) const
 
bool IsFloater (void) const
 
virtual bool IsHeadInWater (void) const
 Returns true if any part of the entity is in a water block. More...
 
virtual bool IsInFire (void) const
 Returns true if any part of the entity is in a fire block. More...
 
virtual bool IsInLava (void) const
 Returns true if any part of the entity is in a lava block. More...
 
virtual bool IsInWater (void) const
 Returns true if any part of the entity is in a water block. More...
 
bool IsItemFrame (void) const
 
bool IsLeashKnot (void) const
 
bool IsMinecart (void) const
 
bool IsMob (void) const
 
virtual bool IsOnFire (void) const
 
bool IsPainting (void) const
 
bool IsPawn (void) const
 
bool IsPickup (void) const
 
bool IsPlayer (void) const
 
bool IsProjectile (void) const
 
virtual bool IsRiding (void) const
 
bool IsTicking (void) const
 Returns true if the entity is valid and ticking. More...
 
bool IsTNT (void) const
 
bool MoveToWorld (cWorld *a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition)
 
bool MoveToWorld (cWorld *a_World, bool a_ShouldSendRespawn=true)
 Moves entity to specified world, taking a world pointer. More...
 
bool MoveToWorld (const AString &a_WorldName, bool a_ShouldSendRespawn=true)
 Moves entity to specified world, taking a world name. More...
 
virtual void OnFinishedBurning (void)
 Called when the entity finishes burning. More...
 
virtual void OnRightClicked (cPlayer &a_Player)
 Called when the specified player right-clicks this entity. More...
 
virtual void OnStartedBurning (void)
 Called when the entity starts burning. More...
 
void RemoveLeashedMob (cMonster *a_Monster)
 Removes a mob from the leashed list of mobs. More...
 
void ScheduleMoveToWorld (cWorld *a_World, Vector3d a_NewPosition, bool a_ShouldSetPortalCooldown=false, bool a_ShouldSendRespawn=false)
 Schedules a MoveToWorld call to occur on the next Tick of the entity. More...
 
void SetAirDrag (float a_AirDrag)
 
void SetGravity (float a_Gravity)
 
void SetHeadYaw (double a_HeadYaw)
 
void SetHealth (float a_Health)
 Sets the health of this entity; doesn't broadcast any hurt animation. More...
 
void SetHeight (double a_Height)
 
void SetInvulnerableTicks (int a_InvulnerableTicks)
 Set the invulnerable ticks from the entity. More...
 
void SetIsFireproof (bool a_IsFireproof)
 Sets whether the entity is fireproof. More...
 
void SetIsTicking (bool a_IsTicking)
 Set the entity's status to either ticking or not ticking. More...
 
void SetMass (double a_Mass)
 
void SetMaxHealth (float a_MaxHealth)
 Sets the maximum value for the health. More...
 
void SetParentChunk (cChunk *a_Chunk)
 Sets the parent chunk, which is the chunk responsible for ticking this entity. More...
 
void SetPitch (double a_Pitch)
 
void SetPitchFromSpeed (void)
 Sets the pitch to match the speed vector (entity gies "face-forward") More...
 
void SetPosition (double a_PosX, double a_PosY, double a_PosZ)
 
void SetPosition (const Vector3d &a_Position)
 
void SetPosX (double a_PosX)
 
void SetPosY (double a_PosY)
 
void SetPosZ (double a_PosZ)
 
void SetRoll (double a_Roll)
 
void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ)
 Sets the speed of the entity, measured in m / sec. More...
 
void SetSpeed (Vector3d a_Speed)
 Sets the speed of the entity, measured in m / sec. More...
 
void SetSpeedX (double a_SpeedX)
 Sets the speed in the X axis, leaving the other speed components intact. More...
 
void SetSpeedY (double a_SpeedY)
 Sets the speed in the Y axis, leaving the other speed components intact. More...
 
void SetSpeedZ (double a_SpeedZ)
 Sets the speed in the Z axis, leaving the other speed components intact. More...
 
void SetWidth (double a_Width)
 
void SetWorld (cWorld *a_World)
 Sets the internal world pointer to a new cWorld, doesn't update anything else. More...
 
void SetYaw (double a_Yaw)
 
void SetYawFromSpeed (void)
 Sets the rotation to match the speed vector (entity goes "face-forward") More...
 
void StartBurning (int a_TicksLeftBurning)
 Puts the entity on fire for the specified amount of ticks. More...
 
void SteerVehicle (float a_Forward, float a_Sideways)
 
void StopBurning (void)
 Stops the entity from burning, resets all burning timers. More...
 
void TakeDamage (cEntity &a_Attacker)
 Makes this pawn take damage from an attack by a_Attacker. More...
 
void TakeDamage (eDamageType a_DamageType, cEntity *a_Attacker, int a_RawDamage, double a_KnockbackAmount)
 Makes this entity take the specified damage. More...
 
void TakeDamage (eDamageType a_DamageType, UInt32 a_Attacker, int a_RawDamage, double a_KnockbackAmount)
 Makes this entity take the specified damage. More...
 
void TakeDamage (eDamageType a_DamageType, cEntity *a_Attacker, int a_RawDamage, float a_FinalDamage, double a_KnockbackAmount)
 Makes this entity take the specified damage. More...
 
virtual void TeleportToEntity (cEntity &a_Entity)
 Teleports to the entity specified. More...
 
virtual void TickBurning (cChunk &a_Chunk)
 Updates the state related to this entity being on fire. More...
 
virtual void TickInVoid (cChunk &a_Chunk)
 Handles when the entity is in the void. More...
 
void WrapHeadYaw ()
 Makes sure head yaw is not over the specified range. More...
 
void WrapRotation ()
 Makes sure rotation is not over the specified range. More...
 
void WrapSpeed ()
 Makes speed is not over 20. More...
 
virtual ~cEntity ()
 

Static Public Member Functions

static int CalcLevelFromXp (int a_CurrentXp)
 Inverse of XpForLevel Ref: https://minecraft.gamepedia.com/XP values are as per this with pre-calculations. More...
 
static bool PermissionMatches (const AStringVector &a_Permission, const AStringVector &a_Template)
 Returns true iff a_Permission matches the a_Template. More...
 
static int XpForLevel (int a_Level)
 Calculates the amount of XP needed for a given level Ref: https://minecraft.gamepedia.com/XP. More...
 
- Static Public Member Functions inherited from cEntity
static const char * GetClassStatic (void)
 Returns the class name of this class. More...
 

Static Public Attributes

static const int EATING_TICKS = 30
 Number of ticks it takes to eat an item. More...
 
static const int MAX_FOOD_LEVEL = 20
 
static const int MAX_HEALTH = 20
 
- Static Public Attributes inherited from cEntity
static const int BURN_DAMAGE = 1
 Damage to deal when the entity is burning. More...
 
static const int BURN_TICKS = 160
 Ticks to keep an entity burning after it has stood in lava / fire. More...
 
static const int BURN_TICKS_PER_DAMAGE = 20
 Ticks to wait between damaging an entity when it is burning. More...
 
static const int DROWNING_TICKS = 20
 Number of ticks per heart of damage. More...
 
static const int FALL_DAMAGE_HEIGHT = 4
 Y difference after which fall damage is applied. More...
 
static const int FIRE_DAMAGE = 1
 Damage to deal when standing in fire. More...
 
static const int FIRE_TICKS_PER_DAMAGE = 10
 Ticks to wait between damaging an entity when it stands in fire. More...
 
static const UInt32 INVALID_ID = 0
 Special ID that is considered an "invalid value", signifying no entity. More...
 
static const int LAVA_DAMAGE = 4
 Damage to deal when standing in lava. More...
 
static const int LAVA_TICKS_PER_DAMAGE = 10
 Ticks to wait between damaging an entity when it stands in lava. More...
 
static const int MAX_AIR_LEVEL = 300
 Maximum air an entity can have. More...
 
static const int VOID_BOUNDARY = -64
 Y position to begin applying void damage. More...
 

Protected Types

enum  { XP_TO_LEVEL15 = 255, XP_PER_LEVEL_TO15 = 17, XP_TO_LEVEL30 = 825 }
 Xp Level stuff. More...
 
typedef std::vector< std::vector< AString > > AStringVectorVector
 
- Protected Types inherited from cPawn
typedef std::map< cEntityEffect::eType, std::unique_ptr< cEntityEffect > > tEffectMap
 

Protected Member Functions

virtual void Destroyed (void) override
 
virtual void DoSetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ) override
 Sets the speed and sends it to the client, so that they are forced to move so. More...
 
virtual bool DoTakeDamage (TakeDamageInfo &TDI) override
 Filters out damage for creative mode / friendly fire. More...
 
virtual float GetExplosionExposureRate (Vector3d a_ExplosionPosition, float a_ExlosionPower) override
 get player explosion exposure rate More...
 
AString GetUUIDFileName (const cUUID &a_UUID)
 Returns the filename for the player data based on the UUID given. More...
 
void HandleFloater (void)
 Called in each tick if the player is fishing to make sure the floater dissapears when the player doesn't have a fishing rod as equipped item. More...
 
void HandleFood (void)
 Called in each tick to handle food-related processing. More...
 
void ResolveGroups (void)
 
void ResolvePermissions (void)
 
void TossItems (const cItems &a_Items)
 Tosses a list of items. More...
 
- Protected Member Functions inherited from cPawn
virtual void ResetPosition (Vector3d a_NewPosition) override
 Set the entities position and last sent position. More...
 
- Protected Member Functions inherited from cEntity
virtual void SetSwimState (cChunk &a_Chunk)
 Called once per tick to set m_IsInFire, m_IsInLava, m_IsInWater and m_IsHeadInWater. More...
 

Protected Attributes

bool m_bDirtyExperience
 
bool m_bIsInBed
 Flag representing whether the player is currently in a bed Set by a right click on unoccupied bed, unset by a time fast forward or teleport. More...
 
bool m_bIsTeleporting
 Flag used by food handling system to determine whether a teleport has just happened Will not apply food penalties if found to be true; will set to false after processing. More...
 
int m_BowCharge
 
bool m_bVisible
 
bool m_CanFly
 
cClientHandlePtr m_ClientHandle
 
cWindowm_CurrentWindow
 
int m_CurrentXp
 
AString m_CustomName
 
cItem m_DraggingItem
 The item being dragged by the cursor while in a UI window. More...
 
Int64 m_EatingFinishTick
 The world tick in which eating will be finished. More...
 
cItemGrid m_EnderChestContents
 An item grid that stores the player specific enderchest contents. More...
 
UInt32 m_FloaterID
 
double m_FlyingMaxSpeed
 Max speed, relative to the game default flying max speed, when flying. More...
 
double m_FoodExhaustionLevel
 A "buffer" which adds up hunger before it is substracted from m_FoodSaturationLevel or m_FoodLevel. More...
 
int m_FoodLevel
 Represents the food bar, one point equals half a "drumstick". More...
 
double m_FoodSaturationLevel
 "Overcharge" for the m_FoodLevel; is depleted before m_FoodLevel More...
 
int m_FoodTickTimer
 Count-up to the healing or damaging action, based on m_FoodLevel. More...
 
eGameMode m_GameMode
 
cInventory m_Inventory
 Stores the player's inventory, consisting of crafting grid, hotbar, and main slots. More...
 
cSlotNums m_InventoryPaintSlots
 
cWindowm_InventoryWindow
 
AString m_IP
 
bool m_IsChargingBow
 
bool m_IsCrouched
 
bool m_IsFishing
 
bool m_IsFlying
 
bool m_IsFrozen
 If true, we are locking m_Position to m_FrozenPosition. More...
 
bool m_IsManuallyFrozen
 Was the player frozen manually by a plugin or automatically by the server? More...
 
bool m_IsSprinting
 
Vector3i m_LastBedPos
 The player's last saved bed position. More...
 
std::chrono::steady_clock::time_point m_LastPlayerListTime
 
int m_LifetimeTotalXp
 Player Xp level. More...
 
AString m_LoadedWorldName
 
eMainHand m_MainHand
 The main hand of the player. More...
 
AString m_MsgNameColorCode
 
AString m_MsgPrefix
 
AString m_MsgSuffix
 
double m_NormalMaxSpeed
 Max speed, relative to the game default. More...
 
AStringVector m_Permissions
 All the permissions that this player has, based on their rank. More...
 
AString m_PlayerName
 
AString m_Rank
 The name of the rank assigned to this player. More...
 
AStringVector m_Restrictions
 All the restrictions that this player has, based on their rank. More...
 
int m_SkinParts
 Displayed skin part bit mask. More...
 
cWorldm_SpawnWorld
 The world which the player respawns in upon death. More...
 
AStringVectorVector m_SplitPermissions
 All the permissions that this player has, based on their rank, split into individual dot-delimited parts. More...
 
AStringVectorVector m_SplitRestrictions
 All the restrictions that this player has, based on their rank, split into individual dot-delimited parts. More...
 
double m_SprintingMaxSpeed
 Max speed, relative to the game default max speed, when sprinting. More...
 
double m_Stance
 
cStatManager m_Stats
 
cTeamm_Team
 
unsigned int m_TicksUntilNextSave
 How long till the player's inventory will be saved Default save interval is #defined in PLAYER_INVENTORY_SAVE_INTERVAL. More...
 
cUUID m_UUID
 The UUID of the player, as read from the ClientHandle. More...
 
- Protected Attributes inherited from cPawn
bool m_bTouchGround
 
tEffectMap m_EntityEffects
 
double m_LastGroundHeight
 
- Protected Attributes inherited from cEntity
float m_AirDrag
 Stores the air drag that is applied to the entity every tick, measured in speed ratio per tick Acts as air friction and slows down flight Will be interpolated if the server tick rate varies Data: https://minecraft.gamepedia.com/Entity#Motion_of_entities. More...
 
int m_AirLevel
 Air level of a mobile. More...
 
int m_AirTickTimer
 
cEntitym_AttachedTo
 The entity to which this entity is attached (vehicle), nullptr if none. More...
 
cEntitym_Attachee
 The entity which is attached to this entity (rider), nullptr if none. More...
 
bool m_bDirtyHead
 Stores whether head yaw has been set manually. More...
 
bool m_bDirtyOrientation
 Stores whether our yaw / pitch / roll (body orientation) has been set manually. More...
 
bool m_bHasSentNoSpeed
 Stores whether we have sent a Velocity packet with a speed of zero (no speed) to the client Ensures that said packet is sent only once. More...
 
bool m_bOnGround
 Stores if the entity is on the ground. More...
 
eEntityType m_EntityType
 
float m_Gravity
 Stores gravity that is applied to an entity every tick For realistic effects, this should be negative. More...
 
float m_Health
 
bool m_IsFireproof
 Whether the entity is capable of taking fire or lava damage. More...
 
bool m_IsHeadInWater
 If the entity's head is in a water block. More...
 
bool m_IsInFire
 If any part of the entity is in a fire block. More...
 
bool m_IsInLava
 If any part of the entity is in a lava block. More...
 
bool m_IsInWater
 If any part of the entity is in a water block. More...
 
bool m_IsWorldChangeScheduled
 State variables for ScheduleMoveToWorld. More...
 
Vector3d m_LastPosition
 
float m_MaxHealth
 
cWorldm_NewWorld
 
Vector3d m_NewWorldPosition
 
sPortalCooldownData m_PortalCooldownData
 Portal delay timer and cooldown boolean data. More...
 
Vector3d m_Speed
 Measured in meters / second (m / s) More...
 
long int m_TicksAlive
 The number of ticks this entity has been alive for. More...
 
int m_TicksLeftBurning
 Time, in ticks, until the entity extinguishes its fire. More...
 
int m_TicksSinceLastBurnDamage
 Time, in ticks, since the last damage dealt by being on fire. More...
 
int m_TicksSinceLastFireDamage
 Time, in ticks, since the last damage dealt by standing in fire. More...
 
int m_TicksSinceLastLavaDamage
 Time, in ticks, since the last damage dealt by standing in lava. More...
 
int m_TicksSinceLastVoidDamage
 Time, in ticks, since the last damage dealt by the void. More...
 
UInt32 m_UniqueID
 The ID of the entity that is guaranteed to be unique within a single run of the server. More...
 
cWorldm_World
 
bool m_WorldChangeSendRespawn
 
bool m_WorldChangeSetPortalCooldown
 

Private Types

typedef cPawn super
 

Private Member Functions

void FreezeInternal (const Vector3d &a_Location, bool a_ManuallyFrozen)
 Pins the player to a_Location until Unfreeze() is called. More...
 
float GetDigSpeed (BLOCKTYPE a_Block)
 Returns the dig speed using the current tool on the block a_Block. More...
 
float GetLiquidHeightPercent (NIBBLETYPE a_Meta)
 Returns how high the liquid is in percent. More...
 
bool IsInsideWater ()
 Checks if the player is inside of water. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from cEntity
static void ApplyFriction (Vector3d &a_Speed, double a_SlowdownMultiplier, float a_Dt)
 Applies friction to an entity. More...
 

Detailed Description

Definition at line 27 of file Player.h.

Member Typedef Documentation

typedef std::vector<std::vector<AString> > cPlayer::AStringVectorVector
protected

Definition at line 587 of file Player.h.

Definition at line 397 of file Player.h.

typedef cPawn cPlayer::super
private

Definition at line 30 of file Player.h.

Member Enumeration Documentation

anonymous enum
protected

Xp Level stuff.

Enumerator
XP_TO_LEVEL15 
XP_PER_LEVEL_TO15 
XP_TO_LEVEL30 

Definition at line 615 of file Player.h.

Constructor & Destructor Documentation

cPlayer::cPlayer ( cClientHandlePtr  a_Client,
const AString a_PlayerName 
)

Definition at line 88 of file Player.cpp.

cPlayer::~cPlayer ( void  )
overridevirtual

Definition at line 206 of file Player.cpp.

Member Function Documentation

void cPlayer::AbortEating ( void  )

Aborts the current eating operation.

Definition at line 726 of file Player.cpp.

void cPlayer::AddFoodExhaustion ( double  a_Exhaustion)

Adds the specified exhaustion to m_FoodExhaustion.

Expects only positive values.

Definition at line 672 of file Player.cpp.

void cPlayer::AddInventoryPaintSlot ( int  a_SlotNum)

Adds a slot to the list for inventory painting.

To be used by cWindow only

Definition at line 783 of file Player.cpp.

void cPlayer::ApplyArmorDamage ( int  DamageBlocked)
overridevirtual

Applies damage to the armor after the armor blocked the given amount.

Reimplemented from cEntity.

Definition at line 987 of file Player.cpp.

void cPlayer::AttachTo ( cEntity a_AttachTo)
overridevirtual

Attaches to the specified entity; detaches from any previous one first.

Reimplemented from cEntity.

Definition at line 2858 of file Player.cpp.

unsigned int cPlayer::AwardAchievement ( const eStatistic  a_Ach)

Awards the player an achievement.

If all prerequisites are met, this method will award the achievement and will broadcast a chat message. If the achievement has been already awarded to the player, this method will just increment the stat counter. Returns the new stat value. (0 = Could not award achievement)

Definition at line 1605 of file Player.cpp.

int cPlayer::CalcLevelFromXp ( int  a_CurrentXp)
static

Inverse of XpForLevel Ref: https://minecraft.gamepedia.com/XP values are as per this with pre-calculations.

Definition at line 425 of file Player.cpp.

void cPlayer::CancelChargingBow ( void  )

Cancels the current bow charging.

Definition at line 571 of file Player.cpp.

virtual bool cPlayer::CanFly ( void  ) const
inlinevirtual

Returns wheter the player can fly or not.

Definition at line 526 of file Player.h.

bool cPlayer::CanMobsTarget ( void  ) const

Returns true if the player can be targeted by Mobs.

Definition at line 1296 of file Player.cpp.

void cPlayer::ClearInventoryPaintSlots ( void  )

Clears the list of slots that are being inventory-painted.

To be used by cWindow only

Definition at line 773 of file Player.cpp.

void cPlayer::CloseWindow ( bool  a_CanRefuse = true)

Closes the current window, resets current window to m_InventoryWindow.

A plugin may refuse the closing if a_CanRefuse is true

Definition at line 1370 of file Player.cpp.

void cPlayer::CloseWindowIfID ( char  a_WindowID,
bool  a_CanRefuse = true 
)

Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow.

Definition at line 1395 of file Player.cpp.

int cPlayer::DeltaExperience ( int  a_Xp_delta)

Definition at line 511 of file Player.cpp.

void cPlayer::Destroyed ( void  )
overrideprotectedvirtual

Reimplemented from cPawn.

Definition at line 230 of file Player.cpp.

void cPlayer::Detach ( void  )
overridevirtual

Detaches from the currently attached entity, if any.

Reimplemented from cEntity.

Definition at line 2875 of file Player.cpp.

bool cPlayer::DoesPlacingBlocksIntersectEntity ( const sSetBlockVector a_Blocks)

Whether placing the given blocks would intersect any entitiy.

Definition at line 2722 of file Player.cpp.

bool cPlayer::DoMoveToWorld ( cWorld a_World,
bool  a_ShouldSendRespawn,
Vector3d  a_NewPosition 
)
overridevirtual

Moves the player to the specified world.

Returns true if successful, false on failure (world not found).

Reimplemented from cEntity.

Definition at line 2006 of file Player.cpp.

void cPlayer::DoSetSpeed ( double  a_SpeedX,
double  a_SpeedY,
double  a_SpeedZ 
)
overrideprotectedvirtual

Sets the speed and sends it to the client, so that they are forced to move so.

Reimplemented from cEntity.

Definition at line 1748 of file Player.cpp.

bool cPlayer::DoTakeDamage ( TakeDamageInfo TDI)
overrideprotectedvirtual

Filters out damage for creative mode / friendly fire.

Reimplemented from cEntity.

Definition at line 1001 of file Player.cpp.

bool cPlayer::Feed ( int  a_Food,
double  a_Saturation 
)

Adds to FoodLevel and FoodSaturationLevel, returns true if any food has been consumed, false if player "full".

Definition at line 656 of file Player.cpp.

int cPlayer::FinishChargingBow ( void  )

Finishes charging the current bow.

Returns the number of ticks for which the bow has been charged

Definition at line 556 of file Player.cpp.

void cPlayer::FinishEating ( void  )

Finishes eating the currently equipped item.

Consumes the item, updates health and broadcasts the packets

Definition at line 698 of file Player.cpp.

void cPlayer::ForceSetSpeed ( const Vector3d a_Speed)

Forces the player to move in the given direction.

Deprecated:
Use SetSpeed instead.

Definition at line 1739 of file Player.cpp.

void cPlayer::Freeze ( const Vector3d a_Location)

Prevent the player from moving and lock him into a_Location.

Definition at line 1666 of file Player.cpp.

void cPlayer::FreezeInternal ( const Vector3d a_Location,
bool  a_ManuallyFrozen 
)
private

Pins the player to a_Location until Unfreeze() is called.

If ManuallyFrozen is false, the player will unfreeze when the chunk is loaded.

Definition at line 2950 of file Player.cpp.

cWorld * cPlayer::GetBedWorld ( )

Definition at line 959 of file Player.cpp.

cClientHandle* cPlayer::GetClientHandle ( void  ) const
inline

Returns the raw client handle associated with the player.

Definition at line 254 of file Player.h.

cClientHandlePtr cPlayer::GetClientHandlePtr ( void  ) const
inline

Returns the SharedPtr to client handle associated with the player.

Definition at line 259 of file Player.h.

AString cPlayer::GetColor ( void  ) const

Returns the full color code to use for this player, based on their rank.

The returned value either is empty, or includes the cChatColor::Delimiter.

Definition at line 1854 of file Player.cpp.

int cPlayer::GetCurrentXp ( void  )
inline

Gets the current experience.

Definition at line 97 of file Player.h.

const AString& cPlayer::GetCustomName ( void  ) const
inline

Returns the custom name of this player.

If the player hasn't a custom name, it will return an empty string.

Definition at line 491 of file Player.h.

float cPlayer::GetDigSpeed ( BLOCKTYPE  a_Block)
private

Returns the dig speed using the current tool on the block a_Block.

Returns one if using hand. If the player is using a tool that is good to break the block the value is higher. If he has an enchanted tool with efficiency or he has a haste or mining fatique effect it gets multiplied by a specific factor depending on the strength of the effect or enchantment. In he is in water it gets divided by 5 except his tool is enchanted with aqa affinity. If he is not on ground it also gets divided by 5.

Definition at line 3016 of file Player.cpp.

cItem& cPlayer::GetDraggingItem ( void  )
inline

In UI windows, get the item that the player is dragging.

Definition at line 437 of file Player.h.

eGameMode cPlayer::GetEffectiveGameMode ( void  ) const
inline

Returns the current effective gamemode (inherited gamemode is resolved before returning)

Definition at line 179 of file Player.h.

cItemGrid& cPlayer::GetEnderChestContents ( void  )
inline

Gets the contents of the player's associated enderchest.

Definition at line 140 of file Player.h.

virtual cItem cPlayer::GetEquippedBoots ( void  ) const
inlineoverridevirtual

Returns the currently equipped boots; empty item if none.

Reimplemented from cEntity.

Definition at line 72 of file Player.h.

virtual cItem cPlayer::GetEquippedChestplate ( void  ) const
inlineoverridevirtual

Returns the currently equipped chestplate; empty item if none.

Reimplemented from cEntity.

Definition at line 66 of file Player.h.

virtual cItem cPlayer::GetEquippedHelmet ( void  ) const
inlineoverridevirtual

Returns the currently equipped helmet; empty item if none.

Reimplemented from cEntity.

Definition at line 63 of file Player.h.

const cItem& cPlayer::GetEquippedItem ( void  ) const
inline

Definition at line 142 of file Player.h.

virtual cItem cPlayer::GetEquippedLeggings ( void  ) const
inlineoverridevirtual

Returns the currently equipped leggings; empty item if none.

Reimplemented from cEntity.

Definition at line 69 of file Player.h.

virtual cItem cPlayer::GetEquippedWeapon ( void  ) const
inlineoverridevirtual

Returns the currently equipped weapon; empty item if none.

Reimplemented from cEntity.

Definition at line 60 of file Player.h.

float cPlayer::GetExplosionExposureRate ( Vector3d  a_ExplosionPosition,
float  a_ExlosionPower 
)
overrideprotectedvirtual

get player explosion exposure rate

Reimplemented from cEntity.

Definition at line 3079 of file Player.cpp.

double cPlayer::GetEyeHeight ( void  ) const

Definition at line 1242 of file Player.cpp.

Vector3d cPlayer::GetEyePosition ( void  ) const

Definition at line 1251 of file Player.cpp.

UInt32 cPlayer::GetFloaterID ( void  ) const
inline

Definition at line 355 of file Player.h.

double cPlayer::GetFlyingMaxSpeed ( void  ) const
inline

Gets the flying relative maximum speed.

Definition at line 464 of file Player.h.

double cPlayer::GetFoodExhaustionLevel ( void  ) const
inline

Definition at line 325 of file Player.h.

int cPlayer::GetFoodLevel ( void  ) const
inline

Definition at line 322 of file Player.h.

double cPlayer::GetFoodSaturationLevel ( void  ) const
inline

Definition at line 323 of file Player.h.

int cPlayer::GetFoodTickTimer ( void  ) const
inline

Definition at line 324 of file Player.h.

eGameMode cPlayer::GetGameMode ( void  ) const
inline

Returns the current gamemode.

Partly OBSOLETE, you should use IsGameModeXXX() functions wherever applicable

Definition at line 176 of file Player.h.

cInventory& cPlayer::GetInventory ( void  )
inline

Definition at line 136 of file Player.h.

const cInventory& cPlayer::GetInventory ( void  ) const
inline

Definition at line 137 of file Player.h.

const cSlotNums & cPlayer::GetInventoryPaintSlots ( void  ) const

Returns the list of slots currently stored for inventory painting.

To be used by cWindow only

Definition at line 793 of file Player.cpp.

AString cPlayer::GetIP ( void  ) const
inline

Definition at line 211 of file Player.h.

Vector3i cPlayer::GetLastBedPos ( void  ) const
inline

Gets the last position that the player slept in This is initialised to the world spawn point if the player has not slept in a bed as of yet.

Definition at line 500 of file Player.h.

float cPlayer::GetLiquidHeightPercent ( NIBBLETYPE  a_Meta)
private

Returns how high the liquid is in percent.

Used by IsInsideWater

Definition at line 2985 of file Player.cpp.

const AString& cPlayer::GetLoadedWorldName ( )
inline

Definition at line 411 of file Player.h.

eMainHand cPlayer::GetMainHand ( void  ) const
inline

Definition at line 548 of file Player.h.

double cPlayer::GetMaxSpeed ( void  ) const

Returns the current relative maximum speed (takes current sprinting / flying state into account)

Definition at line 803 of file Player.cpp.

const AString& cPlayer::GetName ( void  ) const
inline

Definition at line 277 of file Player.h.

double cPlayer::GetNormalMaxSpeed ( void  ) const
inline

Gets the normal relative maximum speed.

Definition at line 458 of file Player.h.

virtual cItem cPlayer::GetOffHandEquipedItem ( void  ) const
inlineoverridevirtual

Returns the currently offhand equipped item; empty item if none.

Reimplemented from cEntity.

Definition at line 75 of file Player.h.

const AStringVector& cPlayer::GetPermissions ( void  ) const
inline

Returns all the permissions that the player has assigned to them.

Definition at line 290 of file Player.h.

AString cPlayer::GetPlayerListName ( void  ) const

Returns the name that is used in the playerlist.

Definition at line 1888 of file Player.cpp.

float cPlayer::GetPlayerRelativeBlockHardness ( BLOCKTYPE  a_Block)

Returns the relative block hardness for the block a_Block.

The bigger it is the faster the player can break the block. Returns zero if the block is instant breakable. Otherwise it returns the dig speed (float GetDigSpeed(BLOCKTYPE a_Block)) divided by the block hardness (cBlockInfo::GetHardness(BLOCKTYPE a_Block)) divided by 30 if the player can harvest the block and divided by 100 if he can't.

Definition at line 3066 of file Player.cpp.

AString cPlayer::GetPrefix ( void  ) const

Returns the player name prefix, may contain @ format directives.

Definition at line 1870 of file Player.cpp.

const AStringVector& cPlayer::GetRestrictions ( void  ) const
inline

Returns all the restrictions that the player has assigned to them.

Definition at line 293 of file Player.h.

int cPlayer::GetSkinParts ( void  ) const
inline

Definition at line 545 of file Player.h.

double cPlayer::GetSprintingMaxSpeed ( void  ) const
inline

Gets the sprinting relative maximum speed.

Definition at line 461 of file Player.h.

double cPlayer::GetStance ( void  ) const
inline

Definition at line 135 of file Player.h.

cStatManager& cPlayer::GetStatManager ( )
inline

Return the associated statistic and achievement manager.

Definition at line 225 of file Player.h.

AString cPlayer::GetSuffix ( void  ) const

Returns the player name suffix, may contain @ format directives.

Definition at line 1879 of file Player.cpp.

cTeam* cPlayer::GetTeam ( void  )
inline

Returns the associated team, nullptr if none.

Definition at line 214 of file Player.h.

Vector3d cPlayer::GetThrowSpeed ( double  a_SpeedCoeff) const

Returns the initial speed vector of a throw, with a 3D length of a_SpeedCoeff.

Definition at line 1725 of file Player.cpp.

Vector3d cPlayer::GetThrowStartPos ( void  ) const

Returns the position where projectiles thrown by this player should start, player eye position + adjustment.

Definition at line 1709 of file Player.cpp.

const cUUID& cPlayer::GetUUID ( void  ) const
inline

Returns the UUID that has been read from the client, or nil if not available.

Definition at line 521 of file Player.h.

AString cPlayer::GetUUIDFileName ( const cUUID a_UUID)
protected

Returns the filename for the player data based on the UUID given.

This can be used both for online and offline UUIDs.

Definition at line 2934 of file Player.cpp.

cWindow* cPlayer::GetWindow ( void  )
inline

Definition at line 239 of file Player.h.

const cWindow* cPlayer::GetWindow ( void  ) const
inline

Definition at line 240 of file Player.h.

int cPlayer::GetXpLevel ( void  )

Gets the current level - XpLevel.

Definition at line 469 of file Player.cpp.

int cPlayer::GetXpLifetimeTotal ( void  )
inline

Gets the experience total - XpTotal for score on death.

Definition at line 94 of file Player.h.

float cPlayer::GetXpPercentage ( void  )

Gets the experience bar percentage - XpP.

Definition at line 478 of file Player.cpp.

void cPlayer::HandleFloater ( void  )
protected

Called in each tick if the player is fishing to make sure the floater dissapears when the player doesn't have a fishing rod as equipped item.

Definition at line 2510 of file Player.cpp.

void cPlayer::HandleFood ( void  )
protected

Called in each tick to handle food-related processing.

Definition at line 2454 of file Player.cpp.

virtual void cPlayer::HandlePhysics ( std::chrono::milliseconds  a_Dt,
cChunk a_Chunk 
)
inlineoverridevirtual

Handles the physics of the entity - updates position based on speed, updates speed based on environment.

Reimplemented from cEntity.

Definition at line 57 of file Player.h.

bool cPlayer::HasCustomName ( void  ) const
inline

Returns true if the player has a custom name.

Definition at line 488 of file Player.h.

bool cPlayer::HasPermission ( const AString a_Permission)

Definition at line 1783 of file Player.cpp.

bool cPlayer::HasSkinPart ( eSkinPart  a_Part) const
inline

Definition at line 544 of file Player.h.

void cPlayer::Heal ( int  a_Health)
overridevirtual

Heals the player by the specified amount of HPs (positive only); sends health update.

Reimplemented from cEntity.

Definition at line 601 of file Player.cpp.

bool cPlayer::Initialize ( OwnedEntity  a_Self,
cWorld a_EntityWorld 
)
overridevirtual

Spawns the entity in the world; returns true if spawned, false if not (plugin disallowed).

Adds the entity to the world.

Reimplemented from cEntity.

Definition at line 187 of file Player.cpp.

bool cPlayer::IsChargingBow ( void  ) const
inline

Returns true if the player is currently charging the bow.

Definition at line 128 of file Player.h.

bool cPlayer::IsClimbing ( void  ) const

Returns whether the player is climbing (ladders, vines etc.)

Definition at line 2529 of file Player.cpp.

virtual bool cPlayer::IsCrouched ( void  ) const
inlineoverridevirtual

Reimplemented from cEntity.

Definition at line 568 of file Player.h.

bool cPlayer::IsEating ( void  ) const
inline

Returns true if the player is currently in the process of eating the currently equipped item.

Definition at line 342 of file Player.h.

virtual bool cPlayer::IsFireproof ( void  ) const
inlineoverridevirtual

Returns true if the player is fireproof Stops players burning in creative or spectator modes.

Reimplemented from cPawn.

Definition at line 202 of file Player.h.

bool cPlayer::IsFishing ( void  ) const
inline

Returns true if the player has thrown out a floater.

Definition at line 351 of file Player.h.

bool cPlayer::IsFlying ( void  ) const
inline

Returns true if the player is currently flying.

Definition at line 345 of file Player.h.

bool cPlayer::IsFrozen ( )

Is the player frozen?

Definition at line 1675 of file Player.cpp.

bool cPlayer::IsGameModeAdventure ( void  ) const

Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current world.

Definition at line 1278 of file Player.cpp.

bool cPlayer::IsGameModeCreative ( void  ) const

Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world.

Definition at line 1260 of file Player.cpp.

bool cPlayer::IsGameModeSpectator ( void  ) const

Returns true if the player is in Spectator mode, either explicitly, or by inheriting from current world.

Definition at line 1287 of file Player.cpp.

bool cPlayer::IsGameModeSurvival ( void  ) const

Returns true if the player is in Survival mode, either explicitly, or by inheriting from current world.

Definition at line 1269 of file Player.cpp.

bool cPlayer::IsInBed ( void  ) const
inline

Returns true if a player is sleeping in a bed.

Definition at line 348 of file Player.h.

bool cPlayer::IsInsideWater ( )
private

Checks if the player is inside of water.

Definition at line 2998 of file Player.cpp.

virtual bool cPlayer::IsOnGround ( void  ) const
inlineoverridevirtual

Returns whether the entity is on ground or not.

Reimplemented from cEntity.

Definition at line 134 of file Player.h.

virtual bool cPlayer::IsRclking ( void  ) const
inlineoverridevirtual

Reimplemented from cEntity.

Definition at line 570 of file Player.h.

bool cPlayer::IsSatiated ( void  ) const
inline

Returns true if the player is satiated, i.

e. their foodlevel is at the max and they cannot eat anymore

Definition at line 328 of file Player.h.

virtual bool cPlayer::IsSprinting ( void  ) const
inlineoverridevirtual

Reimplemented from cEntity.

Definition at line 569 of file Player.h.

bool cPlayer::IsVisible ( void  ) const
inline

Definition at line 388 of file Player.h.

void cPlayer::Killed ( cEntity a_Victim)
overridevirtual

Called when the entity kills another entity.

Reimplemented from cEntity.

Definition at line 1177 of file Player.cpp.

void cPlayer::KilledBy ( TakeDamageInfo a_TDI)
overridevirtual

Called when the health drops below zero.

a_TDI's Attacker may be nullptr (environmental damage)

Reimplemented from cPawn.

Definition at line 1078 of file Player.cpp.

bool cPlayer::LoadFromDisk ( cWorldPtr a_World)

Loads the player data from the disk file Sets a_World to the world where the player will spawn, based on the stored world name or the default world by calling LoadFromFile() Returns true on success, false on failure.

Definition at line 2098 of file Player.cpp.

bool cPlayer::LoadFromFile ( const AString a_FileName,
cWorldPtr a_World 
)

Loads the player data from the specified file Sets a_World to the world where the player will spawn, based on the stored world name or the default world Returns true on success, false on failure.

Definition at line 2168 of file Player.cpp.

void cPlayer::LoadRank ( void  )

(Re)loads the rank and permissions from the cRankManager.

Expects the m_UUID member to be valid. Loads the m_Rank, m_Permissions, m_MsgPrefix, m_MsgSuffix and m_MsgNameColorCode members.

Definition at line 2632 of file Player.cpp.

void cPlayer::NotifyNearbyWolves ( cPawn a_Opponent,
bool  a_IsPlayerInvolved 
)

Notify nearby wolves that the player or one of the player's wolves took damage or did damage to an entity.

Parameters
a_Opponentthe opponent we're fighting.
a_IsPlayerInvolvedShould be true if the player took or did damage, and false if one of the player's wolves took or did damage.

Definition at line 1054 of file Player.cpp.

void cPlayer::OpenHorseInventory ( )

Opens the inventory of any tame horse the player is riding.

If the player is not riding a horse or if the horse is untamed, does nothing.

Definition at line 2270 of file Player.cpp.

void cPlayer::OpenWindow ( cWindow a_Window)

Opens the specified window; closes the current one first using CloseWindow()

Definition at line 1349 of file Player.cpp.

bool cPlayer::PermissionMatches ( const AStringVector a_Permission,
const AStringVector a_Template 
)
static

Returns true iff a_Permission matches the a_Template.

A match is defined by either being exactly the same, or each sub-item matches until there's a wildcard in a_Template. Ie. {"a", "b", "c"} matches {"a", "b", "*"} but doesn't match {"a", "b"}

Definition at line 1819 of file Player.cpp.

bool cPlayer::PlaceBlock ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)

Calls the block-placement hook and places the block in the world, unless refused by the hook.

If the hook prevents the placement, sends the current block at the specified coords back to the client. Assumes that the block is in a currently loaded chunk. Returns true if the block is successfully placed.

Definition at line 2671 of file Player.cpp.

bool cPlayer::PlaceBlocks ( const sSetBlockVector a_Blocks)

Calls the block placement hooks and places the blocks in the world.

First the "placing" hooks for all the blocks are called, then the blocks are placed, and finally the "placed" hooks are called. If the any of the "placing" hooks aborts, none of the blocks are placed and the function returns false. Returns true if all the blocks are placed. Assumes that all the blocks are in currently loaded chunks.

Definition at line 2788 of file Player.cpp.

void cPlayer::RemoveClientHandle ( void  )

Called by cClientHandle when the client is being destroyed.

The player removes its m_ClientHandle ownership so that the ClientHandle gets deleted.

Definition at line 2924 of file Player.cpp.

void cPlayer::ResolveGroups ( void  )
protected
void cPlayer::ResolvePermissions ( void  )
protected
void cPlayer::Respawn ( void  )

Definition at line 1204 of file Player.cpp.

bool cPlayer::SaveToDisk ( void  )

Saves all player data, such as inventory, to JSON.

Definition at line 2299 of file Player.cpp.

void cPlayer::SendAboveActionBarMessage ( const AString a_Message)

Definition at line 1498 of file Player.cpp.

void cPlayer::SendAboveActionBarMessage ( const cCompositeChat a_Message)

Definition at line 1516 of file Player.cpp.

void cPlayer::SendBlocksAround ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
int  a_Range = 1 
)

Sends the block in the specified range around the specified coord to the client as a block change packet.

The blocks in range (a_BlockX - a_Range, a_BlockX + a_Range) are sent (NY-metric).

Definition at line 2681 of file Player.cpp.

void cPlayer::SendExperience ( void  )

Definition at line 760 of file Player.cpp.

void cPlayer::SendHealth ( void  )

Definition at line 736 of file Player.cpp.

void cPlayer::SendHotbarActiveSlot ( void  )

Definition at line 748 of file Player.cpp.

void cPlayer::SendMessage ( const AString a_Message)

Definition at line 1408 of file Player.cpp.

void cPlayer::SendMessage ( const cCompositeChat a_Message)

Definition at line 1471 of file Player.cpp.

void cPlayer::SendMessageFailure ( const AString a_Message)

Definition at line 1426 of file Player.cpp.

void cPlayer::SendMessageFatal ( const AString a_Message)

Definition at line 1453 of file Player.cpp.

void cPlayer::SendMessageInfo ( const AString a_Message)

Definition at line 1417 of file Player.cpp.

void cPlayer::SendMessagePrivateMsg ( const AString a_Message,
const AString a_Sender 
)

Definition at line 1462 of file Player.cpp.

void cPlayer::SendMessageRaw ( const AString a_MessageRaw,
eChatType  a_Type = eChatType::ctChatBox 
)

Definition at line 1480 of file Player.cpp.

void cPlayer::SendMessageSuccess ( const AString a_Message)

Definition at line 1435 of file Player.cpp.

void cPlayer::SendMessageWarning ( const AString a_Message)

Definition at line 1444 of file Player.cpp.

void cPlayer::SendRotation ( double  a_YawDegrees,
double  a_PitchDegrees 
)

Sends the "look" packet to the player, forcing them to set their rotation to the specified values.

a_YawDegrees is clipped to range [-180, +180), a_PitchDegrees is clipped to range [-180, +180) but the client only uses [-90, +90]

Definition at line 1698 of file Player.cpp.

void cPlayer::SendSystemMessage ( const AString a_Message)

Definition at line 1489 of file Player.cpp.

void cPlayer::SendSystemMessage ( const cCompositeChat a_Message)

Definition at line 1507 of file Player.cpp.

void cPlayer::SetBedPos ( const Vector3i a_Pos)

Sets the player's bed (home / respawn) position to the specified position.

Sets the respawn world to the player's world.

Definition at line 938 of file Player.cpp.

void cPlayer::SetBedPos ( const Vector3i a_Pos,
cWorld a_World 
)

Sets the player's bed (home / respawn) position and respawn world to the specified parameters.

Definition at line 948 of file Player.cpp.

void cPlayer::SetCanFly ( bool  a_CanFly)

If true the player can fly even when he's not in creative.

Definition at line 900 of file Player.cpp.

void cPlayer::SetCapabilities ( )

Definition at line 1557 of file Player.cpp.

void cPlayer::SetCrouch ( bool  a_IsCrouched)

Sets the crouch status, broadcasts to all visible players.

Definition at line 867 of file Player.cpp.

bool cPlayer::SetCurrentExperience ( int  a_XpTotal)

Sets the experience total Returns true on success "should" really only be called at init or player death, plugins excepted.

Definition at line 491 of file Player.cpp.

void cPlayer::SetCustomName ( const AString a_CustomName)

Sets the custom name of this player.

If you want to disable the custom name, simply set an empty string. The custom name will be used in the tab-list, in the player nametag and in the tab-completion.

Definition at line 915 of file Player.cpp.

void cPlayer::SetDraggingItem ( const cItem a_Item)

In UI windows, set the item that the player is dragging.

Definition at line 1910 of file Player.cpp.

void cPlayer::SetFlying ( bool  a_IsFlying)

Flags the player as flying.

Definition at line 968 of file Player.cpp.

void cPlayer::SetFlyingMaxSpeed ( double  a_Speed)

Sets the flying relative maximum speed.

Sends the update to player, if needed.

Definition at line 851 of file Player.cpp.

void cPlayer::SetFoodExhaustionLevel ( double  a_FoodExhaustionLevel)

Definition at line 647 of file Player.cpp.

void cPlayer::SetFoodLevel ( int  a_FoodLevel)

Definition at line 611 of file Player.cpp.

void cPlayer::SetFoodSaturationLevel ( double  a_FoodSaturationLevel)

Definition at line 629 of file Player.cpp.

void cPlayer::SetFoodTickTimer ( int  a_FoodTickTimer)

Definition at line 638 of file Player.cpp.

void cPlayer::SetGameMode ( eGameMode  a_GameMode)

Sets the gamemode for the player.

The gamemode may be gmNotSet, in that case the player inherits the world's gamemode. Updates the gamemode on the client (sends the packet)

Definition at line 1525 of file Player.cpp.

void cPlayer::SetIP ( const AString a_IP)

Definition at line 1596 of file Player.cpp.

void cPlayer::SetIsFishing ( bool  a_IsFishing,
UInt32  a_FloaterID = cEntity::INVALID_ID 
)
inline

Definition at line 353 of file Player.h.

void cPlayer::SetIsInBed ( bool  a_Flag)
inline

Sets a player's in-bed state We can't be sure plugins will keep this value updated, so no exporting If value is false (not in bed), will update players of the fact that they have been ejected from the bed.

Definition at line 363 of file Player.h.

void cPlayer::SetMainHand ( eMainHand  a_Hand)

Definition at line 2848 of file Player.cpp.

void cPlayer::SetName ( const AString a_Name)
inline

Definition at line 278 of file Player.h.

void cPlayer::SetNormalMaxSpeed ( double  a_Speed)

Sets the normal relative maximum speed.

Sends the update to player, if needed.

Definition at line 823 of file Player.cpp.

void cPlayer::SetSkinParts ( int  a_Parts)

Definition at line 2838 of file Player.cpp.

void cPlayer::SetSprint ( bool  a_IsSprinting)

Starts or stops sprinting, sends the max speed update to the client, if needed.

Definition at line 884 of file Player.cpp.

void cPlayer::SetSprintingMaxSpeed ( double  a_Speed)

Sets the sprinting relative maximum speed.

Sends the update to player, if needed.

Definition at line 837 of file Player.cpp.

void cPlayer::SetStance ( const double  a_Stance)
inline

Definition at line 131 of file Player.h.

void cPlayer::SetTeam ( cTeam a_Team)

Sets the player team, nullptr if none.

Definition at line 1305 of file Player.cpp.

void cPlayer::SetTouchGround ( bool  a_bTouchGround)

Definition at line 583 of file Player.cpp.

void cPlayer::SetVisible ( bool  a_bVisible)

Definition at line 1764 of file Player.cpp.

void cPlayer::SpawnOn ( cClientHandle a_Client)
overridevirtual

Descendants override this function to send a command to the specified client to spawn the entity on the client.

To spawn on all eligible clients, use cChunkMap::BroadcastSpawnEntity()

Implements cEntity.

Definition at line 240 of file Player.cpp.

void cPlayer::StartChargingBow ( void  )

Starts charging the equipped bow.

Definition at line 544 of file Player.cpp.

void cPlayer::StartEating ( void  )

Starts eating the currently equipped item.

Resets the eating timer and sends the proper animation packet

Definition at line 684 of file Player.cpp.

void cPlayer::TeleportToCoords ( double  a_PosX,
double  a_PosY,
double  a_PosZ 
)
overridevirtual

Teleports to the coordinates specified.

Reimplemented from cEntity.

Definition at line 1648 of file Player.cpp.

void cPlayer::Tick ( std::chrono::milliseconds  a_Dt,
cChunk a_Chunk 
)
overridevirtual

Reimplemented from cPawn.

Definition at line 259 of file Player.cpp.

void cPlayer::TickFreezeCode ( )

Definition at line 367 of file Player.cpp.

void cPlayer::TossEquippedItem ( char  a_Amount = 1)

tosses the item in the selected hotbar slot

Definition at line 1923 of file Player.cpp.

void cPlayer::TossHeldItem ( char  a_Amount = 1)

tosses the item held in hand (when in UI windows)

Definition at line 1948 of file Player.cpp.

void cPlayer::TossItems ( const cItems a_Items)
protected

Tosses a list of items.

Definition at line 1987 of file Player.cpp.

void cPlayer::TossPickup ( const cItem a_Item)

tosses a pickup newly created from a_Item

Definition at line 1975 of file Player.cpp.

void cPlayer::Unfreeze ( )

Cancels Freeze(...) and allows the player to move naturally.

Definition at line 1684 of file Player.cpp.

void cPlayer::UpdateMovementStats ( const Vector3d a_DeltaPos,
bool  a_PreviousIsOnGround 
)

Update movement-related statistics.

Definition at line 2556 of file Player.cpp.

cTeam * cPlayer::UpdateTeam ( void  )

Forces the player to query the scoreboard for his team.

Definition at line 1329 of file Player.cpp.

void cPlayer::UseEquippedItem ( short  a_Damage = 1)

Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted.

Definition at line 2397 of file Player.cpp.

void cPlayer::UseEquippedItem ( cItemHandler::eDurabilityLostAction  a_Action)

Damage the player's equipped item by the amount of damage such an item is damaged by when used for a_Action.

Definition at line 2412 of file Player.cpp.

void cPlayer::UseItem ( int  a_SlotNumber,
short  a_Damage = 1 
)

Damage the item in a_SlotNumber by a_Damage, possibly less if the equipped item is enchanted.

Definition at line 2427 of file Player.cpp.

int cPlayer::XpForLevel ( int  a_Level)
static

Calculates the amount of XP needed for a given level Ref: https://minecraft.gamepedia.com/XP.

Definition at line 447 of file Player.cpp.

Member Data Documentation

const int cPlayer::EATING_TICKS = 30
static

Number of ticks it takes to eat an item.

Definition at line 38 of file Player.h.

bool cPlayer::m_bDirtyExperience
protected

Definition at line 702 of file Player.h.

bool cPlayer::m_bIsInBed
protected

Flag representing whether the player is currently in a bed Set by a right click on unoccupied bed, unset by a time fast forward or teleport.

Definition at line 715 of file Player.h.

bool cPlayer::m_bIsTeleporting
protected

Flag used by food handling system to determine whether a teleport has just happened Will not apply food penalties if found to be true; will set to false after processing.

Definition at line 724 of file Player.h.

int cPlayer::m_BowCharge
protected

Definition at line 705 of file Player.h.

bool cPlayer::m_bVisible
protected

Definition at line 622 of file Player.h.

bool cPlayer::m_CanFly
protected

Definition at line 692 of file Player.h.

cClientHandlePtr cPlayer::m_ClientHandle
protected

Definition at line 662 of file Player.h.

cWindow* cPlayer::m_CurrentWindow
protected

Definition at line 645 of file Player.h.

int cPlayer::m_CurrentXp
protected

Definition at line 699 of file Player.h.

AString cPlayer::m_CustomName
protected

Definition at line 730 of file Player.h.

cItem cPlayer::m_DraggingItem
protected

The item being dragged by the cursor while in a UI window.

Definition at line 658 of file Player.h.

Int64 cPlayer::m_EatingFinishTick
protected

The world tick in which eating will be finished.

-1 if not eating

Definition at line 695 of file Player.h.

cItemGrid cPlayer::m_EnderChestContents
protected

An item grid that stores the player specific enderchest contents.

Definition at line 643 of file Player.h.

UInt32 cPlayer::m_FloaterID
protected

Definition at line 707 of file Player.h.

double cPlayer::m_FlyingMaxSpeed
protected

Max speed, relative to the game default flying max speed, when flying.

1 means regular speed, 2 means twice as fast, 0.5 means half-speed. Default value is 1.

Definition at line 685 of file Player.h.

double cPlayer::m_FoodExhaustionLevel
protected

A "buffer" which adds up hunger before it is substracted from m_FoodSaturationLevel or m_FoodLevel.

Each action adds a little

Definition at line 635 of file Player.h.

int cPlayer::m_FoodLevel
protected

Represents the food bar, one point equals half a "drumstick".

Definition at line 626 of file Player.h.

double cPlayer::m_FoodSaturationLevel
protected

"Overcharge" for the m_FoodLevel; is depleted before m_FoodLevel

Definition at line 629 of file Player.h.

int cPlayer::m_FoodTickTimer
protected

Count-up to the healing or damaging action, based on m_FoodLevel.

Definition at line 632 of file Player.h.

eGameMode cPlayer::m_GameMode
protected

Definition at line 654 of file Player.h.

cInventory cPlayer::m_Inventory
protected

Stores the player's inventory, consisting of crafting grid, hotbar, and main slots.

Definition at line 640 of file Player.h.

cSlotNums cPlayer::m_InventoryPaintSlots
protected

Definition at line 664 of file Player.h.

cWindow* cPlayer::m_InventoryWindow
protected

Definition at line 646 of file Player.h.

AString cPlayer::m_IP
protected

Definition at line 655 of file Player.h.

bool cPlayer::m_IsChargingBow
protected

Definition at line 704 of file Player.h.

bool cPlayer::m_IsCrouched
protected

Definition at line 687 of file Player.h.

bool cPlayer::m_IsFishing
protected

Definition at line 690 of file Player.h.

bool cPlayer::m_IsFlying
protected

Definition at line 689 of file Player.h.

bool cPlayer::m_IsFrozen
protected

If true, we are locking m_Position to m_FrozenPosition.

Definition at line 667 of file Player.h.

bool cPlayer::m_IsManuallyFrozen
protected

Was the player frozen manually by a plugin or automatically by the server?

Definition at line 670 of file Player.h.

bool cPlayer::m_IsSprinting
protected

Definition at line 688 of file Player.h.

Vector3i cPlayer::m_LastBedPos
protected

The player's last saved bed position.

Definition at line 649 of file Player.h.

std::chrono::steady_clock::time_point cPlayer::m_LastPlayerListTime
protected

Definition at line 660 of file Player.h.

int cPlayer::m_LifetimeTotalXp
protected

Player Xp level.

Definition at line 698 of file Player.h.

AString cPlayer::m_LoadedWorldName
protected

Definition at line 612 of file Player.h.

eMainHand cPlayer::m_MainHand
protected

The main hand of the player.

Definition at line 736 of file Player.h.

AString cPlayer::m_MsgNameColorCode
protected

Definition at line 609 of file Player.h.

AString cPlayer::m_MsgPrefix
protected

Definition at line 608 of file Player.h.

AString cPlayer::m_MsgSuffix
protected

Definition at line 608 of file Player.h.

double cPlayer::m_NormalMaxSpeed
protected

Max speed, relative to the game default.

1 means regular speed, 2 means twice as fast, 0.5 means half-speed. Default value is 1.

Definition at line 675 of file Player.h.

AStringVector cPlayer::m_Permissions
protected

All the permissions that this player has, based on their rank.

Definition at line 593 of file Player.h.

AString cPlayer::m_PlayerName
protected

Definition at line 611 of file Player.h.

AString cPlayer::m_Rank
protected

The name of the rank assigned to this player.

Definition at line 590 of file Player.h.

AStringVector cPlayer::m_Restrictions
protected

All the restrictions that this player has, based on their rank.

Definition at line 596 of file Player.h.

int cPlayer::m_SkinParts
protected

Displayed skin part bit mask.

Definition at line 733 of file Player.h.

cWorld* cPlayer::m_SpawnWorld
protected

The world which the player respawns in upon death.

Definition at line 652 of file Player.h.

AStringVectorVector cPlayer::m_SplitPermissions
protected

All the permissions that this player has, based on their rank, split into individual dot-delimited parts.

This is used mainly by the HasPermission() function to optimize the lookup.

Definition at line 600 of file Player.h.

AStringVectorVector cPlayer::m_SplitRestrictions
protected

All the restrictions that this player has, based on their rank, split into individual dot-delimited parts.

This is used mainly by the HasPermission() function to optimize the lookup.

Definition at line 604 of file Player.h.

double cPlayer::m_SprintingMaxSpeed
protected

Max speed, relative to the game default max speed, when sprinting.

1 means regular speed, 2 means twice as fast, 0.5 means half-speed. Default value is 1.3.

Definition at line 680 of file Player.h.

double cPlayer::m_Stance
protected

Definition at line 637 of file Player.h.

cStatManager cPlayer::m_Stats
protected

Definition at line 711 of file Player.h.

cTeam* cPlayer::m_Team
protected

Definition at line 709 of file Player.h.

unsigned int cPlayer::m_TicksUntilNextSave
protected

How long till the player's inventory will be saved Default save interval is #defined in PLAYER_INVENTORY_SAVE_INTERVAL.

Definition at line 719 of file Player.h.

cUUID cPlayer::m_UUID
protected

The UUID of the player, as read from the ClientHandle.

If no ClientHandle is given, the UUID is nil.

Definition at line 728 of file Player.h.

const int cPlayer::MAX_FOOD_LEVEL = 20
static

Definition at line 35 of file Player.h.

const int cPlayer::MAX_HEALTH = 20
static

Definition at line 33 of file Player.h.


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