Skip to content

Player Functions Document

TRCStudioDean edited this page Jun 3, 2025 · 7 revisions

About

This is some player instance functions based on the BukkitAPI, written based on BukkitAPI/Minecraft 1.16.5, so some properties may not be effective (this feature will continue to be expanded and optimized in the future) Here's a brief explanation: This type of function is abbreviated as preset function, which only provides preset packaging for some original functions in the Bukkit API. It can specify the effective player and may include more detailed parameter settings. Some preset functions have specialized presets in the command executor settings, such as sending messages, executing commands, etc.

Basic Format: [PlayerName]:[FunctionName]:[Options]...

If the expression already contains a colon : , you can escape it by adding a back slash \ in front to avoid recognizing the segment symbol. (For example \: )

Supplementary explanation

In this document, all options for [Item] can be either the Item ID or the item name in the Item Collection.
In addition, versions below 1.12.2 have special values for some items.
For example, the Golden Apple and the Enchanted Golden Apple are both GOLDEN_APPLE, but if the special value of the regular Golden Apple is 0 and the special value of the Enchanted Golden Apple is 1, then [Item] can be written as [ItemID-SpecialValue].


Preset Functions

Click the function name to view details. The function name and effect are explained by BukkitAPI JavaDoc

Function Name Action
Attack Attack a player
AddScoreboardTag Add scoreboard tag
Chat Manipulate player to chat
Damage Suffer certain damage
GiveExp Give experiences
GiveExpLevels Give experience levels
HidePlayer Hidden player
KickPlayer Kick out player from server
LoadData Load player's data
PerformCommand Manipulate player to execute command
PlaySound Play sound
RecalculatePermissions Recalculate permissions
Remove Remove player's entity
RemoveScoreboardTag Remove scoreboard tag
ResetMaxHealth Reset max health
ResetPlayerTime Reset player time
ResetPlayerWeather Reset player weather
SaveData Save player data
SendMessage Send message to player
SendRawMessage Send raw message to player
SendSignChange Send sign change
SetAbsorptionAmount Set absorption amount
SetAllowFlight Set weather player can fly
SetArrowInBody Set the number of arrows in body
SetBedSpawnLocation Set bed spawn location
SetCanPickupItems Set can pickup items
SetCollidable Set collidable
SetCompassTarget Set compass target
SetCooldown Set the cooldown for an item
SetCustomNameVisible Set custom name visible
SetDisplayName Set display name
SetExhaustion Set exhaustion
SetExp Set experience value
SetFallDistance Set fall distance
SetFireTicks Set fire ticks
SetFlySpeed Set fly speed
SetFlying Set flying
SetFoodLevel Set food level
SetGameMode Set game mode
SetGliding Set gliding
SetGlowing Set glowing
SetGravity Set gravity
SetHealth Set health
SetHealthScale Set health scale
SetHealthScaled Set health scaled
SetInvisible Set invisible
SetInvulnerable Set invulnerable
SetItemInHand Set item in hand
SetItemOnCursor Set item on cursor
SetLastDamage Set last damage
SetLevel Set level
SetMaxHealth Set max health
SetMaximumAir Set maximum air
SetMaximumNoDamageTicks Set maximum no damage ticks
SetNoDamageTicks Set no damage ticks
SetOp Set operator
SetPlayerListFooter Set player list(TAB) footer
SetPlayerListHeader Set player list(TAB) header
SetPlayerListHeaderFooter Set player list(TAB) header and footer
SetPlayerListName Set player display name in player list (TAB)
SetPlayerTime Set player time
SetPlayerWeather Set player weather
SetPortalCooldown Set portal cooldown
SetRemainingAir Set remaining air
SetRemoveWhenFarAway Set remove when far away
SetResourcePack Set resource pack's URL
SetRotation Set player's rotation
SetSaturatedRegenRate Set saturated regen rage
SetSaturation Set saturation
SetSlient Set slient
SetSleepingIgnored Set sleeping ignored
SetSneaking Set sneaking
SetSprinting Set sprinting
SetStarvationRate Set starvation rate
SetSwimming Set swimming
SetTexturePack Set texture pack
SetTicksLived Set ticks lived
SetTotalExperience Set total experience
SetUnsaturatedRegenRate Set unsaturated regen rate
SetVelocity Set velocity (3D Vector)
SetWalkSpeed Set walk speed
SetWhitelisted Set whitelisted
Sleep Make player sleep
SpawnParticle Spawn particle
StopSound Stop sound
SwingMainHand Swing main hand
SwingOffHand Swing off hand
Teleport Teleport to a location
UpdateCommands Update commands
UpdateInventory Update inventory

