Skip to content

Commit 4b00f1b

Browse files
committed
feat: rebrand "paper plugins" as "lifecycle plugins"
1 parent 4a113f1 commit 4b00f1b

File tree

20 files changed

+135
-121
lines changed

20 files changed

+135
-121
lines changed

_redirects

+3
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
/paper/configuration /paper/reference/configuration
99
/paper/reference/vanilla-command-permissions /paper/reference/permissions
1010
/paper/dev/commands /paper/dev/command-api/commands
11+
/paper/dev/getting-started/paper-plugins /paper/dev/advanced/lifecycle-plugins
12+
/paper/dev/userdev /paper/dev/advanced/userdev
13+
/paper/admin/reference/paper-plugins /paper/admin/reference/lifecycle-plugins

config/sidebar.paper.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const paper: SidebarsConfig = {
6767
],
6868
},
6969
"admin/reference/system-properties",
70-
"admin/reference/paper-plugins",
70+
"admin/reference/lifecycle-plugins",
7171
"admin/reference/vanilla-command-permissions",
7272
],
7373
},
@@ -100,11 +100,9 @@ const paper: SidebarsConfig = {
100100
id: "dev/getting-started/README",
101101
},
102102
items: [
103+
"dev/getting-started/how-do-plugins-work",
103104
"dev/getting-started/project-setup",
104105
"dev/getting-started/plugin-yml",
105-
"dev/getting-started/how-do-plugins-work",
106-
"dev/getting-started/paper-plugins",
107-
"dev/getting-started/userdev",
108106
],
109107
},
110108
{
@@ -176,6 +174,16 @@ const paper: SidebarsConfig = {
176174
"dev/misc/internal-code",
177175
],
178176
},
177+
{
178+
type: "category",
179+
label: "Advanced",
180+
collapsed: true,
181+
link: {
182+
type: "doc",
183+
id: "dev/advanced/README",
184+
},
185+
items: ["dev/advanced/lifecycle-plugins", "dev/advanced/userdev"],
186+
},
179187
],
180188
},
181189
{

docs/misc/hangar-publishing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Your plugin project needs to use Gradle as its build tooling.
2121
If you are using
2222
Maven, [switching to a Gradle setup is easy](https://docs.gradle.org/current/userguide/migrating_from_maven.html) and in
2323
general recommended due to higher configurability and support for other plugins, such as
24-
when [compiling against an unobfuscated Minecraft server](/paper/dev/userdev).
24+
when [compiling against an unobfuscated Minecraft server](/paper/dev/advanced/userdev).
2525

2626
The provided examples use Kotlin DSL, but you can also do the same using Groovy. Online converters (even ChatGPT)
2727
are able to convert the example code.

docs/paper/admin/getting-started/adding-plugins.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ slug: /adding-plugins
44
description: Plugins are the most powerful way to extend the functionality of Paper beyond the configuration files.
55
---
66

7-
# Adding Plugins
7+
# Adding Plugins to your Paper Server
88

99
Plugins are the most powerful way to extend the functionality of Paper beyond the configuration
1010
files. Functionality added by plugins can range from making milk restore hunger or dead bushes grow,
@@ -18,7 +18,7 @@ it is imperative that plugins only be installed from trusted sources. Be careful
1818

1919
:::
2020

21-
## Finding plugins
21+
## Finding Paper plugins for your server
2222

2323
Before installing a plugin, you'll need to find what you want to install. The best place to find plugins is [Hangar](https://hangar.papermc.io), Paper's plugin repository, but you can also find many plugins
2424
on [SpigotMC](https://www.spigotmc.org/resources/),
@@ -35,7 +35,7 @@ mention Paper compatibility. It'll still work.
3535

3636
:::
3737

38-
## Installing plugins
38+
## Installing plugins on your Paper server
3939

4040
1. Once you've found the plugin you'd like to install, download it. Ensure the file you have
4141
downloaded ends in `.jar`. Some plugins also distribute as `.zip` files, in which case you will
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
slug: /reference/lifecycle-plugins
3+
description: A guide to the ins and outs of lifecycle plugins.
4+
---
5+
6+
# Lifecycle Plugins
7+
8+
This documentation page serves to explain all the new semantics and possible confusions that lifecycle plugins may introduce.
9+
10+
:::info
11+
12+
Developers can get more information on lifecycle plugins [here](docs/paper/dev/advanced/lifecycle-plugins.mdx).
13+
14+
:::
15+
16+
## What are they?
17+
18+
Lifecycle plugins are plugins which are loaded by Paper's new plugin loading framework. Lifecycle plugins are used by developers to
19+
take advantage of modern systems Mojang provides, for example, datapacks.
20+
21+
![Plugin List](assets/plugin-list.png)
22+
23+
## What is the difference?
24+
25+
When enabled, lifecycle plugins are **identical** to traditional paper plugins. This allows plugins to still fully communicate and support each other, meaning that even if a
26+
plugin is a traditional paper plugin or lifecycle plugin, they are both able to depend on each other just fine.
27+
28+
Lifecycle plugins only support being loaded by Paper's Plugin Loader and may use new API unavailable to Bukkit plugins.
29+
30+
### How do I add Lifecycle plugins?
31+
32+
Lifecycle plugins are added the same as traditional paper plugins, therefore, you can follow [this guide](docs/paper/admin/getting-started/adding-plugins.md).
33+
34+
### Cyclic plugin loading
35+
36+
With the introduction of lifecycle plugins, Paper introduces a new plugin loader that fixes some odd issues.
37+
However, as a result, this now causes [cyclic loading](docs/paper/dev/advanced/lifecycle-plugins.mdx#cyclic-plugin-loading) between plugins to no longer be supported.
38+
39+
If Paper detects a loop, your server will be shut down with an error.
40+
41+
:::danger[Legacy]
42+
43+
If your server **requires** this circular loading, you can enable this by adding the [`-Dpaper.useLegacyPluginLoading=true`](system-properties.md#paperuselegacypluginloading) startup flag.
44+
Please note that this may not be supported in the future.
45+
46+
:::

docs/paper/admin/reference/paper-plugins.md

-46
This file was deleted.

docs/paper/admin/reference/system-properties.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ It also remaps plugin CB calls to remove the version information.
198198
#### paper.useLegacyPluginLoading
199199

200200
- **default**: `false`
201-
- **description**: Allows cyclic plugin loading. See [here](paper-plugins.md#cyclic-plugin-loading) for more info.
201+
- **description**: Allows cyclic plugin loading. See [here](lifecycle-plugins.md#cyclic-plugin-loading) for more info.
202202

203203
#### Paper.DisableCommandConverter
204204

@@ -213,7 +213,7 @@ It also remaps plugin CB calls to remove the version information.
213213
#### paper.disablePluginRemapping
214214

215215
- **default**: `false`
216-
- **description**: Disables plugin remapping introduced in 1.20.5. For more information see the [userdev](../../dev/getting-started/userdev.mdx#1205-and-beyond) documentation and the official [announcement](https://discord.com/channels/289587909051416579/976631292747735080/1232740079097876570).
216+
- **description**: Disables plugin remapping introduced in 1.20.5. For more information see the [userdev](../../dev/advanced/userdev.mdx#1205-and-beyond) documentation and the official [announcement](https://discord.com/channels/289587909051416579/976631292747735080/1232740079097876570).
217217

218218
#### paper.preferSparkPlugin
219219

docs/paper/dev/advanced/README.mdx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import DocCardList from "@theme/DocCardList";
2+
import { useCurrentSidebarCategory } from "@docusaurus/theme-common";
3+
4+
# Advanced Topics
5+
6+
This section contains advanced topics for Paper plugin developers.
7+
Be sure to read the [Getting Started](/paper/dev/getting-started) guide before diving into these topics.
8+
9+
---
10+
11+
<DocCardList items={useCurrentSidebarCategory().items} />

docs/paper/dev/getting-started/paper-plugins.mdx docs/paper/dev/advanced/lifecycle-plugins.mdx

+22-30
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
---
2-
slug: /dev/getting-started/paper-plugins
3-
description: A development guide for how to write Paper-specific plugins.
2+
slug: /dev/advanced/lifecycle-plugins
3+
description: A development guide for how to write lifecycle plugins.
44
---
55

6-
# Paper Plugins (Experimental)
6+
# Lifecycle Plugins
77

8-
Paper plugins allow developers to take advantage of more modern concepts introduced by Mojang, such as datapacks, to
9-
expand the field of what the Paper API is able to introduce.
10-
11-
:::danger[Experimental]
12-
13-
This is experimental and may be subject to change.
14-
15-
:::
8+
## What is it used for?
9+
Lifecycle plugins, as the name suggests, allow developers to have more control over their plugins lifecycle.
10+
This is required to take advantage of some of the more modern concepts introduced by Mojang, such as datapacks.
11+
Lifecycle plugins allow us to do just that by defining a new way to load plugin resources before the server
12+
has started in form of [bootstrappers](#bootstrapper).
1613

1714
- [Bootstrapper](#bootstrapper)
1815
- [Loader](#loaders)
1916
- [Differences](#differences)
2017

2118
## How do I use them?
22-
Similarly to Bukkit plugins, you have to introduce a `paper-plugin.yml` file into your JAR resources folder.
19+
Similarly to traditional paper plugins, you have to introduce a `paper-plugin.yml` file into your JAR resources folder.
2320
This will not act as a drop-in replacement for `plugin.yml`, as some things, as outlined in this guide, need to be declared differently.
2421

25-
It should be noted that you still have the ability to include both `paper-plugin.yml` and `plugin.yml` in the same JAR.
22+
It should be noted that you still have the ability to include both `paper-plugin.yml` and `plugin.yml` in the same JAR, which can be useful for compatibility with older versions of Paper.
2623

2724
Here is an example configuration:
2825
<VersionFormattedCode language={"yaml"}>
@@ -39,7 +36,7 @@ loader: io.papermc.testplugin.TestPluginLoader
3936

4037
### Dependency declaration
4138

42-
Paper plugins change how to declare dependencies in your `paper-plugin.yml`:
39+
Lifecycle plugins change how to declare dependencies in your `paper-plugin.yml`:
4340

4441
```yml
4542
dependencies:
@@ -60,7 +57,7 @@ dependencies:
6057
join-classpath: false
6158
```
6259
63-
With Paper plugins, dependencies are split into two sections:
60+
With lifecycle plugins, dependencies are split into two sections:
6461
- `bootstrap` - These are dependencies that you will be using in the [bootstrap](#bootstrapper).
6562
- `server` - These are dependencies that are used for the core functionality of your plugin, whilst the server is running.
6663

@@ -103,13 +100,8 @@ SuperDuperTacoParty:
103100
join-classpath: true
104101
```
105102

106-
## What is it used for?
107-
Paper plugins lay down the framework for some future API. Our goals are to open more modern API that better aligns
108-
with Vanilla. Paper plugins allow us to do just that by making a new way to load plugin resources before the server
109-
has started by using [bootstrappers](#bootstrapper).
110-
111103
## Bootstrapper
112-
Paper plugins are able to identify their own bootstrapper by implementing
104+
Lifecycle plugins are able to identify their own bootstrapper by implementing
113105
<Javadoc name={"io.papermc.paper.plugin.bootstrap.PluginBootstrap"}>`PluginBootstrap`</Javadoc>
114106
and adding the class of your implementation to the bootstrapper field in the `paper-plugin.yml`.
115107
```java title="TestPluginBootstrap.java"
@@ -131,7 +123,7 @@ A bootstrapper also allows you to change the way your plugin is initialized, all
131123
Currently, bootstrappers do not offer much new API and are highly experimental. This may be subject to change once more API is introduced.
132124

133125
## Loaders
134-
Paper plugins are able to identify their own plugin loader by implementing
126+
Lifecycle plugins are able to identify their own plugin loader by implementing
135127
<Javadoc name={"io.papermc.paper.plugin.loader.PluginLoader"}>`PluginLoader`</Javadoc>
136128
and adding the class of your implementation to the loader field in the `paper-plugin.yml`.
137129

@@ -159,40 +151,40 @@ Currently, you are able to add two different library types:
159151
## Differences
160152

161153
### Bukkit serialization system
162-
Paper plugins still support the serialization system (`org.bukkit.configuration.serialization`) that Bukkit uses. However, custom classes will not be
154+
Lifecycle plugins still support the serialization system (`org.bukkit.configuration.serialization`) that Bukkit uses. However, custom classes will not be
163155
automatically registered for serialization. In order to use <Javadoc name={"org.bukkit.configuration.ConfigurationSection#getObject(java.lang.String,java.lang.Class)"}>`ConfigurationSection#getObject`</Javadoc>,
164156
you **must** call <Javadoc name={"org.bukkit.configuration.serialization.ConfigurationSerialization#registerClass(java.lang.Class)"}>`ConfigurationSerialization#registerClass(Class)`</Javadoc>
165157
before you attempt to fetch objects from configurations.
166158

167159
### Classloading isolation
168-
Paper plugins are not able to access each other unless given explicit access by depending on another plugin, etc. This
169-
helps prevent Paper plugins from accidentally accessing each other's dependencies, and in general helps ensure that
160+
Lifecycle plugins are not able to access each other unless given explicit access by depending on another plugin, etc. This
161+
helps prevent Lifecycle plugins from accidentally accessing each other's dependencies, and in general helps ensure that
170162
plugins are only able to access what they explicitly depend on.
171163

172-
Paper plugins have the ability to bypass this, being able to access OTHER plugins' classloaders by adding a `join-classpath` option to their `paper-plugin.yml`.
164+
Lifecycle plugins have the ability to bypass this, being able to access OTHER plugins' classloaders by adding a `join-classpath` option to their `paper-plugin.yml`.
173165

174166
```yml
175167
Plugin:
176168
join-classpath: true # Means you have access to their classpath
177169
```
178170

179-
Note, other Paper plugins will still be unable to access your classloader.
171+
Note, other Lifecycle plugins will still be unable to access your classloader.
180172

181173
### Load order logic split
182-
In order to better take advantage of classloading isolation, Paper plugins do **not** use the `dependencies` field to determine load order.
174+
In order to better take advantage of classloading isolation, Lifecycle plugins do **not** use the `dependencies` field to determine load order.
183175
This was done for a variety of reasons, mostly to allow better control and allow plugins to properly share classloaders.
184176

185177
See [declaring dependencies](#dependency-declaration) for more information on how to declare the load order of your plugin.
186178

187179
### Commands
188-
Paper plugins do not use the `commands` field to register commands. This means that you do not need to include all
180+
Lifecycle plugins do not use the `commands` field to register commands. This means that you do not need to include all
189181
of your commands in the `paper-plugin.yml` file. Instead, you can register commands using the
190182
[Brigadier Command API](../api/command-api/commands.mdx).
191183

192184
### Cyclic plugin loading
193185

194186
Cyclic loading describes the phenomenon when a plugin loading causes a loop that eventually cycles back to the original plugin.
195-
Unlike Bukkit plugins, Paper plugins will not attempt to resolve cyclic loading issues.
187+
Unlike traditional paper plugins, lifecycle plugins will not attempt to resolve cyclic loading issues.
196188

197189
```mermaid
198190
graph LR;

docs/paper/dev/getting-started/userdev.mdx docs/paper/dev/advanced/userdev.mdx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
slug: /dev/userdev
3-
sidebar_label: Paperweight Userdev
2+
slug: /dev/advanced/userdev
3+
sidebar_label: Accessing Internals (NMS, Userdev)
44
description: A guide on how to use the paperweight-userdev Gradle plugin to access internal code.
55
---
66

7-
# paperweight-userdev
7+
# Accessing Internals (NMS, Userdev)
88

9-
**paperweight** is the name of Paper's custom build tooling. The **paperweight-userdev** Gradle plugin part of that
10-
provides access to internal code (also known as NMS) during development.
9+
While it is generally recommended to use the Paper API for plugin development, there are some cases where you may need to access server internals, commonly referred to as NMS (short for net.minecraft.server).
10+
This guide will show you how to use the **paperweight-userdev** Gradle plugin to access internal code during development.
1111

1212
:::note
1313

docs/paper/dev/api/registries.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Beyond plain reading access to registries, Paper also offers a way for plugins t
101101

102102
:::warning
103103
Mutating registries needs to be done during the server's bootstrap phase.
104-
As such, this section is only applicable to [Paper plugins](../getting-started/paper-plugins.mdx).
104+
As such, this section is only applicable to [lifecycle plugins](../advanced/lifecycle-plugins.mdx).
105105

106106
**Exceptions** thrown by plugins during this phase will cause the server to shutdown before loading,
107107
as missing values or modifications to the registries would otherwise cause data loss.

docs/paper/dev/getting-started/README.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DocCardList from "@theme/DocCardList";
22
import { useCurrentSidebarCategory } from "@docusaurus/theme-common";
33

4-
# Development Guide
4+
# Getting Started with Paper Development
55

66
Welcome to the Paper development guide! This guide includes information and tutorials on
77
how to start developing plugins for Paper.

docs/paper/dev/getting-started/how-do-plugins-work.mdx

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ loaded from a `.jar` file. Each plugin has a main class that is specified in th
1313
class must extend JavaPlugin, and is the entry point for the plugin and is where the plugin's lifecycle methods are
1414
defined.
1515

16+
## Plugin lifecycle
17+
18+
Plugins are loaded and unloaded at runtime. When a plugin is loaded, it is initialized and enabled. When a plugin is
19+
unloaded, it is disabled and finalized.
20+
1621
:::warning
1722

1823
We do not recommend writing code inside your main class's constructor as there are no guarantees about what
@@ -21,11 +26,6 @@ do not call your plugin's constructor directly. This will cause issues with your
2126

2227
:::
2328

24-
## Plugin lifecycle
25-
26-
Plugins are loaded and unloaded at runtime. When a plugin is loaded, it is initialized and enabled. When a plugin is
27-
unloaded, it is disabled and finalized.
28-
2929
### Initialization
3030

3131
When a plugin is loaded, it is initialized. This means that the plugin is loaded into memory and its `onLoad`

0 commit comments

Comments
 (0)