diff --git a/config-specs/paper/server-properties.yml b/config-specs/paper/server-properties.yml
index ef1536ac0..609906eda 100644
--- a/config-specs/paper/server-properties.yml
+++ b/config-specs/paper/server-properties.yml
@@ -213,15 +213,9 @@ simulation-distance:
updated by the server, measured in chunks in each direction of the player (radius, not diameter).
If entities are outside this radius, then they will not be ticked by the server nor will they be
visible to players. Must be between 3 and 32 inclusive.
-spawn-animals:
- default: "true"
- description: "Determines if animals will be able to spawn."
spawn-monsters:
default: "true"
description: "Determines if monsters will be spawned."
-spawn-npcs:
- default: "true"
- description: "Determines if villagers will be spawned."
spawn-protection:
default: "16"
description: >
diff --git a/docs/paper/contributing/events.mdx b/docs/paper/contributing/events.mdx
index 57a2c9de7..7e2d3a544 100644
--- a/docs/paper/contributing/events.mdx
+++ b/docs/paper/contributing/events.mdx
@@ -42,4 +42,5 @@ parent event and capture any child events but also listen to the child event sep
### Miscellaneous
* New parameters or method returns of type `ItemStack`
-should be [`@NotNull`](https://javadoc.io/doc/org.jetbrains/annotations/latest/org/jetbrains/annotations/NotNull.html).
+should not be [`@Nullable`](https://javadoc.io/doc/org.jspecify/jspecify/latest/org/jspecify/annotations/Nullable.html)
+in most case and instead accept an empty itemStack.
diff --git a/docs/paper/dev/api/command-api/arguments.mdx b/docs/paper/dev/api/command-api/arguments.mdx
index 7a3590e26..5c7fd5aed 100644
--- a/docs/paper/dev/api/command-api/arguments.mdx
+++ b/docs/paper/dev/api/command-api/arguments.mdx
@@ -62,7 +62,6 @@ Argument type, but there are many others:
|---------------------|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| GAME_EVENT | GameEvent | [Game events](https://minecraft.wiki/w/Sculk_Sensor#Vibration_frequencies) |
| STRUCTURE_TYPE | StructureType | [Structure types](https://minecraft.wiki/w/Structure#Overworld) |
-| INSTRUMENT | MusicInstrument | [Goat horns](https://minecraft.wiki/w/Goat_Horn#Playing) |
| MOB_EFFECT | PotionEffectType | [Potion effect](https://minecraft.wiki/w/Effect#List) |
| BLOCK | BlockType | [Block type](https://minecraft.wiki/w/Block#List_of_blocks) |
| ITEM | ItemType | [Item type](https://minecraft.wiki/w/Item#List_of_items) |
@@ -72,23 +71,24 @@ Argument type, but there are many others:
| VILLAGER_TYPE | Villager.Type | [Villager biome specific type](https://minecraft.wiki/w/Villager#Professions) |
| MAP_DECORATION_TYPE | MapCursor.Type | [Types of sprites displayed on a map](https://minecraft.wiki/w/Map#Map_icons) |
| MENU | MenuType | [Menu type](https://wiki.vg/Inventory) |
+| ATTRIBUTE | Attribute | [Entity attribute](https://minecraft.wiki/w/Attribute) |
+| FLUID | Fluid | [Fluid types](https://minecraft.wiki/w/Fluid) |
+| SOUND_EVENT | Sound | [Events that trigger sound effects](https://minecraft.wiki/w/Sounds.json#Sound_events) |
+| BIOME | Biome | [Biome type](https://minecraft.wiki/w/Biome#Biome_types) |
| STRUCTURE | Structure | [Structures](https://minecraft.wiki/w/Structure#Overworld) |
| TRIM_MATERIAL | TrimMaterial | [Materials used to trim armor](https://minecraft.wiki/w/Smithing#Material) |
| TRIM_PATTERN | TrimPattern | [Trim patterns](https://minecraft.wiki/w/Smithing#Trimming) |
| DAMAGE_TYPE | DamageType | [All types of damage dealt to an entity](https://minecraft.wiki/w/Damage_type) |
+| WOLF_VARIANT | Wolf.Variant | [Wolf variants](https://minecraft.wiki/w/Wolf#Variants) |
| ENCHANTMENT | Enchantment | [Enchantment type](https://minecraft.wiki/w/Enchanting#Summary_of_enchantments) |
| JUKEBOX_SONG | JukeboxSong | Music disc songs |
-| WOLF_VARIANT | Wolf.Variant | [Wolf variants](https://minecraft.wiki/w/Wolf#Variants) |
| BANNER_PATTERN | PatternType | [Banner patterns](https://minecraft.wiki/w/Banner_Pattern#Variants) |
-| BIOME | Biome | [Biome type](https://minecraft.wiki/w/Biome#Biome_types) |
| PAINTING_VARIANT | Art | [Painting variants](https://minecraft.wiki/w/Painting#Canvases) |
-| ATTRIBUTE | Attribute | [Entity attribute](https://minecraft.wiki/w/Attribute) |
+| INSTRUMENT | MusicInstrument | [Goat horns](https://minecraft.wiki/w/Goat_Horn#Playing) |
| ENTITY_TYPE | EntityType | [Every entity type](https://minecraft.wiki/w/Entity#Types_of_entities) |
| PARTICLE_TYPE | Particle | [Every particle type](https://minecraft.wiki/w/Particles_(Java_Edition)#Types_of_particles) |
| POTION | PotionType | [Every potion type](https://minecraft.wiki/w/Potion#Effect_potions) |
-| SOUND_EVENT | Sound | [Events that trigger sound effects](https://minecraft.wiki/w/Sounds.json#Sound_events) |
| MEMORY_MODULE_TYPE | MemoryKey | Keys for saving per-entity data |
-| FLUID | Fluid | [Fluid types](https://minecraft.wiki/w/Fluid) |
Paper specifies many more argument types. For more information on them, see ArgumentTypes
@@ -100,7 +100,7 @@ interface.
Now, let's say that we want to implement a command which lets you order ice cream. For that,
we add an enum that specifies all available values for our custom type.
-```java
+```java title="IceCreamType.java"
public enum IceCreamType {
VANILLA,
CHOCOLATE,
@@ -111,11 +111,11 @@ public enum IceCreamType {
```
Now, we have to define the argument itself. We do this by implementing the CustomArgumentType.Converted interface:
-```java
+```java title="IceCreamTypeArgument.java"
public class IceCreamTypeArgument implements CustomArgumentType.Converted {
@Override
- public @NotNull IceCreamType convert(String nativeType) throws CommandSyntaxException {
+ public IceCreamType convert(String nativeType) throws CommandSyntaxException {
try {
return IceCreamType.valueOf(nativeType.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException ignored) {
@@ -126,7 +126,7 @@ public class IceCreamTypeArgument implements CustomArgumentType.Converted getNativeType() {
+ public ArgumentType getNativeType() {
return StringArgumentType.word();
}
@@ -154,7 +154,8 @@ detail.
We then need to register the command:
-```java
+```java title="TestPlugin.java"
+@Override
public void onEnable() {
final LifecycleEventManager manager = this.getLifecycleManager();
manager.registerEventHandler(LifecycleEvents.COMMANDS, event -> {
diff --git a/docs/paper/dev/api/command-api/commands.mdx b/docs/paper/dev/api/command-api/commands.mdx
index 6a21b2b6a..e6040d5f5 100644
--- a/docs/paper/dev/api/command-api/commands.mdx
+++ b/docs/paper/dev/api/command-api/commands.mdx
@@ -30,7 +30,7 @@ method of the plugin. Commands registered here will not be available to datapack
functions are loaded by the server before plugins are loaded. To make commands available to
datapacks, register them via the [PluginBootstrap](#pluginbootstrap).
-```java
+```java title="YourPluginClass.java"
public class YourPluginClass extends JavaPlugin {
@Override
@@ -69,7 +69,7 @@ Commands are registered in the same way in a plugin's
The benefit of registering commands here is that they will be available to datapack functions
because the command registration happens early enough.
-```java
+```java title="YourPluginBootstrap.java"
public class YourPluginBootstrap implements PluginBootstrap {
@Override
@@ -97,11 +97,11 @@ manager.registerEventHandler(LifecycleEvents.COMMANDS, event -> {
});
```
-```java
+```java title="FunCommand.java"
class FunCommand implements BasicCommand {
@Override
- public void execute(@NotNull CommandSourceStack stack, @NotNull String[] args) {
+ public void execute(CommandSourceStack stack, String[] args) {
if (args.length == 1 && args[0].equalsIgnoreCase("start")) {
stack.getSender().sendRichMessage("Fun activated!");
}
diff --git a/docs/paper/dev/api/component-api/intro.mdx b/docs/paper/dev/api/component-api/intro.mdx
index b518f2edb..a7d6b5d13 100644
--- a/docs/paper/dev/api/component-api/intro.mdx
+++ b/docs/paper/dev/api/component-api/intro.mdx
@@ -91,9 +91,9 @@ final Component component = MiniMessage.miniMessage().deserialize(
// if the syntax above is too verbose for you, create a helper method!
public final class Components {
- public static Component mm(String miniMessageString) { // mm, short for MiniMessage
- return MiniMessage.miniMessage().deserialize(miniMessageString);
- }
+ public static Component mm(String miniMessageString) { // mm, short for MiniMessage
+ return MiniMessage.miniMessage().deserialize(miniMessageString);
+ }
}
// ...
diff --git a/docs/paper/dev/api/custom-inventory-holder.mdx b/docs/paper/dev/api/custom-inventory-holder.mdx
index 7c78956f5..61fbb5f66 100644
--- a/docs/paper/dev/api/custom-inventory-holder.mdx
+++ b/docs/paper/dev/api/custom-inventory-holder.mdx
@@ -28,7 +28,7 @@ If you wish, you can use the static method `setFormat` method.
```java title="ChatRenderer#render"
-public @NotNull Component render(@NotNull Player source, @NotNull Component sourceDisplayName, @NotNull Component message, @NotNull Audience viewer) {
+public Component render(Player source, Component sourceDisplayName, Component message, Audience viewer) {
// ...
}
```
@@ -82,7 +82,7 @@ public class ChatListener implements Listener, ChatRenderer { // Implement the C
// Override the render method
@Override
- public @NotNull Component render(@NotNull Player source, @NotNull Component sourceDisplayName, @NotNull Component message, @NotNull Audience viewer) {
+ public Component render(Player source, Component sourceDisplayName, Component message, Audience viewer) {
// ...
}
}
@@ -127,7 +127,7 @@ public class ChatListener implements Listener, ChatRenderer {
// Listener logic
@Override
- public @NotNull Component render(@NotNull Player source, @NotNull Component sourceDisplayName, @NotNull Component message, @NotNull Audience viewer) {
+ public Component render(Player source, Component sourceDisplayName, Component message, Audience viewer) {
return sourceDisplayName
.append(Component.text(": "))
.append(message);
diff --git a/docs/paper/dev/api/event-api/custom-events.mdx b/docs/paper/dev/api/event-api/custom-events.mdx
index f27ffe73e..4908b0387 100644
--- a/docs/paper/dev/api/event-api/custom-events.mdx
+++ b/docs/paper/dev/api/event-api/custom-events.mdx
@@ -53,6 +53,14 @@ public class PaperIsCoolEvent extends Event {
this.message = message;
}
+ public Component getMessage() {
+ return this.message;
+ }
+
+ public void setMessage(Component message) {
+ this.message = message;
+ }
+
public static HandlerList getHandlerList() {
return HANDLER_LIST;
}
@@ -61,14 +69,6 @@ public class PaperIsCoolEvent extends Event {
public HandlerList getHandlers() {
return HANDLER_LIST;
}
-
- public Component getMessage() {
- return this.message;
- }
-
- public void setMessage(Component message) {
- this.message = message;
- }
}
```
diff --git a/docs/paper/dev/api/lifecycle.mdx b/docs/paper/dev/api/lifecycle.mdx
index 8350b9da7..68a138ec4 100644
--- a/docs/paper/dev/api/lifecycle.mdx
+++ b/docs/paper/dev/api/lifecycle.mdx
@@ -25,7 +25,7 @@ to either a Plugin instance
```java title="TestPlugin.java"
@Override
public void onEnable() {
- final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
+ final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
}
```
@@ -33,8 +33,8 @@ Or, with a bootstrapper:
```java title="TestPluginBootstrap.java"
@Override
-public void bootstrap(@NotNull BootstrapContext context) {
- final LifecycleEventManager lifecycleManager = context.getLifecycleManager();
+public void bootstrap(BootstrapContext context) {
+ final LifecycleEventManager lifecycleManager = context.getLifecycleManager();
}
```
@@ -45,10 +45,10 @@ event type from lifecycleManager = this.getLifecycleManager();
- PrioritizedLifecycleEventHandlerConfiguration config = LifecycleEvents.SOME_EVENT.newHandler((event) -> {
- // Handler for the event
- });
+ final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
+ PrioritizedLifecycleEventHandlerConfiguration config = LifecycleEvents.SOME_EVENT.newHandler((event) -> {
+ // Handler for the event
+ });
}
```
@@ -74,13 +74,13 @@ The priority and monitor state are exclusive options, setting one will reset the
```java title="TestPlugin.java"
@Override
public void onEnable() {
- final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
- PrioritizedLifecycleEventHandlerConfiguration config = LifecycleEvents.SOME_EVENT.newHandler((event) -> {
- // Handler for the event
- });
- config.priority(10); // sets a priority of 10
- // or
- config.monitor(); // marks the handler as a monitor
+ final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
+ PrioritizedLifecycleEventHandlerConfiguration config = LifecycleEvents.SOME_EVENT.newHandler((event) -> {
+ // Handler for the event
+ });
+ config.priority(10); // sets a priority of 10
+ // or
+ config.monitor(); // marks the handler as a monitor
}
```
@@ -91,11 +91,11 @@ Once the handler has been configured, it can be registered with the lifecycle ma
```java title="TestPlugin.java"
@Override
public void onEnable() {
- final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
- PrioritizedLifecycleEventHandlerConfiguration config = LifecycleEvents.SOME_EVENT.newHandler((event) -> {
- // Handler for the event
- }).priority(10);
- lifecycleManager.registerEventHandler(config);
+ final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
+ PrioritizedLifecycleEventHandlerConfiguration config = LifecycleEvents.SOME_EVENT.newHandler((event) -> {
+ // Handler for the event
+ }).priority(10);
+ lifecycleManager.registerEventHandler(config);
}
```
There is also a shorthand way to register just the handler without doing any configuration:
@@ -103,10 +103,10 @@ There is also a shorthand way to register just the handler without doing any con
```java title="TestPlugin.java"
@Override
public void onEnable() {
- final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
- lifecycleManager.registerEventHandler(LifecycleEvents.COMMANDS, (event) -> {
- // Handler for the event
- });
+ final LifecycleEventManager lifecycleManager = this.getLifecycleManager();
+ lifecycleManager.registerEventHandler(LifecycleEvents.COMMANDS, (event) -> {
+ // Handler for the event
+ });
}
```
diff --git a/docs/paper/dev/api/pdc.mdx b/docs/paper/dev/api/pdc.mdx
index f118174b2..2b50268f9 100644
--- a/docs/paper/dev/api/pdc.mdx
+++ b/docs/paper/dev/api/pdc.mdx
@@ -120,34 +120,34 @@ The `PersistentDataType`'s job is to "deconstruct" a complex data type into some
Here is an example of how to do that for a UUID:
-```java
+```java title="UUIDDataType.java"
public class UUIDDataType implements PersistentDataType {
- @Override
- public Class getPrimitiveType() {
- return byte[].class;
- }
-
- @Override
- public Class getComplexType() {
- return UUID.class;
- }
-
- @Override
- public byte[] toPrimitive(UUID complex, PersistentDataAdapterContext context) {
- ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
- bb.putLong(complex.getMostSignificantBits());
- bb.putLong(complex.getLeastSignificantBits());
- return bb.array();
- }
-
- @Override
- public UUID fromPrimitive(byte[] primitive, PersistentDataAdapterContext context) {
- ByteBuffer bb = ByteBuffer.wrap(primitive);
- long firstLong = bb.getLong();
- long secondLong = bb.getLong();
- return new UUID(firstLong, secondLong);
- }
- }
+ @Override
+ public Class getPrimitiveType() {
+ return byte[].class;
+ }
+
+ @Override
+ public Class getComplexType() {
+ return UUID.class;
+ }
+
+ @Override
+ public byte[] toPrimitive(UUID complex, PersistentDataAdapterContext context) {
+ ByteBuffer bb = ByteBuffer.wrap(new byte[Long.BYTES * 2]);
+ bb.putLong(complex.getMostSignificantBits());
+ bb.putLong(complex.getLeastSignificantBits());
+ return bb.array();
+ }
+
+ @Override
+ public UUID fromPrimitive(byte[] primitive, PersistentDataAdapterContext context) {
+ ByteBuffer bb = ByteBuffer.wrap(primitive);
+ long firstLong = bb.getLong();
+ long secondLong = bb.getLong();
+ return new UUID(firstLong, secondLong);
+ }
+}
```
:::note
diff --git a/docs/paper/dev/api/plugin-configs.mdx b/docs/paper/dev/api/plugin-configs.mdx
index 4fa782d71..9d6705b9a 100644
--- a/docs/paper/dev/api/plugin-configs.mdx
+++ b/docs/paper/dev/api/plugin-configs.mdx
@@ -40,7 +40,7 @@ example-plugin
When your plugin is initialized, you must save this resource into the plugin's data directory, so that a user can edit the values.
Here is an example of how you would do this in your plugin's `onEnable`:
-```java
+```java title="TestPlugin.java"
public class TestPlugin extends JavaPlugin {
@Override
@@ -53,7 +53,6 @@ public class TestPlugin extends JavaPlugin {
// getConfig()...
}
-
}
```
@@ -87,8 +86,9 @@ for the changes to be persisted to disk.
:::
-```java
+```java title="TestPlugin.java"
public class TestPlugin extends JavaPlugin {
+
public void teleportPlayer(Player player) {
Location to = getConfig().getLocation("target_location");
player.teleport(to);
@@ -99,8 +99,9 @@ public class TestPlugin extends JavaPlugin {
This is possible as they implement `ConfigurationSerializable`.
You can use this yourself, by implementing and registering a custom class.
-```java
+```java title="TeleportOptions.java"
public class TeleportOptions implements ConfigurationSerializable {
+
private int chunkX;
private int chunkZ;
private String name;
diff --git a/docs/paper/dev/api/plugin-messaging.mdx b/docs/paper/dev/api/plugin-messaging.mdx
index 8f19978f4..c0ebdc527 100644
--- a/docs/paper/dev/api/plugin-messaging.mdx
+++ b/docs/paper/dev/api/plugin-messaging.mdx
@@ -24,7 +24,7 @@ to the `bungeecord:main` channel. This means that your plugins should continue t
First, we're going to take a look at your Paper server. Your plugin will need to register that it
will be sending on any given plugin channel. You should to do this alongside your other event listener registrations.
-```java
+```java title="PluginMessagingSample.java"
public final class PluginMessagingSample extends JavaPlugin {
@Override
@@ -42,7 +42,7 @@ Plugin messages are formatted as byte arrays and can be sent using the `Player` object.
Let's take a look at an example of sending a plugin message to the `BungeeCord` channel to send our player to another server.
-```java
+```java title="PluginMessagingSample.java"
public final class PluginMessagingSample extends JavaPlugin implements Listener {
@Override
@@ -109,7 +109,7 @@ These are the following:
#### `PlayerCount`
-```java
+```java title="MyPlugin.java"
public class MyPlugin extends JavaPlugin implements PluginMessageListener {
@Override
@@ -143,7 +143,7 @@ public class MyPlugin extends JavaPlugin implements PluginMessageListener {
#### `Forward`
-```java
+```java title="MyPlugin.java"
public class MyPlugin extends JavaPlugin implements PluginMessageListener {
@Override
@@ -205,7 +205,7 @@ The `MessageRaw` message type is used to send a raw chat component to a player.
by the second parameter - Player name or "ALL" for all players. This is also useful for sending messages to
players who are on a different server within the proxied network.
-```java
+```java title="MyPlugin.java"
public class MyPlugin extends JavaPlugin {
@Override
diff --git a/docs/paper/dev/api/recipes.mdx b/docs/paper/dev/api/recipes.mdx
index dde1a6644..e669e178f 100644
--- a/docs/paper/dev/api/recipes.mdx
+++ b/docs/paper/dev/api/recipes.mdx
@@ -14,8 +14,9 @@ A shaped recipe is a recipe that requires a specific pattern of items in the cra
These are created using a pattern string and a map of characters to items. The pattern strings are 3,
3-character strings that represent the rows of the crafting grid. They can be created as follows:
-```java
+```java title="TestPlugin.java"
public class TestPlugin extends JavaPlugin {
+
@Override
public void onEnable() {
NamespacedKey key = new NamespacedKey(this, "WarriorSword");
@@ -63,8 +64,9 @@ You cannot use Air as a material in a shaped recipe, this will cause an error.
A shapeless recipe is a recipe that requires a specific number of items in the crafting grid to craft an item.
These are created using a list of items. They can be created as follows:
-```java
+```java title="TestPlugin.java"
public class TestPlugin extends JavaPlugin {
+
@Override
public void onEnable() {
NamespacedKey key = new NamespacedKey(this, "WarriorSword");
diff --git a/docs/paper/dev/api/registries.mdx b/docs/paper/dev/api/registries.mdx
index 73b47f5f0..caafaeb2c 100644
--- a/docs/paper/dev/api/registries.mdx
+++ b/docs/paper/dev/api/registries.mdx
@@ -51,7 +51,12 @@ final Enchantment enchantment = enchantmentRegistry.getOrThrow(TypedKey.create(
RegistryKey.ENCHANTMENT, Key.key("minecraft:sharpness"))
);
-// Same as above, but using generated typed keys.
+// Same as above, but using generated create method
+// available for data-driven registries or "writable" ones
+// (those bound to a lifecycle event in RegistryEvents).
+final Enchantment enchantment = enchantmentRegistry.getOrThrow(EnchantmentKeys.create(Key.key("minecraft:sharpness")));
+
+// Same as above too, but using generated typed keys.
// Only Vanilla entries have generated keys, for custom entries, the above method must be used.
final Enchantment enchantment = enchantmentRegistry.getOrThrow(EnchantmentKeys.SHARPNESS);
```
@@ -75,11 +80,11 @@ A `RegistryKeySet
created via the factory methods on `RegistrySet` like this:
```java
// Create a new registry key set that holds a collection enchantments
-final RegistryKeySet<@NotNull Enchantment> bestEnchantments = RegistrySet.keySet(
+final RegistryKeySet bestEnchantments = RegistrySet.keySet(
RegistryKey.ENCHANTMENT,
// Arbitrary keys of enchantments to store in the key set.
EnchantmentKeys.CHANNELING,
- TypedKey.create(RegistryKey.ENCHANTMENT, Key.key("papermc:softspoon"))
+ EnchantmentKeys.create(Key.key("papermc:softspoon"))
);
```
@@ -120,17 +125,17 @@ The freeze event is called right before a registry's content is frozen in-place,
Plugins can hence register their own entries at this point.
The following example shows how to create a new enchantment:
-```java
+```java title="TestPluginBootstrap.java"
public class TestPluginBootstrap implements PluginBootstrap {
@Override
- public void bootstrap(@NotNull BootstrapContext context) {
- // Register a new handled for the freeze lifecycle event on the enchantment registry
+ public void bootstrap(BootstrapContext context) {
+ // Register a new handler for the freeze lifecycle event on the enchantment registry
context.getLifecycleManager().registerEventHandler(RegistryEvents.ENCHANTMENT.freeze().newHandler(event -> {
event.registry().register(
// The key of the registry
// Plugins should use their own namespace instead of minecraft or papermc
- TypedKey.create(RegistryKey.ENCHANTMENT, Key.key("papermc:pointy")),
+ EnchantmentKeys.create(Key.key("papermc:pointy")),
b -> b.description(Component.text("Pointy"))
.supportedItems(event.getOrCreateTag(ItemTypeTagKeys.SWORDS))
.anvilCost(1)
@@ -154,7 +159,7 @@ The following example shows how to increase the maximum level of the `Sharpness`
```java
@Override
-public void bootstrap(@NotNull BootstrapContext context) {
+public void bootstrap(BootstrapContext context) {
context.getLifecycleManager().registerEventHandler(RegistryEvents.ENCHANTMENT.entryAdd()
// Increase the max level to 20
.newHandler(event -> event.builder().maxLevel(20))
diff --git a/docs/paper/dev/api/scheduler.mdx b/docs/paper/dev/api/scheduler.mdx
index f4f49be27..090d7a5d4 100644
--- a/docs/paper/dev/api/scheduler.mdx
+++ b/docs/paper/dev/api/scheduler.mdx
@@ -108,7 +108,7 @@ that don't require a `BukkitTa
You can either implement it in a separate class, e.g.:
-```java
+```java title="MyRunnableTask.java"
public class MyRunnableTask implements Runnable {
private final MyPlugin plugin;
@@ -144,7 +144,7 @@ e.g. when you want to cancel the task from inside it.
You can either implement it in a separate class similarly to the `Runnable`, e.g.:
-```java
+```java title="MyConsumerTask.java"
public class MyConsumerTask implements Consumer {
private final UUID entityId;
@@ -191,7 +191,7 @@ scheduler.runTaskTimer(plugin, /* Lambda: */ task -> {
and holds a `BukkitTask` instance. This means that you do not need to access the task from inside the `run()` method,
you can simply use the `this.cancel()` method:
-```java
+```java title="CustomRunnable.java"
public class CustomRunnable extends BukkitRunnable {
private final UUID entityId;
diff --git a/docs/paper/dev/getting-started/paper-plugins.mdx b/docs/paper/dev/getting-started/paper-plugins.mdx
index 88623672f..b24fbec07 100644
--- a/docs/paper/dev/getting-started/paper-plugins.mdx
+++ b/docs/paper/dev/getting-started/paper-plugins.mdx
@@ -112,16 +112,16 @@ has started by using [bootstrappers](#bootstrapper).
Paper plugins are able to identify their own bootstrapper by implementing
`PluginBootstrap`
and adding the class of your implementation to the bootstrapper field in the `paper-plugin.yml`.
-```java
+```java title="TestPluginBootstrap.java"
public class TestPluginBootstrap implements PluginBootstrap {
@Override
- public void bootstrap(@NotNull BootstrapContext context) {
+ public void bootstrap(BootstrapContext context) {
}
@Override
- public @NotNull JavaPlugin createPlugin(@NotNull PluginProviderContext context) {
+ public JavaPlugin createPlugin(PluginProviderContext context) {
return new TestPlugin("My custom parameter");
}
@@ -137,11 +137,11 @@ and adding the class of your implementation to the loader field in the `paper-pl
The goal of the plugin loader is the creation of an expected/dynamic environment for the plugin to load into.
This, as of right now, only applies to creating the expected classpath for the plugin, e.g. supplying external libraries to the plugin.
-```java
+```java title="TestPluginLoader.java"
public class TestPluginLoader implements PluginLoader {
@Override
- public void classloader(@NotNull PluginClasspathBuilder classpathBuilder) {
+ public void classloader(PluginClasspathBuilder classpathBuilder) {
classpathBuilder.addLibrary(new JarLibrary(Path.of("dependency.jar")));
MavenLibraryResolver resolver = new MavenLibraryResolver();
diff --git a/docs/paper/dev/getting-started/project-setup.mdx b/docs/paper/dev/getting-started/project-setup.mdx
index 033bb489d..ecdb23024 100644
--- a/docs/paper/dev/getting-started/project-setup.mdx
+++ b/docs/paper/dev/getting-started/project-setup.mdx
@@ -157,7 +157,7 @@ The main class is the entry point to your plugin and will be the only class that
`JavaPlugin` in your plugin.
This is an example of what your `ExamplePlugin` class could look like:
-```java
+```java title="ExamplePlugin.java"
package io.papermc.testplugin;
import net.kyori.adventure.text.Component;
diff --git a/docs/paper/dev/misc/databases.mdx b/docs/paper/dev/misc/databases.mdx
index 0a0b3d675..3a8e86c64 100644
--- a/docs/paper/dev/misc/databases.mdx
+++ b/docs/paper/dev/misc/databases.mdx
@@ -56,7 +56,7 @@ The JDBC Driver is bundled with Paper, so you do not need to shade/relocate it i
You must invoke a `Class#forName(String)`
on the driver to allow it to initialize and then create the connection to the database:
-```java
+```java title="DatabaseManager.java"
public class DatabaseManager {
public void connect() {
@@ -130,7 +130,7 @@ for more information on how to use this.
Once you have the dependency added, we can work with the connector in our code:
-```java
+```java title="DatabaseManager.java"
public class DatabaseManager {
public void connect() {
diff --git a/docs/paper/dev/misc/internal-code.mdx b/docs/paper/dev/misc/internal-code.mdx
index dd1fe591a..ca0d4f81d 100644
--- a/docs/paper/dev/misc/internal-code.mdx
+++ b/docs/paper/dev/misc/internal-code.mdx
@@ -56,7 +56,7 @@ CraftBukkit packages are now located in `org.bukkit.craftbukkit` and not in `org
:::
```java
-private static final String CRAFTBUKKIT_PACKAGE = Bukkit.getServer().getClass().getPackage().getName();
+private static final String CRAFTBUKKIT_PACKAGE = Bukkit.getServer().getClass().getPackageName();
public static String cbClass(String clazz) {
return CRAFTBUKKIT_PACKAGE + "." + clazz;