Attack

Action: Attack a player
Description: Makes this player attack the given player with a melee attack. Attack damage is calculated by the server from the attributes and equipment of this mob, and knockback is applied to target as appropriate.
Format: [PlayerName]:Attack:[TargetPlayer]
Example: 'Steve:Attack:Alex' #Makes Steve attack Alex

AddScoreboardTag

Action: Add scoreboard tag
Description: Add a tag to this player.
Format: [PlayerName]:AddScoreboardTag:[Tag]
Example: 'Steve:AddScoreboardTag:Test' #Add a scoreboard tag named 'Test'

Chat

Action: Manipulate player to chat
Format: [PlayerName]:Chat:[Text]
Example: 'Steve:Chat:Hello World' #Manipulate Steve to say "Hello World"

Damage

Action: Suffer certain damage
Format: [PlayerName]:Damage:[Number]:[Source]
Example:

  • 'Steve:Damage:10' #Take 10 damage directly to Steve
  • 'Steve:Damage:10:Alex' #Take 10 damage directly to Steve, and detemine this damage to come from Alex's attack

GiveExp

Action: Give experiences
Format: [PlayerName]:GiveExp:[Number]
Example: 'Steve:GiveExp:10' #Give 10 experiences to Steve

GiveExpLevels

Action: Give experience levels
Format: [PlayerName]:GiveExpLevels:[Number]
Example: 'Steve:GiveExpLevels:10' #Give 10 experience levels to Steve

HidePlayer

Action: hidden player
Description: Hides a player from this player
Format: [PlayerName]:HidePlayer:[TargetPlayer]
Example: 'Steve:HidePlayer:Alex' #Hides Steve from Alex

KickPlayer

Action: Kick out player from server
Format: [PlayerName]:KickPlayer:[Reason]
Example: 'Steve:KickPlayer:Example reason' #Kicking Steve out of the server under the reason of "Example reason"

LoadData

Action: Load player data
Description: Loads the players current location, health, inventory, motion, and other information from the username.dat file, in the world/player folder.
Format: [PlayerName]:LoadData
Example: 'Steve:LoadData'

PerformCommand

Action: Manipulate player to execute command
Description: Makes the player perform the given command
Format: [PlayerName]:PerformCommand:[Command]
Example: 'Steve:PerformCommand:say Hello World' #Manipulate Steve to execute "/say Hello World"

PlaySound

Action: Play sound
Format: [PlayerName]:PlaySound:[Sound]:[Volume]:[Pitch]
Tip: Use the command to view a list of sounds: /lce tools listNames sound
Example: 'Steve:PlaySound:UI_BUTTON_CLICK:1:1' #Play the sound UI_BUTTON_CLICK to Steve, with a volume of 1 and a pitch of 1

RecalculatePermissions

Action: Recalculate permissions
Format: [PlayerName]:RecalculatePermissions
Example: 'Steve:RecalculatePermissions'

Remove

Action: Remove player's entity
Format: [PlayerName]:Remove
Example: 'Steve:Remove'

RemoveScoreboardTag

Action: Remove scoreboard tag
Format: [PlayerName]:RemoveScoreboardTag:[Tag]
Example: 'Steve:RemoveScoreboardTag:Test' #Remove a scoreboard tag named Test

ResetMaxHealth

Action: Reset max health
Format: [PlayerName]:ResetMaxHealth
Example: 'Steve:ResetMaxHealth'

ResetPlayerTime

Action: Reset player time
Description: Restores the normal condition where the player's time is synchronized with the server time
Format: [PlayerName]:ResetPlayerTime
Example: 'Steve:ResetPlayerTime'

