Skip to content

Commit abf6277

Browse files
committed
feat: add name/id documentation, made example use all fields, replace field headers with list entries, move sidebar entry, add note inside creating-your-first-plugin
1 parent 673a763 commit abf6277

3 files changed

Lines changed: 90 additions & 55 deletions

File tree

astro.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ export default defineConfig({
323323
label: "Getting started",
324324
items: [
325325
"velocity/dev/creating-your-first-plugin",
326-
"velocity/dev/api-basics",
327326
"velocity/dev/velocity-plugin-json",
327+
"velocity/dev/api-basics",
328328
"velocity/dev/pitfalls",
329329
],
330330
},

src/content/docs/velocity/dev/getting-started/creating-your-first-plugin.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ How to set up a build system is outside the scope of this page, but you can look
5757
system's documentation ([Gradle](https://docs.gradle.org/current/userguide/userguide.html) or
5858
[Maven](https://maven.apache.org/guides/getting-started/index.html)) for assistance.
5959

60+
:::info[velocity-plugin.json]
61+
62+
Before you set up your build system, you should think about whether you want your `velocity-plugin.json`
63+
to be generated automatically using a `@Plugin` annotation in your source code or if you want to write it
64+
manually. Depending on which you prefer, you may need to add additional lines to your build files. You can find
65+
more information on the [`velocity-plugin.json`] file [here](/velocity/dev/velocity-plugin-json).
66+
67+
:::
68+
6069
### Setting up the dependency
6170

6271
<Tabs syncKey="build-system">

src/content/docs/velocity/dev/getting-started/velocity-plugin-json.mdx

Lines changed: 80 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ slug: velocity/dev/velocity-plugin-json
77
import { FileTree } from "@astrojs/starlight/components";
88

99
The `velocity-plugin.json` file is the configuration file for your plugin. It contains information
10-
about your plugin's name, description, version, main class path, and other.
11-
12-
The `velocity-plugin.json` file is located in the `resources` directory of your plugin. It is generated
13-
automatically if you configured the Velocity annotation processor and used the `@Plugin` annotation.
10+
about your plugin's name, description, version, main class path, and other. It is located in the `resources`
11+
directory of your plugin and may be generated automatically, if you configured the Velocity annotation processor
12+
and used a `@Plugin` annotation somewhere in your code.
1413

1514
<FileTree>
1615
- velocity-plugin/
@@ -28,62 +27,89 @@ This is an example `velocity-plugin.json` file:
2827

2928
```json title=velocity-plugin.json
3029
{
31-
"id": "example-plugin",
30+
"id": "example-plugin", // required
3231
"name": "Velocity Example Plugin",
3332
"version": "1.0.0",
3433
"description": "An example plugin for showcasing the plugin json file.",
35-
"main": "com.velocitypowered.testplugin.TestPluginMain"
36-
}
37-
```
38-
39-
## Fields
40-
The only required fields are `id` and `main`. Any other fields are optional.
41-
42-
### id
43-
The ID of the plugin. This ID needs to be unique for each plugin.
44-
- `"id": "a_cool_plugin"`
45-
46-
Plugin IDs must start with a lowercase letter and may contain lowercase letters,
47-
digits, hyphens, and underscores. The total length must not exceed 64 characters.
48-
49-
### main
50-
The path towards your main plugin class.
51-
- `"main": "com.example.yourplugin.PluginMain"`
52-
53-
### name
54-
A user-friendly variant of your plugin's name.
55-
- `"name": "A cool plugin"`
56-
57-
### version
58-
The version of your plugin.
59-
- `"version": "0.0.1-beta.7"`
60-
61-
### description
62-
The description of your plugin.
63-
- `"description": "Some interesting plugin description."`
64-
65-
### url
66-
The URL of your plugin's website.
67-
- `"url": "https://github.com/PaperMC/Velocity"`
68-
69-
### authors
70-
A list of your plugin's authors.
71-
- `"authors": ["Strokkur24", "electronicboy"]`
72-
73-
### dependencies
74-
Your plugin's dependencies. The value of this field is an array of dependency objects.
75-
76-
The dependency object itself has two fields:
77-
- `id` the plugin ID of the plugin you depend upon
78-
- `optional` whether the dependency is optional. This field is not required and defaults to `false`.
79-
80-
```json
81-
{
34+
"main": "com.example.testplugin.TestPluginMain", // required
35+
"url": "https://github.com/PaperMC/docs",
36+
"authors": ["Strokkur24"],
8237
"dependencies": [
8338
{
84-
"id": "luckperms",
85-
"optional": true
39+
"id": "luckperms", // required for dependencies
40+
"optional": true // defaults to false
8641
}
8742
]
8843
}
8944
```
45+
46+
## Fields
47+
The only required fields are `id` and `main`. Any other fields are optional.
48+
49+
- **`id`**\
50+
The ID of the plugin. This ID needs to be unique for each plugin. It is used for identifying your
51+
plugin internally and also used as the name for your plugin's logger.
52+
53+
Plugin IDs must start with a lowercase letter and may contain lowercase letters,
54+
digits, hyphens, and underscores. The total length must not exceed 64 characters.
55+
56+
```json
57+
{"id": "a_cool_plugin"}
58+
```
59+
60+
- **`main`**\
61+
The path towards your main plugin class.
62+
63+
```json
64+
{"main": "com.example.yourplugin.PluginMain"}
65+
```
66+
67+
- **`name`**\
68+
A user-friendly variant of your plugin's name. This is used for any user-facing display of your plugin, such
69+
as the `/velocity plugins` command.
70+
71+
```json
72+
{"name": "A cool plugin"}
73+
```
74+
75+
- **`version`**\
76+
The version of your plugin.
77+
```json
78+
{"version": "0.0.1-beta.7"}
79+
```
80+
81+
- **`description`**\
82+
The description of your plugin.
83+
```json
84+
{"description": "Some interesting plugin description."}
85+
```
86+
87+
- **`url`**\
88+
The URL of your plugin's website.
89+
```json
90+
{"url": "https://github.com/PaperMC/Velocity"}
91+
```
92+
93+
- **`authors`**\
94+
A list of your plugin's authors.
95+
```json
96+
{"authors": ["Strokkur24", "electronicboy"]}
97+
```
98+
99+
- **`dependencies`**\
100+
Your plugin's dependencies. The value of this field is an array of dependency objects.
101+
102+
The dependency object itself has two fields:
103+
- `id` the plugin ID of the plugin you depend upon
104+
- `optional` whether the dependency is optional. This field is not required and defaults to `false`.
105+
106+
```json
107+
{
108+
"dependencies": [
109+
{
110+
"id": "luckperms",
111+
"optional": true
112+
}
113+
]
114+
}
115+
```

0 commit comments

Comments
 (0)