{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/paper-plugin",
  "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", "not op"]
    },
    "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": {
      "$ref": "#/definitions/plugin-name",
      "description": "The name of the plugin"
    },
    "main": {
      "$ref": "#/definitions/plugin-class",
      "description": "The main class of the plugin",
      "examples": ["com.example.ExamplePlugin"]
    },
    "bootstrapper": {
      "$ref": "#/definitions/plugin-class",
      "description": "The main class of the custom bootstrapper for the plugin",
      "examples": ["com.example.ExamplePluginBoostrapper"]
    },
    "loader": {
      "$ref": "#/definitions/plugin-class",
      "description": "The main class of the custom plugin loader for the plugin",
      "examples": ["com.example.ExamplePluginLoader"]
    },
    "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}(\\.\\d{1,2})?$",
      "examples": ["1.19", "1.20", "1.20.6"]
    },
    "dependencies": {
      "description": "Plugin dependencies.",
      "type": "object",
      "properties": {
        "bootstrap": {
          "$ref": "#/definitions/dependency-group",
          "description": "Dependencies for the plugin bootstrapper"
        },
        "server": {
          "$ref": "#/definitions/dependency-group",
          "description": "Dependencies for the server"
        }
      },
      "additionalProperties": false
    }
  },
  "required": ["name", "version", "main", "api-version"],
  "title": "Paper paper-plugin.yml",
  "type": "object"
}