ResetPlayerWeather

Action: Reset player weather
Description: Restores the normal condition where the player's weather is controlled by server conditions.
Format: [PlayerName]:ResetPlayerWeather
Example: 'Steve:ResetPlayerWeather'

SaveData

Action: Save player data
Description: Saves the players current location, health, inventory, motion, and other information into the username.dat file, in the world/player folder
Format: [PlayerName]:SaveData
Example: 'Steve:SaveData'

SendMessage

Action: Send message to player
Tip: You can use "&" as the color symbol
Format: [PlayerName]:SendMessage:[Text]
Example: 'Steve:SendMessage:Hello World!'

SendRawMessage

Action: Send raw message to player
Tip: You can use "&" as the color symbol
Format: [PlayerName]:SendRawMessage:[Text]
Example: 'Steve:SendRawMessage:Hello World!'

SendSignChange

Action: Send sign change
Description: Send a sign change. This fakes a sign change packet for a user at a certain location. This will not actually change the world in any way.
Format: [PlayerName]:SendSignChange:[WorldName]:[X]:[Y]:[Z]:[FirstLine]:[SecondLine]:[ThirdLine]:[FourthLine]
Example: 'Steve:SendSignChange:world:0:0:0:TestLine1:::TestLine4' #Send Steve a fake sign change packet located in the world X=0, Y=0, Z=0, with the first line being "TestLine1", the second and third lines having no content, and the fourth line being "TestLine4"

SetAbsorptionAmount

Action: Set absorption amount
Format: [PlayerName]:SetAbsorptionAmount:[Number]
Example: 'Steve:SetAbsorptionAmount:10' #Set a damage absorption value for Steve that can offset 10 damage

SetAllowFlight

Action: Set allow flight
Format: [PlayerName]:SetAllowFlight:[true/false]
Example: 'Steve:SetAllowFlight:true'

SetArrowInBody

Action: Set the number of arrows in body
Format: [PlayerName]:SetArrowInBody:[IntegerNumber]
Example: 'Steve:SetArrowInBody:10'

SetBedSpawnLocation

Action: Set bed spawn location
Format: [PlayerName]:SetBedSpawnLocation:[WorldName]:[X]:[Y]:[Z]
Example: 'Steve:SetBedSpawnLocation:world:0:0:0' #Set Steve's bed spawn location to X=0, Y=0, Z=0 in the world named "world"

SetCanPickupItems

Action: Set can pickup items
Format: [PlayerName]:SetCanPickupItems:[true/false]
Example: 'Steve:SetCanPickupItems:false'

SetCollidable

Action: Set collidable
Description: Set if this player will be subject to collisions other entities.
Format: [PlayerName]:SetCollidable:[true/false]
Example: 'Steve:SetCollidable'

SetCompassTarget

Action: Set compass target
Format: [PlayerName]:SetCompassTarget:[WorldName]:[X]:[Y]:[Z]
Example: 'Steve:SetCompassTarget:world:0:0:0'

SetCooldown

Action: Set the cooldown for an item
Format: [PlayerName]:SetCooldown:[Item]:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetCooldown:ENDER_PEARL:20'

SetCustomNameVisible

Action: Set custom name visible
Format: [PlayerName]:SetCustomNameVisible:[true/false]
Example: 'Steve:SetCustomNameVisible:true'

SetDisplayName

Action: Set display name
Tip: You can use "&" as the color symbol
Format: [PlayerName]:SetDisplayName:[DisplayName]
Example: 'Steve:SetDisplayName:[Admin] Steve' #Set display name of Steve to "[Admin] Steve"

SetExhaustion

Action: Set exhaustion
Format: [PlayerName]:SetExhaustion:[Number]
Example: 'Steve:SetExhaustion:1.5'

SetExp

Action: Set experiences
Format: [PlayerName]:SetExp:[Number]
Example: 'Steve:SetExp:10'

SetFallDistance

Action: Set fall distance
Format: [PlayerName]:SetFallDistance:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetFallDistance:10'

