Language system and placeholders - Rosstail/Karma GitHub Wiki

Select lang file

#config.yml

locale:
  lang: <String> #only name file without extension.

Edit locale.lang with the language you want: if your file in lang/ is named en_EN.yml, put en_EN inside.

Create or edit a lang file

You can add any language file inside the lang folder if Karma does not generate it by default. (You can even suggest me your lang file on Isues, pull request or discord)

Heres the structure of a lang file:

prefix: "&f☯[&aKarma&f]&r "

format:
  datetime: "yyyy-MM-dd HH:mm:ss"
  datetime-never: "&7Never"
  countdown: "{dd}d {HH}:{mm}:{ss}" #use dd, d, hh, h, mm, m, ss, s

commands:
  by-player-only: "[prefix]Command must be sent by player."
  permission-denied: "[prefix]You don't have permission for command [command] : [permission]."
  insert-player-name: "[prefix]Insert player target name."
  wrong-command: "[prefix]Wrong command."
  wrong-value: "[prefix]Wrong value."
  player-does-not-exist: "[prefix][player] does not exist."
  player-no-data: "[prefix]No karma data for [player]."
  help:
    header: "&b====== &6KARMA HELP &b======"
    line: "&a► &6/[syntax] &8: &r[desc]"
  check:
    desc: "Check player data"
    self:
      desc: "Check your own data"
      result:
      - "[prefix]Your data:"
      - "&rTier [player_tier_display] &r| Karma: [player_karma]"
      - "&rPrevious tier [player_previous_tier_display] &r| Previous karma: [player_previous_karma]"
      - "&rStatus [player_wanted_status] &rfor: [player_wanted_status_short][player_wanted_time_delay_display]"
      - "&rLast update on [player_last_update]&r."
    other:
      desc: "Check data of selected player"
      result:
        - "[prefix][player] data:"
        - "&rCurrently [player_status]"
        - "&rTier [player_tier_display] &r| Karma: [player_karma]"
        - "&rPrevious tier [player_previous_tier_display] &r| previous karma: [player_previous_karma]"
        - "&rStatus [player_wanted_status] &rfor: [player_wanted_status_short][player_wanted_time_delay_display]"
        - "&rLast update on [player_last_update]&r."
  edit:
    desc: "Edit command."
    player:
      desc: "Edit data of player"
      disconnected-player: "[prefix][player] is disconnected. Use -d or --disconnect to force update."
      player-no-data: "[prefix]No karma data for [player]. Use -g or --generate to generate data of player."
      out-of-bounds: "[prefix]Value is out of bounds. Use -o or --override to ignore these limits."
      karma:
        desc: "Edit karma of player"
        set:
          desc: "Set karma value to selected player."
          result: "[prefix]Set karma to [player_karma] for [player]."
        add:
          desc: "Add value to current player karma."
          result: "[prefix]Added [player_diff_karma] karma for [player]. Final [player_karma]."
        remove:
          desc: "Remove value to current player karma."
          result: "[prefix]Removed [player_diff_karma] karma for [player]. Final [player_karma]."
        reset:
          desc: "Reset karma of player to default."
          result: "[prefix]Reset karma for [player]. Final [player_karma]."
      tier:
        desc: "Edit tier of player"
        set:
          desc: "Set tier with default karma to selected player"
          result: "[prefix]Set tier [player_tier_display] for [player]."
      wanted:
        desc: "Edit wanted time of player"
        set:
          desc: "Set current wanted time to player."
          result: "[prefix]Set wanted time of [player] to [player_wanted_time_delay_display]. Status: [player_wanted_status]."
        add:
          desc: "Add time to current wanted time of player."
          result: "[prefix]added [value] wanted time of [player] to [player_wanted_time_delay_display]. Status: [player_wanted_status]."
        remove:
          desc: "Remove time from current wanted time of player."
          result: "[prefix]Removed [value] wanted time of [player] to [player_wanted_time_delay_display]. Status: [player_wanted_status]."
        reset:
          desc: "Reset wanted of player."
          result: "[prefix]Reset wanted time and status of [player]."
  shop:
    header: "&b====== &6KARMA SHOP &b======"
    line: "  &6► &9[shop_display] &8: &r\n[shop_description]"
    not-exist: "[prefix]&cThis shop does not exist."
    footer: "&9================================"
    buy:
      desc: "Buy content of shop."
      success: "[prefix]&aTransaction successful."
      failure: "[prefix]&cTransaction failed."
  reload:
    desc: "Reload current karma config."
    result: "[prefix]Reloaded config."
  save:
    desc: "Save instantly all online players data to storage."
    result: "[prefix]Manually saved data of [amount] players."
  eval:
    desc: "Calculate a mathematical expression."
    result: "[prefix]Expression: [expression] = [result]"

