{
  "$id": "https://json.schemastore.org/paper-plugin",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": true,
  "definitions": {
    "plugin-name": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_\\.-]+$"
    },
    "plugin-class": {
      "type": "string",
      "pattern": "^(?!io\\.papermc\\.)([a-zA-Z_$][a-zA-Z\\d_$]*\\.)*[a-zA-Z_$][a-zA-Z\\d_$]*$"
    },
    "perm-default": {
      "enum": ["true", "false", "op", "notop"]
    },
    "permission": {
      "type": "object",
      "description": "A permission for this plugin",
      "properties": {
        "default": {
          "$ref": "#/definitions/perm-default",
          "description": "Default for this permission"
        },
        "description": {
          "type": "string"
        },
        "children": {
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "object",
              "additionalProperties": {
                "oneOf": [
                  {
                    "type": "boolean",
                    "description": "False to not inherit the parent permission."
                  },
                  {
                    "$ref": "#/definitions/permission"
                  }
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "dependency": {
      "description": "A plugin dependency",
      "type": "object",
      "properties": {
        "load": {
          "description": "Where to load this dependency in relation to the plugin. Defaults to OMIT",
          "enum": ["AFTER", "BEFORE", "OMIT"]
        },
        "join-classpath": {
          "description": "Whether this dependency's classpath should be joined by the plugin. Defaults to true",
          "type": "boolean"
        },
        "required": {
          "description": "Whether this dependency is required for the plugin to load. Defaults to true",
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "dependency-group": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/dependency"
      }
    }
  },
  "description": "JSON schema for Paper Plugin YAML",
  "properties": {
    "name": {
      "description": "The name of the plugin",
      "$ref": "#/definitions/plugin-name"
    },
    "main": {
      "description": "The main class of the plugin",
      "examples": ["com.example.ExamplePlugin"],
      "$ref": "#/definitions/plugin-class"
    },
    "bootstrapper": {
      "description": "The main class of the custom bootstrapper for the plugin",
      "examples": ["com.example.ExamplePluginBoostrapper"],
      "$ref": "#/definitions/plugin-class"
    },
    "loader": {
      "description": "The main class of the custom plugin loader for the plugin",
      "examples": ["com.example.ExamplePluginLoader"],
      "$ref": "#/definitions/plugin-class"
    },
    "provides": {
      "description": "Satisfies dependency requirements as this plugin. When resolving dependencies, if a plugin requires a plugin in this list, this plugin will satisfy it.",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "#/definitions/plugin-name"
      }
    },
    "has-open-classloader": {
      "type": "boolean",
      "description": "Whether the plugin should have its classloader public to other paper plugins"
    },
    "version": {
      "description": "The version of the plugin",
      "type": ["string"]
    },
    "description": {
      "description": "The description of the plugin",
      "type": "string"
    },
    "authors": {
      "type": "array",
      "description": "Main authors of the plugin",
      "items": {
        "type": "string",
        "uniqueItems": true
      }
    },
    "contributors": {
      "type": "array",
      "description": "Other contributors to the plugin",
      "items": {
        "type": "string",
        "uniqueItems": true
      }
    },
    "website": {
      "type": "string",
      "description": "Plugin website"
    },
    "prefix": {
      "type": "string",
      "description": "Log prefix for this plugin. Defaults to the plugin name"
    },
    "load": {
      "enum": ["STARTUP", "POSTWORLD"],
      "description": "When to load this plugin. Defaults to POSTWORLD."
    },
    "default-perm": {
      "$ref": "#/definitions/perm-default",
      "description": "Default value for permissions. Defaults to 'op'"
    },
    "permissions": {
      "description": "Permissions for this plugin",
      "additionalProperties": {
        "$ref": "#/definitions/permission"
      }
    },
    "api-version": {
      "description": "The API version of the plugin",
      "type": "string",
      "pattern": "^1\\.\\d{2}$",
      "examples": ["1.19", "1.20"]
    },
    "dependencies": {
      "description": "Plugin dependencies.",
      "type": "object",
      "properties": {
        "bootstrap": {
          "description": "Depenencies for the plugin bootstrapper",
          "$ref": "#/definitions/dependency-group"
        },
        "server": {
          "description": "Depenencies for the server",
          "$ref": "#/definitions/dependency-group"
        }
      },
      "additionalProperties": false
    }
  },
  "required": ["name", "version", "main", "api-version"],
  "title": "Paper paper-plugin.yml",
  "type": "object"
}