๐ XP#
#bs.xp:help
Efficiently manage the experience points and levels of players.
๐ง Functions#
You can find below all functions available in this module.
Add / Remove#
- #bs.xp:add_levels {levels:<value>}
Add levels to the player.
- Inputs:
Execution
as <players>
: Players to add levels to.Function macro:
- Arguments
- levels: Amount of levels to add.
- Arguments
- Outputs:
State: Players XP is updated.
Add 42 levels:
# Once (execute on you)
function #bs.xp:add_levels {levels:42}
# See the result
# look at your XP bar in survival mode
- #bs.xp:add_points {points:<value>}
Add experience points to the player.
- Inputs:
Execution
as <players>
: Players to add points to.Function macro:
- Arguments
- points: Amount of points to add.
- Arguments
- Outputs:
State: Players XP is updated.
Add 42 experience points:
# Once (execute on you)
function #bs.xp:add_points {points:42}
# See the result
# look at your XP bar in survival mode
- #bs.xp:add_progress {progress:<value>}
Fill the XP bar partially.
- Inputs:
Execution
as <players>
: Players to fill the XP bar.Function macro:
- Arguments
- progress: Progress to add to the bar (in range [-1,1]).
- Arguments
- Outputs:
State: Players XP is updated.
Add 25% to the fill level of your bar:
# Once (execute on you)
function #bs.xp:add_progress {progress:0.25}
# See the result
# look at your XP bar in survival mode
How to remove
You can use negative numbers to remove experience from the player.
Credits: Aksiome, Leirof
Get#
- #bs.xp:get_max_points
Get the total amount of points required to pass to the next level.
- Inputs:
Execution
as <players>
: Players from whom you want to get the max amount of points.- Outputs:
Return | Score
$xp.get_max_points bs.out
: Total amount of points required for the next level.
Get the total amount of points required to pass to the next level:
# Once (execute on you)
function #bs.xp:get_max_points
# See the result (execute on you)
tellraw @a [{"text":"I need a total of "},{"score":{"name":"$xp.get_max_points","objective":"bs.out"}},{"text":" points to pass to the next level"}]
- #bs.xp:get_remaining_points
Get the remaining amount of points needed to pass to the next level.
- Inputs:
Execution
as <players>
: Players from whom you want to get the remaining points.- Outputs:
Return | Score
$xp.get_remaining_points bs.out
: Points needed for the next level.
Get the amount of points needed to pass to the next level:
# Once (execute on you)
function #bs.xp:get_remaining_points
# See the result (execute on you)
tellraw @a [{"text":"I need "},{"score":{"name":"$xp.get_remaining_points","objective":"bs.out"}},{"text":" points to pass to the next level"}]
- #bs.xp:get_total_points
Get the sum of all points a player has gathered.
- Inputs:
Execution
as <players>
: Players from whom you want to get the total amount of points.- Outputs:
Return | Score
$xp.get_total_points bs.out
: Total amount of points.
Get your total amount of points:
# Once (execute on you)
function #bs.xp:get_total_points
# See the result (execute on you)
tellraw @a [{"text":"I have "},{"score":{"name":"$xp.get_total_points","objective":"bs.out"}},{"text":" total points"}]
- #bs.xp:get_progress {scale:<scaling>}
Get the fill progress of the XP bar.
- Inputs:
Execution
as <players>
: Players from whom you want to get the bar progress.Function macro:
- Arguments
- scale: Scalar for the functionโs output.
- Arguments
- Outputs:
Return | Score
$xp.get_progress bs.out
: Fill level of the xp bar after scaling.
Get the fill percentage of the xp bar:
# Once (execute on you)
function #bs.xp:get_progress {scale:100}
# See the result
tellraw @a [{"text":"My experience bar is filled at "},{"score":{"name":"$xp.get_progress","objective":"bs.out"}},{"text":"/100"}]
Credits: Aksiome, Leirof
Set#
- #bs.xp:set_levels {levels:<value>}
Set players levels.
- Inputs:
Execution
as <players>
: Players to set levels to.Function macro:
- Arguments
- levels: Amount of levels to set.
- Arguments
- Outputs:
State: Players XP is updated.
Set your level to 42:
# Once (execute on you)
function #bs.xp:set_levels {levels:42}
# See the result
# look at your XP bar in survival mode
- #bs.xp:set_points {points:<value>}
Set players experience points.
- Inputs:
Execution
as <players>
: Players to set points to.Function macro:
- Arguments
- points: Amount of experience points to set.
- Arguments
- Outputs:
State: Players XP is updated.
Set your points to 42:
# Once (execute on you)
function #bs.xp:set_points {points:42}
# See the result
# look at your XP bar in survival mode
- #bs.xp:set_total_points {points:<value>}
Set players total experience points.
- Inputs:
Execution
as <players>
: Players you want to set the total XP.Function macro:
- Arguments
- points: Amount of total experience points to set.
- Arguments
- Outputs:
State: Players XP is updated.
Set your total XP amount to 42:
# Once (execute on you)
function #bs.xp:set_total_points {points:42}
# See the result
# look at your XP bar in survival mode
- #bs.xp:set_progress {progress:<value>}
Fill the XP bar partially.
- Inputs:
Execution
as <players>
: Players to fill the XP bar.Function macro:
- Arguments
- progress: Progress to set on the bar (in range [-1,1]).
- Arguments
- Outputs:
State: Players XP is updated.
Fill your bar at 50%:
# Once
function #bs.xp:set_progress {progress:0.5}
# See the result
# look at your XP bar in survival mode
Credits: Aksiome, Leirof
๐ฌ Did it help you?
Feel free to leave your questions and feedbacks below!