storage:
  type: "[prefix]Use [type] storage type."

player:
  online: "&aONLINE"
  offline: "&8OFFLINE"

karma:
  on-change: "[prefix]Your karma is now: [player_karma]."

tier:
  on-change: "[prefix]Your tier has been set to [player_tier_display]."
  none:
    display: "&7None"
    short-display: "&7"

fight:
  pvp:
    hit:
      on-karma-gain: "[prefix]You won [attacker_karma_diff] karma by hitting [victim]."
      on-karma-unchanged: "[prefix]You hit [victim] without karma change."
      on-karma-loss: "[prefix]You lose [attacker_karma_diff] karma by hitting [victim]."
    kill:
      on-karma-gain: "[prefix]You won [attacker_karma_diff] karma by killing [victim]."
      on-karma-unchanged: "[prefix]You have killed [victim] without karma change."
      on-karma-loss: "[prefix]You lose [attacker_karma_diff] karma by killing [victim]."
  pve:
    hit:
      on-karma-gain: "[prefix]You won [reward] karma by hitting [victim]."
      on-karma-unchanged: "[prefix]You hit [victim] without karma change."
      on-karma-loss: "[prefix]You lose [reward] karma by hitting [victim]."
    kill:
      on-karma-gain: "[prefix]You won [reward] karma by killing [victim]."
      on-karma-unchanged: "[prefix]You have killed [victim] without karma change."
      on-karma-loss: "[prefix]You lose [reward] karma by killing [victim]."

wanted:
  status:
    innocent:
      display: "&fInnocent"
      short: "&f"
    wanted:
      display: "&4&lWANTED"
      short: "&4⚠"
  event:
    on-enter: "[msg-title]{#FF0000}WANTED
    [msg-subtitle]You are actively wanted."
    on-refresh: "[msg-actionbar][prefix]&cYour wanted status is refreshed."
    on-exit: "[prefix]&aYou are no longer wanted."

Fallback system

Karma possesses a fallback system for the lang files. If your lang file is unknown or misconfigured, the default en_EN.yml file will be used instead.

In the case you use an edited/custom file missing some critical text entries, these critical lines will use the default en_EN.yml file to avoid errors. If the entries are empty and not critical, no message will be sent (report any error message. This is not normal).


Colours

You can use both types of colours in the plugin, Minecraft color codes and Hex colours:

Karma provides some custom placeholders that you can use both in karma itself or on any other plugin if you have PlaceHolderAPI on the server.

PLACEHOLDERS

You can use both local placeholders and PAPI placeholders in Karma.

  • To use karma placeholders locally (in karma configs, lang files etc), the structure will be [placeholder]
  • To use karma placeholders elsewhere (through PAPI), the structure will be %karma_placeholder%

DO NOT ADD KARMA TO PAPI ECLOUD, ELSE YOU'LL HAVE SOME CONFLICTS


Generic placeholders

  • player : Placed at the beginning of a command, the player will send it. if set before a [msg-*] placeholder, he will become the receiver of the message.
  • [now] : The actual timestamp of the server
  • [msg] : At the beginning of a command and following %player%, sends the message to the player in chat
  • [msg-actionbar] : At the beginning of a command and following %player%, sends the message to the player in the actionbar
  • [msg-title] : At the beginning of a command and following %player%, sends the message to the player as a title.
  • [msg-subtitle] : anywhere after a %msg-title% in the same line, everything after %msg-subtitle% will be sent in subtitle.

The duration of a title/subtitle is defined here, in ticks:

#config.yml
locale:
  title:
    fade-in: <int>
    stay: <int>
    fade-out: <int>

Player placeholders

In PvE or PvP features, the the "player" in placeholder must be replaced by either "attacker" or "victim". Example: [player_karma] will become [attacker_karma].

  • [player] : displays player name

  • [player_uuid] : Displays player UUID.

  • [player_status] : Displays if player is connected or not.

  • [player_last_update] : Displays the latest time the player's karma data has been updated.

  • [player_karma] : Replaced by the player amount of karma. Formatted through locale.decimal-display

    • [player_karma_int] : Display the number without decimals
    • [player_karma_abs] : Display the value as positive
    • [player_karma_abs_int_abs] : Display positive value without decimals
  • [player_previous_karma] : Replaced by the player amount of karma. Formatted through locale.decimal-display

    • [player_previous_karma_int] : Display the number without decimals
    • [player_previous_karma_abs] : Display the value as positive
    • [player_previous_karma_int_abs] : Display positive value without decimals
  • [player_karma_diff] : Replaced by the player karma - previous karma. Formatted through locale.decimal-display

    • [player_karma_int_diff] : Display the number without decimals
    • [player_karma_abs_diff] : Display the value as positive
    • [player_karma_abs_int_abs_diff] : Display positive value without decimals
  • [player_tier] : Shows the tier identifier of player.

    • [player_tier_display] : Shows the tier display.
    • [player_tier_short] : Shows the tier shortened display.
    • [player_tier_minimum_karma] : Shows the minimum karma of the player tier.
    • [player_tier_maximum_karma] : Shows the maximum karma of the player tier.
  • [player_previous_tier] : Shows the tier identifier of player.

    • [player_previous_tier_display] : Shows the tier display.
    • [player_previous_tier_short] : Shows the tier shortened display.
    • [player_previous_tier_minimum_karma] : Shows the minimum karma of the player previous tier.
    • [player_previous_tier_maximum_karma] : Shows the maximum karma of the player previous tier.
  • [player_wanted_status] : Shows the innocent/wanted state display.

    • [player_wanted_status_short] : Shows the shortened innocent/wanted state display.
  • [player_wanted_time] : Shows the timestamp of wanted time expiration. Formatted through locale.decimal-display

    • [player_wanted_time_display] : Shows the timestamp of wanted time expiration formatted with the lang file countdown.
    • [player_wanted_time_delay] : Shows the amount of time left in milliseconds. Formatted through locale.decimal-display
    • [player_wanted_time_delay_display] : Shows the amount of time left formatted with the lang file countdown.

Eval placeholders

This is a far from perfect beta feature and a bit special. The placeholder is [eval_CONTENT] where CONTENT is what you want to calculate. it can use local placeholders and MAYBE papi placeholders. No space is allowed inside CONTENT.

If you want to use this placeholder in another plugin, use %karma_eval_([CONTENTS])% where contents DO NOT USE % characters.

  • [eval_content] : returns the result of content, formatted through locale.decimal-display : [eval_1/7] -> 0.14 (if decimal-display is 2)
    • [evalint_content] : returns the result without decimals.
    • [evalfloat_content] returns the result of content, limited to 6 decimals.
    • [evalformat_content] : returns the result of content, formatted through locale.decimal-display : [eval_1/7] -> 0.14 (if decimal-display is 2)
⚠️ **GitHub.com Fallback** ⚠️