- 📂 Local File Loading Automatically scans and reads
.jsonfiles from theplugins/PlaceholderAPI/json/directory. - ⚡ Smart Caching & Hot-Reload Caches JSON content in RAM for instant access. Automatically detects file changes on disk and reloads only when necessary. Zero performance impact.
- 🔍 Deep Nesting Support Full support for dot notation to access nested keys (e.g.,
messages.welcome.text). - 🧠 Intelligent Matching Correctly distinguishes between similar filenames (e.g.,
shop.jsonvsshop_items.json).
To build this project, you need:
- JDK 21 or higher.
- Gradle (optional, wrapper is included).
Open your terminal in the project directory and run:
Windows (PowerShell/CMD):
.\gradlew buildLinux/macOS:
./gradlew buildThe compiled file will be located at: build/libs/LocalJsonExpansion-1.x.x.jar
- Stop your Minecraft server.
- Navigate to
plugins/PlaceholderAPI/expansions/. - Drop the
JsonExpansion-1.x.x.jarfile there. - Start the server.
The expansion looks for files in a specific folder. You must create it if it doesn't exist:
plugins/PlaceholderAPI/json/
The pattern is:
%json_<filename>_<path_to_key>%
| Parameter | Description |
|---|---|
<filename> |
The name of the file. |
<path_to_key> |
The key inside the JSON. Use dots . for nested objects. |
File: plugins/PlaceholderAPI/json/holidays.json
{
"first": "New Year",
"second": "Christmas"
}Placeholders:
%json_holidays_first%→ Returns: New Year%json_holidays_second%→ Returns: Christmas
File: plugins/PlaceholderAPI/json/server.json
{
"status": "online",
"motd": {
"line1": "Welcome to Paradise!",
"maintenance": false
}
}Placeholders:
%json_server_status%→ Returns: online%json_server_motd.line1%→ Returns: Welcome to Paradise!
❌ Placeholder returns File not found
- Ensure the file exists in
plugins/PlaceholderAPI/json/. - Check if the filename in the placeholder matches the actual filename (case-insensitive, but exact spelling required).
- Do not include
.jsonin the placeholder macro.
❌ Placeholder returns Invalid JSON
- The file exists but contains syntax errors.
- Validate your JSON content using a site like jsonlint.com.
❌ Placeholder returns ...
- The file was found, but the specific key does not exist.
- Check for typos in the path (e.g.,
motd.line1vsmotd.line_1).