SetFireTicks

Action: Set fire ticks
Format: [PlayerName]:SetFireTicks:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetFireTicks:10' #Add up to 100 ticks (approximately 5 seconds) of flame attachment time to Steve

SetFlySpeed

Action: Set fly speed
Format: [PlayerName]:SetFlySpeed:[Number]
Example: 'Steve:SetFlySpeed:10'

SetFlying

Action: Set flying
Format: [PlayerName]:SetFlying:[true/false]
Example: 'Steve:SetFlying:false'

SetFoodLevel

Action: Set food level
Format: [PlayerName]:SetFoodLevel:[Number]
Example: 'Steve:SetFoodLevel:10'

SetGameMode

Action: Set game mode
Format: [PlayerName]:SetGameMode:[GameMode]
Tip: Game mode can be: CREATIVE, SURVIVAL, ADVENTURE, SPECTATOR
Example: 'Steve:SetGameMode:CREATIVE' #Change Steve's game mode to creative mode

SetGliding

Action: Set gliding
Format: [PlayerName]:SetGliding:[true/false]
Example: 'Steve:SetGliding:true'

SetGlowing

Action: Set glowing
Format: [PlayerName]:SetGlowing:[true/false]
Example: 'Steve:SetGlowing:true'

SetGravity

Action: Set gravity
Format: [PlayerName]:SetGravity:[true/false]
Example: 'Steve:SetGravity:true'

SetHealth

Action: Set health
Format: [PlayerName]:SetHealth:[Number]
Example: 'Steve:SetHealth:10' #Set Steve's health to 10

SetHealthScale

Action: Set health scale
Description: Sets the number to scale health to for the client
Format: [PlayerName]:SetHealthScale:[Number]
Example: 'Steve:SetHealthScale:10'

SetHealthScaled

Action: Set health scaled
Format: [PlayerName]:SetHealthScale:[true/false]
Description: Sets if the client is displayed a 'scaled' health, that is, health on a scale from 0
Example: 'Steve:SetHealthScaled:true'

SetInvisible

Action: Set invisible
Format: [PlayerName]:SetInvisible:[true/false]
Example: 'Steve:SetInvisible:true'

SetInvulnerable

Action: Set invulnerable
Format: [PlayerName]:SetInvulnerable:[true/false]
Example: 'Steve:SetInvulnerable:true'

SetItemInHand

Action: Set item in hand
Format: [PlayerName]:SetItemInHand:[Item]
Example: 'Steve:SetItemInHand:DIAMOND' #Set the item in Steve's hand as a diamond

SetItemOnCursor

Action: Set item on cursor
Format: [PlayerName]:SetItemOnCursor:[Item]
Description: Sets the item to the given item, this will replace whatever the user was moving. Will always be empty if the player currently has no open window.
Example: 'Steve:SetItemOnCursor:DIAMOND'

SetLastDamage

Action: Set last damage
Format: [PlayerName]:SetLastDamage:[Number]
Example: 'Steve:SetLastDamage:10'

SetLevel

Action: Set level
Format: [PlayerName]:SetLevel:[Number]
Example: 'Steve:SetLevel:10'

SetMaxHealth

Action: Set max health
Format: [PlayerName]:SetMaxHealth:[Number]
Example: 'Steve:SetMaxHealth:40'

SetMaximumAir

Action: Set maximum air
Format: [PlayerName]:SetMaximumAir:[Number]
Example: 'Steve:SetMaximumAir:40'

SetMaximumNoDamageTicks

Action: Set maximum no damage ticks
Format: [PlayerName]:SetMaximumNoDamageTicks:[Number]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetMaximumNoDamageTicks:1'

SetNoDamageTicks

Action: Set no damage ticks
Format: [PlayerName]:SetNoDamageTicks:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetNoDamageTicks:1'

SetOp

Action: Set operator
Format: [PlayerName]:SetOp:[true/false]
Example: 'Steve:SetOp:true' #Set Steve to operator

SetPlayerListFooter

