-
Notifications
You must be signed in to change notification settings - Fork 2
Player Functions Document
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 \: )
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].
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 |
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
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'
Action: Manipulate player to chat
Format: [PlayerName]:Chat:[Text]
Example: 'Steve:Chat:Hello World' #Manipulate Steve to say "Hello World"
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
Action: Give experiences
Format: [PlayerName]:GiveExp:[Number]
Example: 'Steve:GiveExp:10' #Give 10 experiences to Steve
Action: Give experience levels
Format: [PlayerName]:GiveExpLevels:[Number]
Example: 'Steve:GiveExpLevels:10' #Give 10 experience levels to Steve
Action: hidden player
Description: Hides a player from this player
Format: [PlayerName]:HidePlayer:[TargetPlayer]
Example: 'Steve:HidePlayer:Alex' #Hides Steve from Alex
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"
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'
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"
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
Action: Recalculate permissions
Format: [PlayerName]:RecalculatePermissions
Example: 'Steve:RecalculatePermissions'
Action: Remove player's entity
Format: [PlayerName]:Remove
Example: 'Steve:Remove'
Action: Remove scoreboard tag
Format: [PlayerName]:RemoveScoreboardTag:[Tag]
Example: 'Steve:RemoveScoreboardTag:Test' #Remove a scoreboard tag named Test
Action: Reset max health
Format: [PlayerName]:ResetMaxHealth
Example: 'Steve:ResetMaxHealth'
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'
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'
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'
Action: Send message to player
Tip: You can use "&" as the color symbol
Format: [PlayerName]:SendMessage:[Text]
Example: 'Steve:SendMessage:Hello World!'
Action: Send raw message to player
Tip: You can use "&" as the color symbol
Format: [PlayerName]:SendRawMessage:[Text]
Example: 'Steve:SendRawMessage:Hello World!'
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"
Action: Set absorption amount
Format: [PlayerName]:SetAbsorptionAmount:[Number]
Example: 'Steve:SetAbsorptionAmount:10' #Set a damage absorption value for Steve that can offset 10 damage
Action: Set allow flight
Format: [PlayerName]:SetAllowFlight:[true/false]
Example: 'Steve:SetAllowFlight:true'
Action: Set the number of arrows in body
Format: [PlayerName]:SetArrowInBody:[IntegerNumber]
Example: 'Steve:SetArrowInBody:10'
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"
Action: Set can pickup items
Format: [PlayerName]:SetCanPickupItems:[true/false]
Example: 'Steve:SetCanPickupItems:false'
Action: Set collidable
Description: Set if this player will be subject to collisions other entities.
Format: [PlayerName]:SetCollidable:[true/false]
Example: 'Steve:SetCollidable'
Action: Set compass target
Format: [PlayerName]:SetCompassTarget:[WorldName]:[X]:[Y]:[Z]
Example: 'Steve:SetCompassTarget:world:0:0:0'
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'
Action: Set custom name visible
Format: [PlayerName]:SetCustomNameVisible:[true/false]
Example: 'Steve:SetCustomNameVisible:true'
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"
Action: Set exhaustion
Format: [PlayerName]:SetExhaustion:[Number]
Example: 'Steve:SetExhaustion:1.5'
Action: Set experiences
Format: [PlayerName]:SetExp:[Number]
Example: 'Steve:SetExp:10'
Action: Set fall distance
Format: [PlayerName]:SetFallDistance:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetFallDistance:10'
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
Action: Set fly speed
Format: [PlayerName]:SetFlySpeed:[Number]
Example: 'Steve:SetFlySpeed:10'
Action: Set flying
Format: [PlayerName]:SetFlying:[true/false]
Example: 'Steve:SetFlying:false'
Action: Set food level
Format: [PlayerName]:SetFoodLevel:[Number]
Example: 'Steve:SetFoodLevel:10'
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
Action: Set gliding
Format: [PlayerName]:SetGliding:[true/false]
Example: 'Steve:SetGliding:true'
Action: Set glowing
Format: [PlayerName]:SetGlowing:[true/false]
Example: 'Steve:SetGlowing:true'
Action: Set gravity
Format: [PlayerName]:SetGravity:[true/false]
Example: 'Steve:SetGravity:true'
Action: Set health
Format: [PlayerName]:SetHealth:[Number]
Example: 'Steve:SetHealth:10' #Set Steve's health to 10
Action: Set health scale
Description: Sets the number to scale health to for the client
Format: [PlayerName]:SetHealthScale:[Number]
Example: 'Steve:SetHealthScale:10'
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'
Action: Set invisible
Format: [PlayerName]:SetInvisible:[true/false]
Example: 'Steve:SetInvisible:true'
Action: Set invulnerable
Format: [PlayerName]:SetInvulnerable:[true/false]
Example: 'Steve:SetInvulnerable:true'
Action: Set item in hand
Format: [PlayerName]:SetItemInHand:[Item]
Example: 'Steve:SetItemInHand:DIAMOND' #Set the item in Steve's hand as a diamond
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'
Action: Set last damage
Format: [PlayerName]:SetLastDamage:[Number]
Example: 'Steve:SetLastDamage:10'
Action: Set level
Format: [PlayerName]:SetLevel:[Number]
Example: 'Steve:SetLevel:10'
Action: Set max health
Format: [PlayerName]:SetMaxHealth:[Number]
Example: 'Steve:SetMaxHealth:40'
Action: Set maximum air
Format: [PlayerName]:SetMaximumAir:[Number]
Example: 'Steve:SetMaximumAir:40'
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'
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'
Action: Set operator
Format: [PlayerName]:SetOp:[true/false]
Example: 'Steve:SetOp:true' #Set Steve to operator
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'
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'
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'
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'
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'
Action: Set player weather
Format: [PlayerName]:SetPlayerWeather:[Weather]
Description: Weather can be: DOWNFALL, CLEAR
Example: 'Steve:SetPlayerWeather:DOWNFALL'
Action: Set portal cooldown
Format: [PlayerName]:SetPortalCooldown:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetPortalCooldown:4'
Action: Set remaining air
Format: [PlayerName]:SetRemainingAir:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetRemainingAir:10'
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'
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
Action: Set player's rotation
Format: [PlayerName]:SetRotation:[Yaw]:[Pitch]
Example: 'Steve:SetRotation:0:0'
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'
Action: Set saturation
Format: [PlayerName]:SetSaturation:[Number]
Example: 'Steve:SetSaturation:20'
Action: Set slient
Format: [PlayerName]:SetSlient:[true/false]
Example: 'Steve:SetSlient:true'
Action: Set sleeping ignored
Format: [PlayerName]:SetSleepingIgnored:[true/false]
Example: 'Steve:SetSleepingIgnored:true'
Action: Set sneaking
Format: [PlayerName]:SetSneaking:[true/false]
Example: 'Steve:SetSneaking:true'
Action: Set sprinting
Format: [PlayerName]:SetSprinting:[true/false]
Example: 'Steve:SetSprinting:true'
Action: Set starvation rate
Format: [PlayerName]:SetStarvationRate:[Ticks]
Tip: 1 second = 20 ticks, it will be affected by server lag
Example: 'Steve:SetStarvationRate:100'
Action: Set swimming
Format: [PlayerName]:SetStarvationRate:[true/false]
Example: 'Steve:SetStarvationRate:true'
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
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'
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'
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'
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
Action: Set walk speed
Format: [PlayerName]:SetWalkSpeed:[Number]
Example: 'Steve:SetWalkSpeed:10'
Action: Set whitelisted
Format: [PlayerName]:SetWhitelisted:[true/false]
Example: 'Steve:SetWhitelisted:false'
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'
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'
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'
Action: Swing main hand
Format: [PlayerName]:SwingMainHand
Example: 'Steve:SwingMainHand'
Action: Swing off hand
Format: [PlayerName]:SwingOffHand
Example: 'Steve:SwingOffHand'
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
Action: Update commands
Format: [PlayerName]:UpdateCommands
Example: 'Steve:UpdateCommands'
Action: Update inventory
Format: [PlayerName]:UpdateInventory
Example: 'Steve:UpdateInventory'