{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/bukkit-plugin-yml/latest.json",
  "title": "JSON schema for Bukkit Plugin YAML",
  "x-lintel": {
    "source": "https://www.schemastore.org/bukkit-plugin.json",
    "sourceSha256": "60c8d23080460693f108b91c02892200b5b03fc75fe3d4bf3fb78f214153c61e",
    "fileMatch": [
      "plugin.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "name": {
      "$ref": "#/$defs/plugin-name",
      "description": "The unique name of plugin."
    },
    "main": {
      "description": "The plugin's initial class file.",
      "type": "string",
      "pattern": "^(?!org\\.bukkit\\.)([a-zA-Z_$][a-zA-Z0-9_$]*\\.)*[a-zA-Z_$][a-zA-Z0-9_$]*$"
    },
    "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": "#/$defs/plugin-name"
      }
    },
    "softdepend": {
      "description": "Other plugins that add functionality.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/plugin-name"
      }
    },
    "loadbefore": {
      "description": "A list of plugins should be loaded after this plugin.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/plugin-name"
      }
    },
    "commands": {
      "description": "The commands the plugin will register",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/command"
      }
    },
    "permissions": {
      "description": "The permissions the plugin will register",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/permission",
        "type": "object"
      }
    },
    "default-permission": {
      "$ref": "#/$defs/default-permission",
      "description": "Gives the default default state of permissions registered for the plugin."
    },
    "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"
  ],
  "additionalProperties": true,
  "$defs": {
    "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": {
          "$ref": "#/$defs/default-permission",
          "description": "The default state for the permission."
        },
        "children": {
          "description": "Allows other permissions to be set as a relation to the parent permission.",
          "type": [
            "array",
            "object"
          ],
          "items": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/permission",
            "type": [
              "boolean",
              "object"
            ],
            "items": {
              "type": "boolean"
            }
          }
        }
      }
    },
    "default-permission": {
      "type": [
        "string",
        "boolean"
      ],
      "enum": [
        true,
        false,
        "op",
        "not op"
      ],
      "default": "op"
    }
  }
}
