{
  "$id": "https://json.schemastore.org/bukkit-plugin",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": true,
  "definitions": {
    "plugin-name": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_\\.-]+$"
    },
    "command": {
      "description": "Optional command attributes.",
      "type": "object",
      "properties": {
        "description": {
          "description": "A user-friendly description for a command.",
          "type": "string"
        },
        "aliases": {
          "description": "Alternate command names a user may use instead.",
          "type": ["string", "array"]
        },
        "permission": {
          "description": "The permission required to use the command.",
          "type": "string"
        },
        "permission-message": {
          "description": "A no-permission message.",
          "type": "string",
          "examples": ["You do not have <permission>"]
        },
        "usage": {
          "description": "A short description of how to use this command.",
          "type": "string"
        }
      }
    },
    "permission": {
      "description": "Optional permission attributes.",
      "properties": {
        "description": {
          "description": "A short description of what this permission allows.",
          "type": "string"
        },
        "default": {
          "description": "The default state for the permission.",
          "$ref": "#/definitions/default-permission"
        },
        "children": {
          "description": "Allows other permissions to be set as a relation to the parent permission.",
          "type": ["array", "object"],
          "items": {
            "type": "string"
          },
          "additionalProperties": {
            "type": ["boolean", "object"],
            "items": {
              "type": "boolean"
            },
            "$ref": "#/definitions/permission"
          }
        }
      }
    },
    "default-permission": {
      "type": ["string", "boolean"],
      "enum": [true, false, "op", "not op"],
      "default": "op"
    }
  },
  "properties": {
    "name": {
      "description": "The unique name of plugin.",
      "$ref": "#/definitions/plugin-name"
    },
    "main": {
      "description": "The plugin's initial class file.",
      "type": "string",
      "pattern": "^(?!org\\.bukkit\\.)([a-zA-Z_$][a-zA-Z\\d_$]*\\.)*[a-zA-Z_$][a-zA-Z\\d_$]*$"
    },
    "version": {
      "description": "A plugin revision identifier.",
      "type": ["string", "number"]
    },
    "description": {
      "description": "Human readable plugin summary.",
      "type": "string"
    },
    "author": {
      "description": "The plugin author.",
      "type": "string"
    },
    "authors": {
      "description": "The plugin contributors.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "website": {
      "title": "Website",
      "description": "The URL to the plugin's site",
      "type": "string",
      "format": "uri"
    },
    "prefix": {
      "description": "The token to prefix plugin log entries.",
      "type": "string"
    },
    "database": {
      "description": "Set to true if this plugin uses a database.",
      "type": "boolean",
      "default": false
    },
    "load": {
      "description": "The phase of server-startup this plugin will load during.",
      "type": "string",
      "enum": ["STARTUP", "POSTWORLD"],
      "default": "POSTWORLD"
    },
    "depend": {
      "description": "Other required plugins.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/plugin-name"
      }
    },
    "softdepend": {
      "description": "Other plugins that add functionality.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/plugin-name"
      }
    },
    "loadbefore": {
      "description": "A list of plugins should be loaded after this plugin.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/plugin-name"
      }
    },
    "commands": {
      "description": "The commands the plugin will register",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/command"
      }
    },
    "permissions": {
      "description": "The permissions the plugin will register",
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "$ref": "#/definitions/permission"
      }
    },
    "default-permission": {
      "description": "Gives the default default state of permissions registered for the plugin.",
      "$ref": "#/definitions/default-permission"
    },
    "awareness": {
      "description": "The concepts that the plugin acknowledges.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^!@.+$",
        "examples": ["!@UTF-8"]
      }
    },
    "api-version": {
      "description": "Gives the API version which this plugin is designed to support.",
      "type": ["string", "number"],
      "examples": ["1.13", "1.14", "1.15", "1.16"]
    },
    "libraries": {
      "description": "A list of libraries the server should download and supply to the plugin when loading it.",
      "type": "array",
      "items": {
        "type": "string",
        "description": "A single server provided library. This library can be used during runtime without being shaded into the plugin jar.",
        "pattern": "([^: ]+):([^: ]+)(:([^: ]*)(:([^: ]+))?)?:([^: ]+)",
        "examples": [
          "org.xerial:sqlite-jdbc:3.34.0",
          "com.google.dagger:dagger:2.36"
        ]
      }
    }
  },
  "required": ["name", "main", "version"],
  "title": "JSON schema for Bukkit Plugin YAML",
  "type": "object"
}
