213 lines
3.6 KiB
Markdown
213 lines
3.6 KiB
Markdown
---
|
|
title: Manifest Schema
|
|
type: docs
|
|
weight: 1
|
|
---
|
|
|
|
The `manifest.json` file defines your plugin's metadata and configuration.
|
|
|
|
## Basic Structure
|
|
|
|
```json
|
|
{
|
|
"name": "MyPlugin",
|
|
"version": "1.0.0",
|
|
"main": "com.example.MyPlugin",
|
|
"dependencies": []
|
|
}
|
|
```
|
|
|
|
## Required Fields
|
|
|
|
### name
|
|
**Type:** `string`
|
|
|
|
The unique identifier for your plugin. Used for logging and dependency resolution.
|
|
|
|
```json
|
|
{
|
|
"name": "MyAwesomePlugin"
|
|
}
|
|
```
|
|
|
|
### version
|
|
**Type:** `string`
|
|
|
|
The plugin version following semantic versioning (recommended).
|
|
|
|
```json
|
|
{
|
|
"version": "1.0.0"
|
|
}
|
|
```
|
|
|
|
### main
|
|
**Type:** `string`
|
|
|
|
The fully qualified class name of your main plugin class. This class must extend `JavaPlugin`.
|
|
|
|
```json
|
|
{
|
|
"main": "com.example.myplugin.MyPlugin"
|
|
}
|
|
```
|
|
|
|
## Optional Fields
|
|
|
|
### dependencies
|
|
**Type:** `string[]`
|
|
|
|
List of plugin names this plugin depends on. Dependent plugins will be loaded first.
|
|
|
|
```json
|
|
{
|
|
"dependencies": ["CoreLib", "DatabasePlugin"]
|
|
}
|
|
```
|
|
|
|
### description
|
|
**Type:** `string`
|
|
|
|
A brief description of your plugin.
|
|
|
|
```json
|
|
{
|
|
"description": "Adds awesome features to the server"
|
|
}
|
|
```
|
|
|
|
### author
|
|
**Type:** `string`
|
|
|
|
The plugin author or team name.
|
|
|
|
```json
|
|
{
|
|
"author": "YourName"
|
|
}
|
|
```
|
|
|
|
### authors
|
|
**Type:** `string[]`
|
|
|
|
List of plugin authors for team projects.
|
|
|
|
```json
|
|
{
|
|
"authors": ["Developer1", "Developer2"]
|
|
}
|
|
```
|
|
|
|
### website
|
|
**Type:** `string`
|
|
|
|
Plugin homepage or documentation URL.
|
|
|
|
```json
|
|
{
|
|
"website": "https://example.com/myplugin"
|
|
}
|
|
```
|
|
|
|
## Complete Example
|
|
|
|
```json
|
|
{
|
|
"name": "EconomyPlugin",
|
|
"version": "2.1.0",
|
|
"main": "com.example.economy.EconomyPlugin",
|
|
"description": "A comprehensive economy system for Hytale servers",
|
|
"author": "GameDev",
|
|
"authors": ["GameDev", "Contributor1"],
|
|
"website": "https://github.com/example/economy",
|
|
"dependencies": ["DatabaseLib"]
|
|
}
|
|
```
|
|
|
|
## File Location
|
|
|
|
The `manifest.json` must be placed in the root of your plugin JAR file:
|
|
|
|
```
|
|
MyPlugin.jar
|
|
├── manifest.json
|
|
├── com/
|
|
│ └── example/
|
|
│ └── myplugin/
|
|
│ └── MyPlugin.class
|
|
└── resources/
|
|
└── config.yml
|
|
```
|
|
|
|
## Validation
|
|
|
|
{{< callout type="warning" >}}
|
|
The server validates manifest.json on startup. Invalid manifests will prevent your plugin from loading.
|
|
|
|
Common issues:
|
|
- Missing required fields (name, version, main)
|
|
- Invalid JSON syntax
|
|
- Main class not found in JAR
|
|
- Circular dependencies
|
|
{{< /callout >}}
|
|
|
|
## Main Class Requirements
|
|
|
|
Your main class specified in `main` must:
|
|
|
|
1. Extend `JavaPlugin`
|
|
2. Have a public no-argument constructor
|
|
3. Be accessible in the JAR classpath
|
|
|
|
```java
|
|
package com.example.myplugin;
|
|
|
|
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
|
|
|
|
public class MyPlugin extends JavaPlugin {
|
|
@Override
|
|
public void start() {
|
|
// Plugin enabled - register events, commands, etc.
|
|
getLogger().at(Level.INFO).log("Plugin started!");
|
|
}
|
|
|
|
@Override
|
|
public void shutdown() {
|
|
// Plugin disabled - cleanup resources
|
|
}
|
|
}
|
|
```
|
|
|
|
## Dependency Resolution
|
|
|
|
Dependencies are loaded in order:
|
|
|
|
1. All dependencies must be present and valid
|
|
2. Circular dependencies cause load failure
|
|
3. Missing dependencies cause load failure
|
|
|
|
```
|
|
LoadOrder:
|
|
1. DatabaseLib (no dependencies)
|
|
2. CoreLib (depends on DatabaseLib)
|
|
3. MyPlugin (depends on CoreLib)
|
|
```
|
|
|
|
## Version Compatibility
|
|
|
|
{{< callout type="info" >}}
|
|
Consider versioning your plugin API if other plugins depend on you:
|
|
- Major: Breaking changes
|
|
- Minor: New features, backward compatible
|
|
- Patch: Bug fixes
|
|
{{< /callout >}}
|
|
|
|
```json
|
|
{
|
|
"name": "MyAPI",
|
|
"version": "2.0.0"
|
|
}
|
|
```
|
|
|
|
Dependent plugins can then specify minimum versions in their documentation.
|