Action: Set player list(TAB) footer
Format: [PlayerName]:SetPlayerListFooter:[Text]
Description: Please use the "/n" symbol for line breaks, use "&" as the color symbol
Example: 'Steve:SetPlayerListFooter:Here is footer'

SetPlayerListHeader

Action: Set player list(TAB) header
Format: [PlayerName]:SetPlayerListHeader:[Text]
Description: Please use the "/n" symbol for line breaks, use "&" as the color symbol
Example: 'Steve:SetPlayerListHeader:Here is header'

SetPlayerListHeaderFooter

Action: Set player list(TAb) header and footer
Format: [PlayerName]:SetPlayerListHeaderFooter:[HeaderText]:[FooterText]
Description: Please use the "/n" symbol for line breaks, use "&" as the color symbol
Example: 'Steve:SetPlayerListHeaderFooter:Here is header:Here is footer'

SetPlayerListName

Action: Set player display name in player list (TAB)
Format: [PlayerName]:SetPlayerListName:[Name]
Tips: You can use "&" as the color symbol
Example: 'Steve:SetPlayerListName:[Admin] Steve'

SetPlayerTime

Action: Set player time
Format: [PlayerName]:SetPlayerTime:[Number]:[true/false]
Description: Sets the current time on the player's client. If true the player's time will be kept synchronized to its world time with the specified offset.
Example: 'Steve:SetPlayerTime:100:true'

SetPlayerWeather

Action: Set player weather
Format: [PlayerName]:SetPlayerWeather:[Weather]
Description: Weather can be: DOWNFALL, CLEAR
Example: 'Steve:SetPlayerWeather:DOWNFALL'

SetPortalCooldown

Action: Set portal cooldown
Format: [PlayerName]:SetPortalCooldown:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetPortalCooldown:4'

SetRemainingAir

Action: Set remaining air
Format: [PlayerName]:SetRemainingAir:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetRemainingAir:10'

SetRemoveWhenFarAway

Action: Set remove when far away
Format: [PlayerName]:SetRemoveWhenFarAway:[true/false]
Description: Sets whether or not the living entity despawns when away from players or not.
Example: 'Steve:SetRemoveWhenFarAway:true'

SetResourcePack

Action: Set resource pack's URL
Format: [PlayerName]:SetResourcePack:[URL]
Tip: The link must be a valid URL, and it is worth mentioning that players can disable the server resource pack on the client. In this case, this function will not work for them.
Example: 'Steve:SetResourcePack:https://www.example.com/resourcePack/' #Steve will automatically add https://www.example.com/resourcePack/ Uploading and downloading resource package

SetRotation

Action: Set player's rotation
Format: [PlayerName]:SetRotation:[Yaw]:[Pitch]
Example: 'Steve:SetRotation:0:0'

SetSaturatedRegenRate

Action: Set saturated regen rage
Format: [PlayerName]:SetSaturatedRegenRate:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetSaturatedRegenRate:100'

SetSaturation

Action: Set saturation
Format: [PlayerName]:SetSaturation:[Number]
Example: 'Steve:SetSaturation:20'

SetSlient

Action: Set slient
Format: [PlayerName]:SetSlient:[true/false]
Example: 'Steve:SetSlient:true'

SetSleepingIgnored

Action: Set sleeping ignored
Format: [PlayerName]:SetSleepingIgnored:[true/false]
Example: 'Steve:SetSleepingIgnored:true'

SetSneaking

Action: Set sneaking
Format: [PlayerName]:SetSneaking:[true/false]
Example: 'Steve:SetSneaking:true'

SetSprinting

Action: Set sprinting
Format: [PlayerName]:SetSprinting:[true/false]
Example: 'Steve:SetSprinting:true'

SetStarvationRate

Action: Set starvation rate
Format: [PlayerName]:SetStarvationRate:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetStarvationRate:100'

SetSwimming

Action: Set swimming
Format: [PlayerName]:SetStarvationRate:[true/false]
Example: 'Steve:SetStarvationRate:true'

SetTexturePack

