Metadata tags

Metadata Tags

Metadata tags are a form of temporary value storage, where you tie a value to a block or entity and that value will be wiped when the server restarts. This is convenient for holding information about a entity or block where you don't have to worry about removing it later.

How do I use metadata tags?
Here's the syntax of metadata tags.
metadata [(value|tag)[s]] %strings% of %metadataholders%
%metadataholders%'[s] metadata [(value|tag)[s]] %string%

In short, metadata holders are an entity or a placed block. You can set metadata tags just like you would ever set a variable, or an expression, and metadata tags can be set to anything, as long as it isn't multiple. Do beware that metadata values only accept the set and delete operations. Here's some examples:
set metadata value "foo" of player to "bar"
delete metadata tag "barhee" of target block
set metadata value "tutorial" of player to metadata value "tutorial" of player + 1

# You can't do:
add 1 to metadata tag "yeehaw" of player
set metadata value "foobar" of player to true and false

Where should I use metadata tags?
You should only use metadata tags when attempting to store something that isn't meant to be long term, like what game a player is in, if a player has a specific GUI open, etc.