Skip to content

Using Tags

JyckoS edited this page Jul 25, 2019 · 2 revisions

Why you should use tags?

  • Tags is a built-in tag system specifically used for tag requirement check in items.

  • Tags are saved dynamically to prevent bugs. Meaning, everytime you add a tag to someone, dc will automatically save the player's tag file.

  • Tags are flexible to use.

Starting off

Before we get started, you need to understand how tags really works.

So it works simply like how you would check someone's permission.

If the player has a specific tag, he may or may not use the item. As simple as that.

Adding/Removing Tags from Players

In order for a player to have / not have a tag, you have to add him the tag.

Either when he bought the item, or something else.

But usually, it happens when someone bought the item -> Action Executed -> Tag Added.

Actions:
  UPGRADE1:
  - "%ATAG UPGRADED1" # To mark that the player has bought the item that uses the action UPGRADE1, you can name it something else like UPG1, CHICKEN1, etc.
  DEGRADE1:
  - "%RTAG UPGRADED1" # Remove the tag from player. Highly useful for upgrades/downgrades.
  CLEAR_UPGRADE:
  - "%CTAG UPGRADED" # Clears all tags that starts with "UPGRADED"

Now you know how to implement it in actions. Lastly, the items.

Implementing the tags

The main reason why we're using tags is for the items.

items:
  BUY_UPGRADE1:
     name: "Purchase Upgrade 1"
     lore:
     - "Get yourself stronger"
     material: diamond
     action: UPGRADE1 # Player bought Upgrade 1, meaning that player is already upgraded.
     banned_tag: "UPGRADED1" # Player that has bought this upgrade may not buy it anymore.
     banned_tag_item: "BUY_UPGRADE2" # Replace item with another item when player has already has the tag.
  BUY_UPGRADE2:
     name: "Purchase Upgrade 2"
     lore:
     - "Get yourself even stronger"
     material: emerald
     action: UPGRADE2

Some of you may think, why not put the required_tag into the BUY_UPGRADE2 item? Well, you sure but let me tell you this, players will NOT be able to buy/purchase items without using it on the GUI. So there's no way players will be able to access BUY_UPGRADE2 in this case without buying BUY_UPGRADE1.

If you have any questions get me up on discord: https://discord.gg/QtKCW34