Action: Set texture pack's URL
Format: [PlayerName]:SetTexturePack:[URL]
Tip: The link must be a valid URL, and it is worth mentioning that players can disable the server resource pack on the client. In this case, this function will not work for them.
Example: 'Steve:SetTexturePack:https://www.example.com/resourcePack/' #Steve will automatically add https://www.example.com/resourcePack/ Uploading and downloading texture package

SetTicksLived

Action: Set ticks lived
Format: [PlayerName]:SetTicksLived:[Ticks]
Description: Sets the amount of ticks this player has lived for
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetTicksLived:20150811'

SetTotalExperience

Action: Set total experience
Format: [PlayerName]:SetTotalExperience:[Number]
Description: Sets the players current experience points. This refers to the total amount of experience the player has collected over time and is not currently displayed to the client.
Example: 'Steve:SetTotalExperience:20150811'

SetUnsaturatedRegenRate

Action: Set unsaturated regen rate
Format: [PlayerName]:SetUnsaturatedRegenRate:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetUnsaturatedRegenRate:100'

SetVelocity

Action: Set velocity (3D Vector)
Format: [PlayerName]:SetVelocity:[X-AxisVector]:[Y-AxisVector]:[Z-AxisVector]
Example: 'Steve:SetVelocity:0:5:0' #Apply a velocity for Steve to take off in place, and he will directly launch upwards from the air

SetWalkSpeed

Action: Set walk speed
Format: [PlayerName]:SetWalkSpeed:[Number]
Example: 'Steve:SetWalkSpeed:10'

SetWhitelisted

Action: Set whitelisted
Format: [PlayerName]:SetWhitelisted:[true/false]
Example: 'Steve:SetWhitelisted:false'

Sleep

Action: Make player sleep
Format: [PlayerName]:Sleep:[WorldName]:[X]:[Y]:[Z]:[true/false]
Description: Attempts to make the entity sleep at the given location. The location must be in the current world and have a bed placed at the location. The game may also enforce other requirements such as proximity to bed, monsters, and dimension type if force is not set.
Example: 'Steve:Sleep:world:0:0:0:true'

SpawnParticle

Action: Spawn particle
Format: [PlayerName]:SpawnParticle:[ParticleName]:[WorldName]:[X]:[Y]:[Z]:[Count]:[OffsetX]:[OffsetY]:[OffsetZ]:[ExtraValue]
Tip: Use the command to view a list of particles: /lce tools listNames particle
Example:

  • 'Steve:SpawnParticle:EXPLOSION_NORMAL:world:0:0:0:5' #Generate 5 explosive particles in the world with X=0, Y=0, Z=0
  • 'Steve:SpawnParticle:EXPLOSION_NORMAL:{player:Steve:location_world}:0:0:0:1' #Generate an explosive particle at X=0, Y=0, Z=0 in Steve's world
  • 'Steve:SpawnParticle:EXPLOSION_NORMAL:world:0:0:0:5:1:1:1'

StopSound

Action: Stop sound
Format: [PlayerName]:StopSound:[SoundName]
Tip: Use the command to view a list of sounds: /lce tools listNames sound
Example: 'Steve:StopSound:UI_BUTTON_CLICK'

SwingMainHand

Action: Swing main hand
Format: [PlayerName]:SwingMainHand
Example: 'Steve:SwingMainHand'

SwingOffHand

Action: Swing off hand
Format: [PlayerName]:SwingOffHand
Example: 'Steve:SwingOffHand'

Teleport

Action: Teleport to a location
Format: [PlayerName]:Teleport:[WorldName]:[X]:[Y]:[Z]:[Yaw]:[Pitch]
Example:

  • 'Steve:Teleport:world:0:0:0' #Teleport Steve to the world named "world" with X=0, Y=0, Z=0
  • 'Steve:Teleport:world_nether:0:0:0:45:90' #Teleport Steve to the world named "world_nether" with X=0, Y=0, Z=0, Yaw=45, Pitch=90

UpdateCommands

Action: Update commands
Format: [PlayerName]:UpdateCommands
Example: 'Steve:UpdateCommands'

UpdateInventory

Action: Update inventory
Format: [PlayerName]:UpdateInventory
Example: 'Steve:UpdateInventory'

Clone this wiki locally