- Supported Minecraft Versions:
- 1.9, 1.10, 1.11
TagAPI
Description
TagAPI gives you easy access to Mojang's scoreboard tag system which was introduced in 1.9. These tags allow you to permanently store up to 1024 text tags on an entity. Tags, like metadata from Skellett or RandomSk, are unique to an entity and can be checked or remove at any later point, but as they are stored directly in the entity's NBT, they are permanent and will persist through server restarts, chunk reloading, etc. -- all without using Skript variables.
Requirements
- Minecraft 1.9 or above (this is when scoreboard tags were added)
- SkStuff
Usage
The following basic functions are made available to you by TagAPI:
Code (Skript):
# Adds a tag ("tag") to an entity ("entityToTag"). addTag(entityToTag, tag) # Removes a tag ("tag") from an entity ("entityToUntag"). removeTag(entityToUntag, tag) # Gets a list of all tags on an entity ("entityToCheck"). # This is returned as a Skript list of texts. getTags(entityToCheck) # Returns true if "entityToCheck" has the tag "tag", or false if not hasTag(entityToCheck, tag)
These are the only features that directly use vanilla tag functionality. However, in my testing I found I often wanted to be able to use tags more like variables by having a key or "variable name" of sorts to reference tags by. So, I created the concept of key-value tags, which aid in getting and setting tags with a key=value setup, essentially allowing you to treat the tag as a variable named 'key' with a value of 'value'.
Code (Skript):
# Returns true if the entity has a key-value tag with the given key # This essentially is like checking if a variable named 'key' exists hasKeyValueTag(entityToCheck, key) # Stores a tag on "entityToTag" as "key=value" # This literally maps directly to addTag(entityToTag, "key=value"), but it # feels better to use a keyValueTag function when working with them setKeyValueTag(entityToTag, key, value) # Returns the value associated with the tag with key "key", e.g.: # setKeyValueTag(player's target, "Owner", "%player%") # getKeyValueTag(player's target, "Owner") # Would return the "%player%" value set by setKeyValueTag getKeyValueTag(entityToCheck, key) # Removes the key-value tag with key "key" from "entityToUntag" removeKeyValueTag(entityToUntag, key)
Reviews
-
Welcome to skUnity!
Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.
If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!
Now, what are you waiting for? Join the community now!
Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

API TagAPI 1.1
Like string metadata, but permanent! And better!
Tags: