Has Persistent Data Tag (Condition) — Skript

Addon: Skript · Category: Condition · Since: 2.15

Syntax

%objects% (has|have) [persistent] data tag[s] %strings%

Description

Checks if the specified objects have persistent data tags with the given keys. Keys should be in the format "namespace:key" or "key". If a namespace is omitted, "minecraft" will be used instead. If a key is invalid, it will be ignored and a warning will be logged.

Examples

if player has persistent data tag "koth:capturePoint":
	add 1 to {points::%{team::%player%}%}
if player's tool has persistent data tags "custom:damage" and "custom:owner":
	if data tag "custom:owner" of player's tool is not player:
		broadcast "You are not the owner of this tool!"
		stop
	if data tag "custom:damage" of player's tool > 10:
		broadcast "Your tool is heavily damaged!"
	else:
		broadcast "Your tool is in good condition."

View source