Skip to content

Configuration

MathiasMC edited this page Dec 11, 2020 · 13 revisions

The configuration for the xp system is a advanced system i will provide some examples.

This is setup for the default group and this group cannot be removed or renamed must be used.

Using the generate command

Usage by player: /pvplevels generate default <amount>

Confirm by using the console: /pvplevels generate confirm

Before setup:


Start level
You must be start level set in config.yml ( start-level )
/pvplevels level <player> <start-level>
This cannot be changed once you set the level system you can but some changes are required if you do it while having a setup


Remember to do /pvplevels reload after a change to the configs

After done with level setup i recommend turn off generate by set use to false (accident erase the execute.yml and levels.yml)

and the rest of the section can be removed if you want)


Placeholders ( internal )
Example if you want to add/remove a permission per level up/down you can use this in the commands:

Up: level.{level_next}.permission

Down: level.{level}.permission

level.1.permission, level.2.permission


Easy setup

generate section:

# Generate command
generate:
  # Set to false if you have a level setup finished so you cannot by accident erase the levels.yml
  use: true

  # Start xp of level system
  start: 75

  # This is for {random} placeholder
  # You can also use [min_max] to calculate random number while calculations is running.
  random:
    min: 1
    max: 2

  # The math used to calculate xp
  math: '{lastXP} + [50_800] * {random}.{level}'

  percent:

    # If under or equal percent use that for inserting. (you can add more if you want) (Must contain 100)
    100:
      prefix: ''
      suffix: ''
      group: ''
      execute: '{group}'

  get:
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have killed &b{xp_type} &7and received &b{xp_get} &7xp.'
  item:
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7Item multiplier &bx{xp_item} &7was applied.'
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have killed &b{xp_type} &7and received &b{xp_get} &7xp.'
  boost:
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7Multiplier &bx{xp_multiplier} &7was applied.'
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have killed &b{xp_type} &7and received &b{xp_get} &7xp.'
  both:
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7Multiplier &bx{xp_multiplier} &7and Item multiplier &bx{xp_item} &7was applied.'
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have killed &b{xp_type} &7and received &b{xp_get} &7xp.'
  lose:
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost &b{xp_lost} &7xp.'
  up:
    - 'pvplevels broadcast null &7[&f&lP&b&lL&7] &f&l» &b{player} &7has leveled up to Level &b{level_next}&7!'
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have killed &b{xp_type} &7and received &b{xp_get} &7xp.'
  down:
    - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost a level and now at Level &b{level}&7.'

  # This section is for inserting commands into a specific level (if it contains) and a name for the execute group must be unique.
  levels: []

Medium setup

If level is not found in levels it uses the default up and down executor

generate section same as Easy setup only add the levels section:

  # This section is for inserting commands into a specific level (if it contains) and a name for the execute group must be unique.
  levels:
    0:
      up:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have leveled up to Level &b{level_next}&7.'
        - 'pvplevels broadcast null &7[&f&lP&b&lL&7] &f&l» &b{player} &7has leveled up to Level &b{level_next}&7!'
      down:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost a level and now at Level &b{level}&7.'
      execute: '{group}{level}'
    1:
      up:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have leveled up to Level &b{level_next}&7.'
        - 'pvplevels broadcast null &7[&f&lP&b&lL&7] &f&l» &b{player} &7has leveled up to Level &b{level_next}&7!'
      down:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost a level and now at Level &b{level}&7.'
      execute: '{group}{level}'
    2:
      up:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have leveled up to Level &b{level_next}&7.'
        - 'pvplevels broadcast null &7[&f&lP&b&lL&7] &f&l» &b{player} &7has leveled up to Level &b{level_next}&7!'
      down:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost a level and now at Level &b{level}&7.'
      execute: '{group}{level}'
    3:
      up:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have leveled up to Level &b{level_next}&7.'
        - 'pvplevels broadcast null &7[&f&lP&b&lL&7] &f&l» &b{player} &7has leveled up to Level &b{level_next}&7!'
      down:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost a level and now at Level &b{level}&7.'
      execute: '{group}{level}'
    4:
      up:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have leveled up to Level &b{level_next}&7.'
        - 'pvplevels broadcast null &7[&f&lP&b&lL&7] &f&l» &b{player} &7has leveled up to Level &b{level_next}&7!'
      down:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost a level and now at Level &b{level}&7.'
      execute: '{group}{level}'
    5:
      up:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have leveled up to Level &b{level_next}&7.'
        - 'pvplevels broadcast null &7[&f&lP&b&lL&7] &f&l» &b{player} &7has leveled up to Level &b{level_next}&7!'
      down:
        - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost a level and now at Level &b{level}&7.'
      execute: '{group}{level}'

Advanced setup

How the xp system starts
I will explain how the xp system works.

Every group in levels.yml must have this:
<start> = start-level from config.yml
<next> = the next level after start level
override = if you want to override xp executor for a specific level to run other commands

default:
  # This is just selecting the executor from execute.yml for xp.get, item, boost, both, lose
  execute: default
  '<start>':
    prefix: ''
    suffix: ''
    group: ''
    # This is selecting the executor from execute.yml for level.up, down
    execute: default
    # Dont touch xp must be 0 for start level
    xp: 0
  '<next>':
    prefix: ''
    suffix: ''
    group: ''
    # You can also override the xp executor at the top per level if you want other commands (good for max level explained in max level section)
    #override: default-last
    execute: default-last
    # Dont touch xp must be 0 for start level
    xp: 0

The executors is in execute.yml

An executor is just the name of the section in execute.yml

The top execute under the group name will be the standard executor for xp.get, item, boost, both, lose

In the levels the execute means it will get this path like default.level.up, down

And override in levels mean it will override the default xp.get, item, boost, both, lose

default:
  xp:
    get: []
    item: []
    boost: []
    both: []
    lose: []
  level:
    up: []
    down: []
default-last:
  xp:
    get: []
    item: []
    boost: []
    both: []
    lose: []
  level:
    up: []
    down: []

Max level

If you want to run commands if max level (+kills or cant get more xp) you can override the xp executor

In levels.yml go to last level and add the same as execute override: default-last

levels.yml

default:
  # executor for get xp section in execute.yml
  execute: default
  '<lastLevel>':
    prefix: ''
    suffix: ''
    group: ''
    # override top executor for get xp section in execute.yml
    override: default-last
    # The execute: executor (this is only the level.up and level.down)
    execute: default-last
    xp: lastLevelXP

execute.yml

default-last:
  xp:
    get:
      - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You cannot receive more xp, you have reached max level.'
    item:
      - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You cannot receive more xp, you have reached max level.'
    boost:
      - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You cannot receive more xp, you have reached max level.'
    both:
      - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You cannot receive more xp, you have reached max level.'
    lose:
      - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost &b{xp_lost} &7xp.'
  level:
    up:
      - 'pvplevels broadcast null &7[&f&lP&b&lL&7] &f&l» &b{player} &7has leveled up to Level &b{level_next}&7!'
      - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have killed &b{xp_type} &7and received &b{xp_get} &7xp.'
    down:
      - 'pvplevels message {player} &7[&f&lP&b&lL&7] &f&l» &7You have lost a level and now at Level &b{level}&7.'

Examples


25 levels default with per level commands:

execute.yml

levels.yml


25 levels default with only last level commands:

execute.yml

levels.yml


25 levels default with last level commands and certain commands at level 10, 20:

execute.yml

levels.yml


Only allow to work in different worlds

config.yml


Clone this wiki locally