Molang Player Functions
Players can also use entity functions. Type is ObjectValue<Player>
.
Name | Description | Usage | Server Only |
---|---|---|---|
username(): String
|
Returns the name of a player. | q.player.username()
|
|
uuid(): String
|
Returns the UUID of a player. | q.player.uuid()
|
|
main_held_item(): ObjectValue<Item>
|
Returns the Item Object in the player's main hand. | q.player.main_held_item()
|
|
off_held_item(): ObjectValue<Item>
|
Returns the Item Object in the player's off hand. | q.player.off_held_item()
|
|
face(isLeftSide: Boolean?): ObjectValue<PlayerDialogueFaceProvider>
|
Returns a ObjectValue of [PlayerDialogueFaceProvider] . isLeftSide is true by default.
|
q.player.face()
|
|
swing_hand()
|
Swings the player's hand. | q.player.swing_hand()
|
|
food_level(): Double
|
Returns the food level of the player. | q.player.food_level()
|
|
saturation_level(): Double
|
Returns the saturation level of the player. | q.player.saturation_level()
|
|
tell(message: String, overlay: Boolean?)
|
Displays a message in the player's chat, and will overlay if overlay is set to true.
|
q.player.tell('Hello world!')
|
|
teleport(x: Double, y: Double, z: Double, playParticleOptions: Boolean?)
|
Teleports the player to x , y , and z . If playParticleOptionss is true then particles will be displayed.
|
q.player.teleport(0,0,0)
|
|
heal(amount: Double?)
|
Will heal a player by amount , or to max health if unspecified.
|
q.player.heal(5)
|
Yes |
environment(): MoLangEnvironment
|
Returns a MoLang environment with the query set as a ObjectValue<Player> for this player.
|
q.player.environment()
|
Yes |
is_player(): Double
|
Returns 1.0 .
|
p.player.is_player()
|
Yes |
run_command(command: String)
|
Runs a command as the player. | run_command('/say Hello World!')
|
Yes |
is_party_at_full_health(): Double
|
Returns if no Pokémon is able to heal, aka all is at full health. | q.player.is_party_at_full_health()
|
Yes |
can_heal_at_healer(position: ArrayStruct<Int>): Double
|
Returns 0.0 if the block is not a healing machine or if the healing machine cannot heal the player's party. Otherwise returns 1.0 .
|
q.player.can_heal_at_healer(v.location)
|
Yes |
put_pokemon_in_healer(position: ArrayStruct<Int>): Double
|
Attempts to heal all Pokémon in the party at the specified healing machine. Returns 0.0 if the block is not a healing machine or if the party cannot be healed. Otherwise returns 1.0 .
|
q.party.put_pokemon_in_healer(v.location)
|
Yes |
party(): ObjectValue<PartyStore>
|
Returns a struct of the player's party store. | q.player.party()
|
Yes |
pc(): ObjectValue<PCStore>
|
Returns a struct of the player's PC store. | q.player.pc()
|
Yes |
has_permission(permission: String, level: Int?)
|
Returns 1.0 if the player has this permission at the specified level , otherwise returns 0.0 . level is 4 at default.
|
q.player.has_permission('command.pc')
|
Yes |
data(): VariableStruct
|
Returns a VariableStruct from Cobblemon's Molang store for that player's UUID.
|
q.player.data()
|
Yes |
save_data()
|
Saves to Cobblemon's Molang Store for that player's UUID. | q.player.save_data()
|
Yes |
in_battle(): Double
|
Returns 1.0 if the player is in battle, otherwise returns 0.0 .
|
q.player.in_battle()
|
Yes |
battle(): MoValue
|
Returns a Struct CHECK TYPE if in battle, otherwise returns 0.0 .
|
q.player.battle()
|
Yes |
get_npc_data(npc: MoValue): VariableStruct
|
Get the NPC's data from the player's MoLang store. npc can either be the NPC's UUID or an ObjectValue<NPCEntity> .
|
q.player.get_npc_data(q.npc)
|
Yes |
get_npc_variable(npc: MoValue, variable: String): MoValue
|
Get a variable from the NPC's data from the player's MoLang store. npc can either be the NPC's UUID or a ObjectValue<NPCEntity> . variable is a string key. If the key is not in the NPC data or the variable is null it will return 0.0 .
|
q.player.get_npc_data(q.npc, 'fight_count')
|
Yes |
set_npc_data(npc: MoValue, variable: String, value: MoValue, saveAfterwards: Boolean?): DoubleValue
|
Set a variable from the NPC's data from the player's MoLang store. npc can either be the NPC's UUID or a ObjectValue<NPCEntity> . variable is used as the key and value is used as the value. saveAfterwards is true by default. Will return 1.0
|
q.player.set_npc_data(q.npc, 'fight_count', 1)
|
Yes |
pokedex(): ObjectValue<AbstractPokedexManager>
|
Returns an ObjectValue<AbstractPokedexManager> of the player's pokedex.
|
q.player.pokedex()
|
Yes |