- Supported Minecraft Versions
- 1.21
To learn more about the add-on, check out the official GitHub repository:
https://github.com/3Fendi3/SkriptPDC-API
SkriptPDC API
Version 3.0
Modern Persistent Data Container API for Skript 2.14+
_________________________________________________________________
Table of Contents
Overview
Installation & Setup
Expressions
Checking Tags (Conditions)
Effects
Usage Examples
Supported Data Types
FAQ & Troubleshooting
_________________________________________________________________
SkriptPDC is a powerful addon for Skript that provides comprehensive support for Minecraft's Persistent Data Container (PDC) system. Store custom data on items, entities, and chunks with automatic type detection and modern Skript 2.14 API support.
What's New in v3.0?
_________________________________________________________________
Installing SkriptPDC is quick and easy. Follow these steps:
_________________________________________________________________
Expression PDC Tag
Examples:
Expression All PDC Tags
Examples:
_________________________________________________________________
Condition Check if Tag Exists
Examples:
Condition Check if PDC is Empty
Examples:
_________________________________________________________________
Effect Clear PDC
Examples:
Effect Remove PDC Tags
Examples:
_________________________________________________________________
Example 1: Item Leveling System
Example 2: Soulbound Items
Example 3: Protected Regions with Chunks
_________________________________________________________________
SkriptPDC intelligently handles data types. When you set a tag, the addon automatically detects the type and stores it using the most appropriate format.
Complex Data Types
For any other Skript data type (like location, itemstack, etc.), SkriptPDC will use Skript's built-in serialization system.
Important: When storing complex objects like players, it's recommended to store their UUID as text (player's uuid as string) instead of the player object itself.
_________________________________________________________________
How do I use namespaced keys?
Tags should ideally be in the format namespace:key. The namespace prevents conflicts with other plugins. If you provide a key without a namespace (e.g., "level"), SkriptPDC will automatically use your script's name as the namespace.
Why isn't my item data saving?
When manipulating items stored in variables or inventory slots, you must manually apply the modified item back to its original place. Modifying player's tool handles this automatically.
What objects support PDC?
SkriptPDC supports all objects that implement Bukkit's PersistentDataHolder interface:
Can I store lists or multiple values?
PDC stores single values per tag. For lists, Skript's serialization handles this automatically when you set a list variable to a tag.
_________________________________________________________________
SkriptPDC API v3.0 - Created by Fendi
For convenience, the docs was generated by AI, I apologize for any errors in the examples.
https://github.com/3Fendi3/SkriptPDC-API
SkriptPDC API
Version 3.0
Modern Persistent Data Container API for Skript 2.14+
_________________________________________________________________
Table of Contents
Overview
Installation & Setup
Expressions
Checking Tags (Conditions)
Effects
Usage Examples
Supported Data Types
FAQ & Troubleshooting
_________________________________________________________________
Overview
SkriptPDC is a powerful addon for Skript that provides comprehensive support for Minecraft's Persistent Data Container (PDC) system. Store custom data on items, entities, and chunks with automatic type detection and modern Skript 2.14 API support.
What's New in v3.0?
- Skript 2.14 API: Fully modernized using Skript's new registration system for better performance and stability.
- Chunk Support: Store persistent data directly on chunks for region-based systems and world management.
- Auto Type Detection: Automatically handles Integer, Double, Float, Long, Byte, String, Boolean, and complex Skript types.
- Tag Management: List, check, clear, and manipulate PDC tags with intuitive expressions and effects.
Math Operations: Add and remove numeric values directly from PDC tags without manual calculations.
Optimized Performance: Enhanced error handling and efficient code for production servers.
_________________________________________________________________
Installation & Setup
Installing SkriptPDC is quick and easy. Follow these steps:
- Requirements: Ensure you have Skript 2.14+ installed on your server.
- Download: Get the latest version of SkriptPDC.jar.
- Install: Place the downloaded .jar file into your server's /plugins/ directory.
- Restart: Restart your server completely.
- Verify: Check your server console for the startup message:
Code:
╔══════════════════════════════╗
║ SkriptPDC-API v3.0 Enabled ║
║ Full Modern 2.14 API ║
╚══════════════════════════════╝
_________________________________________________________________
Expressions
Expression PDC Tag
Description: Gets or sets a PDC tag value. Supports get, set, delete, add, and remove operations. Works with items, entities, and chunks.
Examples:
code_language.skript:
# Set different data types
set pdc tag "myplugin:level" of player's tool to 5
set pdc tag "myplugin:name" of player's tool to "Legendary Sword"
set pdc tag "myplugin:damage" of player's tool to 12.5
# Get values
set {_level} to pdc tag "myplugin:level" of player's tool
send "Item level: %{_level}%"
# Math operations
add 1 to pdc tag "myplugin:kills" of player
# Chunk support
set pdc tag "region:protected" of chunk at player to true
Expression All PDC Tags
Description: Returns a list of all PDC tag keys present on an object.
Examples:
code_language.skript:
# Get all tags from an item
set {_tags::*} to all pdc tags of player's tool
send "This item has %size of {_tags::*}% tags"
# Loop through all tags of a player
loop all pdc tags of player:
set {_value} to pdc tag loop-value of player
send "%loop-value%: %{_value}%"
_________________________________________________________________
Checking Tags (Conditions)
Condition Check if Tag Exists
Description: The standard Skript way to check if an object has a specific PDC tag.
Examples:
code_language.skript:
# Check if an item tag exists
if pdc tag "myplugin:special" of player's tool is set:
send "This is a special item!"
# Check if a chunk tag is true
if pdc tag "region:protected" of chunk at event-block is true:
cancel event
Condition Check if PDC is Empty
Description: Checks if an object's PDC is empty (contains no tags).
Examples:
code_language.skript:
# Check if an item's PDC is empty
if size of all pdc tags of player's tool is 0:
send "This item has no custom data"
_________________________________________________________________
Effects
Effect Clear PDC
Description: Removes all PDC tags from an object.
Examples:
code_language.skript:
# Clear all tags from an item
clear all pdc of player's tool
# Clear chunk data
clear pdc from chunk at player
Effect Remove PDC Tags
Description: Removes one or more specific PDC tags from an object.
Examples:
code_language.skript:
# Remove single tag
remove pdc tag "myplugin:temp" of player's tool
# Remove multiple tags
remove pdc tags "myplugin:level", "myplugin:exp" from player's tool
_________________________________________________________________
Usage Examples
Example 1: Item Leveling System
code_language.skript:
command /levelitem:
trigger:
give player diamond sword named "&6Legendary Sword"
set pdc tag "weapon:level" of player's tool to 1
set pdc tag "weapon:exp" of player's tool to 0
on death:
if attacker is a player:
if pdc tag "weapon:level" of attacker's tool is set:
add 25 to pdc tag "weapon:exp" of attacker's tool
set {_exp} to pdc tag "weapon:exp" of attacker's tool
set {_level} to pdc tag "weapon:level" of attacker's tool
if {_exp} >= {_level} * 100:
add 1 to pdc tag "weapon:level" of attacker's tool
set pdc tag "weapon:exp" of attacker's tool to 0
send "&aLevel Up! Your weapon is now level %{_level} + 1%!" to attacker
Example 2: Soulbound Items
code_language.skript:
command /soulbind:
trigger:
if player's tool is air:
send "&cYou must hold an item!"
stop
if pdc tag "soulbound:owner" of player's tool is set:
send "&cThis item is already soulbound!"
stop
set pdc tag "soulbound:owner" of player's tool to player's uuid as string
send "&aYour item is now soulbound!"
on pickup:
if pdc tag "soulbound:owner" of event-item is set:
set {_ownerUUID} to pdc tag "soulbound:owner" of event-item
if player's uuid as string is not {_ownerUUID}:
cancel event
send "&cThis item belongs to someone else!"
Example 3: Protected Regions with Chunks
code_language.skript:
command /protectchunk:
trigger:
set {_chunk} to chunk at player
set pdc tag "region:protected" of {_chunk} to true
set pdc tag "region:owner" of {_chunk} to player's uuid as string
send "&aChunk protected!"
on break:
set {_chunk} to chunk at event-block
if pdc tag "region:protected" of {_chunk} is true:
set {_owner} to pdc tag "region:owner" of {_chunk}
if player's uuid as string is not {_owner}:
cancel event
send "&cThis chunk is protected!"
_________________________________________________________________
Supported Data Types
SkriptPDC intelligently handles data types. When you set a tag, the addon automatically detects the type and stores it using the most appropriate format.
Code:
| Data Type | Skript Equivalent | Example Value |
|-----------------|-------------------|-------------------|
| String | text | "Hello World" |
| Integer | integer | 42 |
| Double / Float | number | 3.14159 |
| Long | number | 999999999 |
| Byte | number | 127 |
| Boolean | boolean | true / false |
Complex Data Types
For any other Skript data type (like location, itemstack, etc.), SkriptPDC will use Skript's built-in serialization system.
code_language.skript:
# Storing a location on a player
set pdc tag "homes:home1" of player to player's location
# ... later
set {_home} to pdc tag "homes:home1" of player
teleport player to {_home}
_________________________________________________________________
FAQ & Troubleshooting
How do I use namespaced keys?
Tags should ideally be in the format namespace:key. The namespace prevents conflicts with other plugins. If you provide a key without a namespace (e.g., "level"), SkriptPDC will automatically use your script's name as the namespace.
Why isn't my item data saving?
When manipulating items stored in variables or inventory slots, you must manually apply the modified item back to its original place. Modifying player's tool handles this automatically.
code_language.skript:
# Correct way to update an item in a specific slot
set {_item} to slot 0 of player's inventory
set pdc tag "myplugin:tag" of {_item} to "value"
set slot 0 of player's inventory to {_item} # This line is crucial!
What objects support PDC?
SkriptPDC supports all objects that implement Bukkit's PersistentDataHolder interface:
- Items: itemstack, itemtype, inventory slots
- Entities: All entity types (Players, Mobs, Armor Stands, etc.)
- Chunks: World chunks for region-based data
Can I store lists or multiple values?
PDC stores single values per tag. For lists, Skript's serialization handles this automatically when you set a list variable to a tag.
code_language.skript:
# Skript's serialization handles this automatically
set {_friends::*} to "Player1", "Player2" and "Player3"
set pdc tag "friends:list" of player to {_friends::*}
# Later...
set {_retrievedFriends::*} to pdc tag "friends:list" of player
# {_retrievedFriends::*} is now a list again
_________________________________________________________________
SkriptPDC API v3.0 - Created by Fendi
For convenience, the docs was generated by AI, I apologize for any errors in the examples.