Merge branch 'PaperMC:master' into paper-info

This commit is contained in:
masmc05 2024-05-12 21:13:23 +03:00 committed by GitHub
commit b458e9dc51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
677 changed files with 10319 additions and 2273 deletions

View File

@ -94,7 +94,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: paper-${{ fromJSON(steps.determine.outputs.result).pr }}
path: build/libs/paper-paperclip-*-reobf.jar
path: build/libs/paper-paperclip-*-mojmap.jar
event_file:
name: "Event File"
# Only run on PRs if the source branch is on someone else's repo

View File

@ -237,10 +237,10 @@ into most IDEs and formatters by default. There are a few notes, however:
There are exceptions, especially in Spigot-related files
- When in doubt or the code around your change is in a clearly different style,
use the same style as the surrounding code.
- `var` usage is heavily discouraged, as it makes reading patch files a lot harder
and can lead to confusion during updates due to changed return types. The only
exception to this is if a line would otherwise be way too long/filled with hard
to parse generics in a case where the base type itself is already obvious
- Usage of the `var` keyword is heavily discouraged, as it makes reading patch files
a lot harder and can lead to confusion during updates due to changed return types.
The only exception to this is if a line would otherwise be way too long/filled with
hard to parse generics in a case where the base type itself is already obvious
### Imports
When adding new imports to a class in a file not created by the current patch, use the fully qualified class name

View File

@ -1,36 +0,0 @@
plugins {
`java-library`
`maven-publish`
}
java {
withSourcesJar()
withJavadocJar()
}
dependencies {
implementation(project(":paper-api"))
api("com.mojang:brigadier:1.0.18")
compileOnly("it.unimi.dsi:fastutil:8.5.6")
compileOnly("org.jetbrains:annotations:23.0.0")
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
testImplementation("org.ow2.asm:asm-tree:9.7")
}
configure<PublishingExtension> {
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}
tasks.check {
dependsOn(scanJar)
}

View File

@ -1,14 +0,0 @@
package com.destroystokyo.paper.brigadier;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import java.util.function.Predicate;
/**
* Brigadier {@link Command}, {@link SuggestionProvider}, and permission checker for Bukkit {@link Command}s.
*
* @param <S> command source type
*/
public interface BukkitBrigadierCommand <S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
}

View File

@ -1,21 +0,0 @@
package com.destroystokyo.paper.brigadier;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.Nullable;
public interface BukkitBrigadierCommandSource {
@Nullable
Entity getBukkitEntity();
@Nullable
World getBukkitWorld();
@Nullable
Location getBukkitLocation();
CommandSender getBukkitSender();
}

View File

@ -1,72 +0,0 @@
package com.destroystokyo.paper.event.brigadier;
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
import com.mojang.brigadier.tree.RootCommandNode;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Fired any time a Brigadier RootCommandNode is generated for a player to inform the client of commands.
* You may manipulate this CommandNode to change what the client sees.
*
* <p>This event may fire on login, world change, and permission rebuilds, by plugin request, and potentially future means.</p>
*
* <p>This event will fire before {@link org.bukkit.event.player.PlayerCommandSendEvent}, so no filtering has been done by
* other plugins yet.</p>
*
* <p>WARNING: This event will potentially (and most likely) fire twice! Once for Async, and once again for Sync.
* It is important that you check event.isAsynchronous() and event.hasFiredAsync() to ensure you only act once.
* If for some reason we are unable to send this asynchronously in the future, only the sync method will fire.</p>
*
* <p>Your logic should look like this:
* {@code if (event.isAsynchronous() || !event.hasFiredAsync()) { // do stuff }}</p>
*
* <p>If your logic is not safe to run asynchronously, only react to the synchronous version.</p>
*
* <p>This is a draft/experimental API and is subject to change.</p>
*/
@ApiStatus.Experimental
public class AsyncPlayerSendCommandsEvent <S extends BukkitBrigadierCommandSource> extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final RootCommandNode<S> node;
private final boolean hasFiredAsync;
public AsyncPlayerSendCommandsEvent(Player player, RootCommandNode<S> node, boolean hasFiredAsync) {
super(player, !Bukkit.isPrimaryThread());
this.node = node;
this.hasFiredAsync = hasFiredAsync;
}
/**
* Gets the full Root Command Node being sent to the client, which is mutable.
*
* @return the root command node
*/
public RootCommandNode<S> getCommandNode() {
return node;
}
/**
* Gets if this event has already fired asynchronously.
*
* @return whether this event has already fired asynchronously
*/
public boolean hasFiredAsync() {
return hasFiredAsync;
}
@NotNull
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -1,84 +0,0 @@
package com.destroystokyo.paper.event.brigadier;
import com.mojang.brigadier.suggestion.Suggestions;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
/**
* Called when sending {@link Suggestions} to the client. Will be called asynchronously if a plugin
* marks the {@link com.destroystokyo.paper.event.server.AsyncTabCompleteEvent} event handled asynchronously,
* otherwise called synchronously.
*/
public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
private Suggestions suggestions;
private final String buffer;
public AsyncPlayerSendSuggestionsEvent(Player player, Suggestions suggestions, String buffer) {
super(player, !Bukkit.isPrimaryThread());
this.suggestions = suggestions;
this.buffer = buffer;
}
/**
* Gets the input buffer sent to request these suggestions.
*
* @return the input buffer
*/
public String getBuffer() {
return buffer;
}
/**
* Gets the suggestions to be sent to client.
*
* @return the suggestions
*/
public Suggestions getSuggestions() {
return suggestions;
}
/**
* Sets the suggestions to be sent to client.
*
* @param suggestions suggestions
*/
public void setSuggestions(Suggestions suggestions) {
this.suggestions = suggestions;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isCancelled() {
return this.cancelled;
}
/**
* Cancels sending suggestions to the client.
* {@inheritDoc}
*/
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
@NotNull
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -1,168 +0,0 @@
package com.destroystokyo.paper.event.brigadier;
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommand;
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
import com.mojang.brigadier.tree.ArgumentCommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode;
import com.mojang.brigadier.tree.RootCommandNode;
import org.bukkit.command.Command;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.server.ServerEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Fired anytime the server synchronizes Bukkit commands to Brigadier.
*
* <p>Allows a plugin to control the command node structure for its commands.
* This is done at Plugin Enable time after commands have been registered, but may also
* run at a later point in the server lifetime due to plugins, a server reload, etc.</p>
*
* <p>This is a draft/experimental API and is subject to change.</p>
*/
@ApiStatus.Experimental
public class CommandRegisteredEvent<S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final String commandLabel;
private final Command command;
private final BukkitBrigadierCommand<S> brigadierCommand;
private final RootCommandNode<S> root;
private final ArgumentCommandNode<S, String> defaultArgs;
private LiteralCommandNode<S> literal;
private boolean rawCommand = false;
private boolean cancelled = false;
public CommandRegisteredEvent(String commandLabel, BukkitBrigadierCommand<S> brigadierCommand, Command command, RootCommandNode<S> root, LiteralCommandNode<S> literal, ArgumentCommandNode<S, String> defaultArgs) {
this.commandLabel = commandLabel;
this.brigadierCommand = brigadierCommand;
this.command = command;
this.root = root;
this.literal = literal;
this.defaultArgs = defaultArgs;
}
/**
* Gets the command label of the {@link Command} being registered.
*
* @return the command label
*/
public String getCommandLabel() {
return this.commandLabel;
}
/**
* Gets the {@link BukkitBrigadierCommand} for the {@link Command} being registered. This can be used
* as the {@link com.mojang.brigadier.Command command executor} or
* {@link com.mojang.brigadier.suggestion.SuggestionProvider} of a {@link com.mojang.brigadier.tree.CommandNode}
* to delegate to the {@link Command} being registered.
*
* @return the {@link BukkitBrigadierCommand}
*/
public BukkitBrigadierCommand<S> getBrigadierCommand() {
return this.brigadierCommand;
}
/**
* Gets the {@link Command} being registered.
*
* @return the {@link Command}
*/
public Command getCommand() {
return this.command;
}
/**
* Gets the {@link RootCommandNode} which is being registered to.
*
* @return the {@link RootCommandNode}
*/
public RootCommandNode<S> getRoot() {
return this.root;
}
/**
* Gets the Bukkit APIs default arguments node (greedy string), for if
* you wish to reuse it.
*
* @return default arguments node
*/
public ArgumentCommandNode<S, String> getDefaultArgs() {
return this.defaultArgs;
}
/**
* Gets the {@link LiteralCommandNode} to be registered for the {@link Command}.
*
* @return the {@link LiteralCommandNode}
*/
public LiteralCommandNode<S> getLiteral() {
return this.literal;
}
/**
* Sets the {@link LiteralCommandNode} used to register this command. The default literal is mutable, so
* this is primarily if you want to completely replace the object.
*
* @param literal new node
*/
public void setLiteral(LiteralCommandNode<S> literal) {
this.literal = literal;
}
/**
* Gets whether this command should is treated as "raw".
*
* @see #setRawCommand(boolean)
* @return whether this command is treated as "raw"
*/
public boolean isRawCommand() {
return this.rawCommand;
}
/**
* Sets whether this command should be treated as "raw".
*
* <p>A "raw" command will only use the node provided by this event for
* sending the command tree to the client. For execution purposes, the default
* greedy string execution of a standard Bukkit {@link Command} is used.</p>
*
* <p>On older versions of Paper, this was the default and only behavior of this
* event.</p>
*
* @param rawCommand whether this command should be treated as "raw"
*/
public void setRawCommand(final boolean rawCommand) {
this.rawCommand = rawCommand;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isCancelled() {
return this.cancelled;
}
/**
* Cancels registering this command to Brigadier, but will remain in Bukkit Command Map. Can be used to hide a
* command from all players.
*
* {@inheritDoc}
*/
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
@NotNull
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -1,42 +0,0 @@
package io.papermc.paper.brigadier;
import com.mojang.brigadier.Message;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.text.TextComponent;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Helper methods to bridge the gaps between Brigadier and Paper-MojangAPI.
*/
public final class PaperBrigadier {
private PaperBrigadier() {
throw new RuntimeException("PaperBrigadier is not to be instantiated!");
}
/**
* Create a new Brigadier {@link Message} from a {@link ComponentLike}.
*
* <p>Mostly useful for creating rich suggestion tooltips in combination with other Paper-MojangAPI APIs.</p>
*
* @param componentLike The {@link ComponentLike} to use for the {@link Message} contents
* @return A new Brigadier {@link Message}
*/
public static @NonNull Message message(final @NonNull ComponentLike componentLike) {
return PaperBrigadierProvider.instance().message(componentLike);
}
/**
* Create a new {@link Component} from a Brigadier {@link Message}.
*
* <p>If the {@link Message} was created from a {@link Component}, it will simply be
* converted back, otherwise a new {@link TextComponent} will be created with the
* content of {@link Message#getString()}</p>
*
* @param message The {@link Message} to create a {@link Component} from
* @return The created {@link Component}
*/
public static @NonNull Component componentFromMessage(final @NonNull Message message) {
return PaperBrigadierProvider.instance().componentFromMessage(message);
}
}

View File

@ -1,30 +0,0 @@
package io.papermc.paper.brigadier;
import com.mojang.brigadier.Message;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;
import static java.util.Objects.requireNonNull;
interface PaperBrigadierProvider {
final class Holder {
private static @MonotonicNonNull PaperBrigadierProvider INSTANCE;
}
static @NonNull PaperBrigadierProvider instance() {
return requireNonNull(Holder.INSTANCE, "PaperBrigadierProvider has not yet been initialized!");
}
static void initialize(final @NonNull PaperBrigadierProvider instance) {
if (Holder.INSTANCE != null) {
throw new IllegalStateException("PaperBrigadierProvider has already been initialized!");
}
Holder.INSTANCE = instance;
}
@NonNull Message message(@NonNull ComponentLike componentLike);
@NonNull Component componentFromMessage(@NonNull Message message);
}

View File

@ -11,7 +11,7 @@ import kotlin.io.path.*
plugins {
java
`maven-publish`
id("io.papermc.paperweight.core") version "1.6.3"
id("io.papermc.paperweight.core") version "1.7.1"
}
allprojects {
@ -49,7 +49,6 @@ subprojects {
repositories {
mavenCentral()
maven(paperMavenPublicUrl)
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") // TODO - Adventure snapshot
}
}
@ -110,7 +109,6 @@ paperweight {
tasks.generateDevelopmentBundle {
apiCoordinates = "io.papermc.paper:paper-api"
mojangApiCoordinates = "io.papermc.paper:paper-mojangapi"
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,

View File

@ -0,0 +1,367 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.damage.DamageType;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.20.6")
@ApiStatus.Experimental
public final class DamageTypeKeys {
/**
* {@code minecraft:arrow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> ARROW = create(key("arrow"));
/**
* {@code minecraft:bad_respawn_point}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> BAD_RESPAWN_POINT = create(key("bad_respawn_point"));
/**
* {@code minecraft:cactus}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> CACTUS = create(key("cactus"));
/**
* {@code minecraft:cramming}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> CRAMMING = create(key("cramming"));
/**
* {@code minecraft:dragon_breath}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> DRAGON_BREATH = create(key("dragon_breath"));
/**
* {@code minecraft:drown}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> DROWN = create(key("drown"));
/**
* {@code minecraft:dry_out}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> DRY_OUT = create(key("dry_out"));
/**
* {@code minecraft:explosion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> EXPLOSION = create(key("explosion"));
/**
* {@code minecraft:fall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FALL = create(key("fall"));
/**
* {@code minecraft:falling_anvil}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FALLING_ANVIL = create(key("falling_anvil"));
/**
* {@code minecraft:falling_block}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FALLING_BLOCK = create(key("falling_block"));
/**
* {@code minecraft:falling_stalactite}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FALLING_STALACTITE = create(key("falling_stalactite"));
/**
* {@code minecraft:fireball}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FIREBALL = create(key("fireball"));
/**
* {@code minecraft:fireworks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FIREWORKS = create(key("fireworks"));
/**
* {@code minecraft:fly_into_wall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FLY_INTO_WALL = create(key("fly_into_wall"));
/**
* {@code minecraft:freeze}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FREEZE = create(key("freeze"));
/**
* {@code minecraft:generic}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> GENERIC = create(key("generic"));
/**
* {@code minecraft:generic_kill}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> GENERIC_KILL = create(key("generic_kill"));
/**
* {@code minecraft:hot_floor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> HOT_FLOOR = create(key("hot_floor"));
/**
* {@code minecraft:in_fire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> IN_FIRE = create(key("in_fire"));
/**
* {@code minecraft:in_wall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> IN_WALL = create(key("in_wall"));
/**
* {@code minecraft:indirect_magic}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> INDIRECT_MAGIC = create(key("indirect_magic"));
/**
* {@code minecraft:lava}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> LAVA = create(key("lava"));
/**
* {@code minecraft:lightning_bolt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> LIGHTNING_BOLT = create(key("lightning_bolt"));
/**
* {@code minecraft:magic}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> MAGIC = create(key("magic"));
/**
* {@code minecraft:mob_attack}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> MOB_ATTACK = create(key("mob_attack"));
/**
* {@code minecraft:mob_attack_no_aggro}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> MOB_ATTACK_NO_AGGRO = create(key("mob_attack_no_aggro"));
/**
* {@code minecraft:mob_projectile}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> MOB_PROJECTILE = create(key("mob_projectile"));
/**
* {@code minecraft:on_fire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> ON_FIRE = create(key("on_fire"));
/**
* {@code minecraft:out_of_world}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> OUT_OF_WORLD = create(key("out_of_world"));
/**
* {@code minecraft:outside_border}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> OUTSIDE_BORDER = create(key("outside_border"));
/**
* {@code minecraft:player_attack}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> PLAYER_ATTACK = create(key("player_attack"));
/**
* {@code minecraft:player_explosion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> PLAYER_EXPLOSION = create(key("player_explosion"));
/**
* {@code minecraft:sonic_boom}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> SONIC_BOOM = create(key("sonic_boom"));
/**
* {@code minecraft:spit}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> SPIT = create(key("spit"));
/**
* {@code minecraft:stalagmite}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> STALAGMITE = create(key("stalagmite"));
/**
* {@code minecraft:starve}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> STARVE = create(key("starve"));
/**
* {@code minecraft:sting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> STING = create(key("sting"));
/**
* {@code minecraft:sweet_berry_bush}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> SWEET_BERRY_BUSH = create(key("sweet_berry_bush"));
/**
* {@code minecraft:thorns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> THORNS = create(key("thorns"));
/**
* {@code minecraft:thrown}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> THROWN = create(key("thrown"));
/**
* {@code minecraft:trident}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> TRIDENT = create(key("trident"));
/**
* {@code minecraft:unattributed_fireball}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> UNATTRIBUTED_FIREBALL = create(key("unattributed_fireball"));
/**
* {@code minecraft:wind_charge}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<DamageType> WIND_CHARGE = create(key("wind_charge"));
/**
* {@code minecraft:wither}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> WITHER = create(key("wither"));
/**
* {@code minecraft:wither_skull}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> WITHER_SKULL = create(key("wither_skull"));
private DamageTypeKeys() {
}
/**
* Creates a key for {@link DamageType} in a registry.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<DamageType> create(final @NotNull Key key) {
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
}
}

View File

@ -0,0 +1,336 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.enchantments.Enchantment;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.20.6")
@ApiStatus.Experimental
public final class EnchantmentKeys {
/**
* {@code minecraft:aqua_affinity}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> AQUA_AFFINITY = create(key("aqua_affinity"));
/**
* {@code minecraft:bane_of_arthropods}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> BANE_OF_ARTHROPODS = create(key("bane_of_arthropods"));
/**
* {@code minecraft:binding_curse}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> BINDING_CURSE = create(key("binding_curse"));
/**
* {@code minecraft:blast_protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> BLAST_PROTECTION = create(key("blast_protection"));
/**
* {@code minecraft:breach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<Enchantment> BREACH = create(key("breach"));
/**
* {@code minecraft:channeling}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> CHANNELING = create(key("channeling"));
/**
* {@code minecraft:density}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<Enchantment> DENSITY = create(key("density"));
/**
* {@code minecraft:depth_strider}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> DEPTH_STRIDER = create(key("depth_strider"));
/**
* {@code minecraft:efficiency}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> EFFICIENCY = create(key("efficiency"));
/**
* {@code minecraft:feather_falling}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FEATHER_FALLING = create(key("feather_falling"));
/**
* {@code minecraft:fire_aspect}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FIRE_ASPECT = create(key("fire_aspect"));
/**
* {@code minecraft:fire_protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FIRE_PROTECTION = create(key("fire_protection"));
/**
* {@code minecraft:flame}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FLAME = create(key("flame"));
/**
* {@code minecraft:fortune}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FORTUNE = create(key("fortune"));
/**
* {@code minecraft:frost_walker}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FROST_WALKER = create(key("frost_walker"));
/**
* {@code minecraft:impaling}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> IMPALING = create(key("impaling"));
/**
* {@code minecraft:infinity}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> INFINITY = create(key("infinity"));
/**
* {@code minecraft:knockback}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> KNOCKBACK = create(key("knockback"));
/**
* {@code minecraft:looting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> LOOTING = create(key("looting"));
/**
* {@code minecraft:loyalty}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> LOYALTY = create(key("loyalty"));
/**
* {@code minecraft:luck_of_the_sea}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> LUCK_OF_THE_SEA = create(key("luck_of_the_sea"));
/**
* {@code minecraft:lure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> LURE = create(key("lure"));
/**
* {@code minecraft:mending}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> MENDING = create(key("mending"));
/**
* {@code minecraft:multishot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> MULTISHOT = create(key("multishot"));
/**
* {@code minecraft:piercing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> PIERCING = create(key("piercing"));
/**
* {@code minecraft:power}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> POWER = create(key("power"));
/**
* {@code minecraft:projectile_protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> PROJECTILE_PROTECTION = create(key("projectile_protection"));
/**
* {@code minecraft:protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> PROTECTION = create(key("protection"));
/**
* {@code minecraft:punch}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> PUNCH = create(key("punch"));
/**
* {@code minecraft:quick_charge}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> QUICK_CHARGE = create(key("quick_charge"));
/**
* {@code minecraft:respiration}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> RESPIRATION = create(key("respiration"));
/**
* {@code minecraft:riptide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> RIPTIDE = create(key("riptide"));
/**
* {@code minecraft:sharpness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SHARPNESS = create(key("sharpness"));
/**
* {@code minecraft:silk_touch}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SILK_TOUCH = create(key("silk_touch"));
/**
* {@code minecraft:smite}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SMITE = create(key("smite"));
/**
* {@code minecraft:soul_speed}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SOUL_SPEED = create(key("soul_speed"));
/**
* {@code minecraft:sweeping_edge}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SWEEPING_EDGE = create(key("sweeping_edge"));
/**
* {@code minecraft:swift_sneak}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SWIFT_SNEAK = create(key("swift_sneak"));
/**
* {@code minecraft:thorns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> THORNS = create(key("thorns"));
/**
* {@code minecraft:unbreaking}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> UNBREAKING = create(key("unbreaking"));
/**
* {@code minecraft:vanishing_curse}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> VANISHING_CURSE = create(key("vanishing_curse"));
/**
* {@code minecraft:wind_burst}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<Enchantment> WIND_BURST = create(key("wind_burst"));
private EnchantmentKeys() {
}
private static @NotNull TypedKey<Enchantment> create(final @NotNull Key key) {
return TypedKey.create(RegistryKey.ENCHANTMENT, key);
}
}

View File

@ -449,14 +449,7 @@ public final class GameEventKeys {
private GameEventKeys() {
}
/**
* Creates a key for {@link GameEvent} in a registry.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<GameEvent> create(final @NotNull Key key) {
private static @NotNull TypedKey<GameEvent> create(final @NotNull Key key) {
return TypedKey.create(RegistryKey.GAME_EVENT, key);
}
}

View File

@ -0,0 +1,91 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MusicInstrument;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#INSTRUMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.20.6")
@ApiStatus.Experimental
public final class InstrumentKeys {
/**
* {@code minecraft:admire_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> ADMIRE_GOAT_HORN = create(key("admire_goat_horn"));
/**
* {@code minecraft:call_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> CALL_GOAT_HORN = create(key("call_goat_horn"));
/**
* {@code minecraft:dream_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> DREAM_GOAT_HORN = create(key("dream_goat_horn"));
/**
* {@code minecraft:feel_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> FEEL_GOAT_HORN = create(key("feel_goat_horn"));
/**
* {@code minecraft:ponder_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> PONDER_GOAT_HORN = create(key("ponder_goat_horn"));
/**
* {@code minecraft:seek_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> SEEK_GOAT_HORN = create(key("seek_goat_horn"));
/**
* {@code minecraft:sing_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> SING_GOAT_HORN = create(key("sing_goat_horn"));
/**
* {@code minecraft:yearn_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> YEARN_GOAT_HORN = create(key("yearn_goat_horn"));
private InstrumentKeys() {
}
private static @NotNull TypedKey<MusicInstrument> create(final @NotNull Key key) {
return TypedKey.create(RegistryKey.INSTRUMENT, key);
}
}

View File

@ -0,0 +1,321 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#MOB_EFFECT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.20.6")
@ApiStatus.Experimental
public final class MobEffectKeys {
/**
* {@code minecraft:absorption}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> ABSORPTION = create(key("absorption"));
/**
* {@code minecraft:bad_omen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> BAD_OMEN = create(key("bad_omen"));
/**
* {@code minecraft:blindness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> BLINDNESS = create(key("blindness"));
/**
* {@code minecraft:conduit_power}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> CONDUIT_POWER = create(key("conduit_power"));
/**
* {@code minecraft:darkness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> DARKNESS = create(key("darkness"));
/**
* {@code minecraft:dolphins_grace}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> DOLPHINS_GRACE = create(key("dolphins_grace"));
/**
* {@code minecraft:fire_resistance}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> FIRE_RESISTANCE = create(key("fire_resistance"));
/**
* {@code minecraft:glowing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> GLOWING = create(key("glowing"));
/**
* {@code minecraft:haste}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> HASTE = create(key("haste"));
/**
* {@code minecraft:health_boost}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> HEALTH_BOOST = create(key("health_boost"));
/**
* {@code minecraft:hero_of_the_village}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> HERO_OF_THE_VILLAGE = create(key("hero_of_the_village"));
/**
* {@code minecraft:hunger}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> HUNGER = create(key("hunger"));
/**
* {@code minecraft:infested}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<PotionEffectType> INFESTED = create(key("infested"));
/**
* {@code minecraft:instant_damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> INSTANT_DAMAGE = create(key("instant_damage"));
/**
* {@code minecraft:instant_health}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> INSTANT_HEALTH = create(key("instant_health"));
/**
* {@code minecraft:invisibility}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> INVISIBILITY = create(key("invisibility"));
/**
* {@code minecraft:jump_boost}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> JUMP_BOOST = create(key("jump_boost"));
/**
* {@code minecraft:levitation}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> LEVITATION = create(key("levitation"));
/**
* {@code minecraft:luck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> LUCK = create(key("luck"));
/**
* {@code minecraft:mining_fatigue}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> MINING_FATIGUE = create(key("mining_fatigue"));
/**
* {@code minecraft:nausea}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> NAUSEA = create(key("nausea"));
/**
* {@code minecraft:night_vision}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> NIGHT_VISION = create(key("night_vision"));
/**
* {@code minecraft:oozing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<PotionEffectType> OOZING = create(key("oozing"));
/**
* {@code minecraft:poison}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> POISON = create(key("poison"));
/**
* {@code minecraft:raid_omen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<PotionEffectType> RAID_OMEN = create(key("raid_omen"));
/**
* {@code minecraft:regeneration}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> REGENERATION = create(key("regeneration"));
/**
* {@code minecraft:resistance}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> RESISTANCE = create(key("resistance"));
/**
* {@code minecraft:saturation}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> SATURATION = create(key("saturation"));
/**
* {@code minecraft:slow_falling}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> SLOW_FALLING = create(key("slow_falling"));
/**
* {@code minecraft:slowness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> SLOWNESS = create(key("slowness"));
/**
* {@code minecraft:speed}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> SPEED = create(key("speed"));
/**
* {@code minecraft:strength}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> STRENGTH = create(key("strength"));
/**
* {@code minecraft:trial_omen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<PotionEffectType> TRIAL_OMEN = create(key("trial_omen"));
/**
* {@code minecraft:unluck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> UNLUCK = create(key("unluck"));
/**
* {@code minecraft:water_breathing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> WATER_BREATHING = create(key("water_breathing"));
/**
* {@code minecraft:weakness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> WEAKNESS = create(key("weakness"));
/**
* {@code minecraft:weaving}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<PotionEffectType> WEAVING = create(key("weaving"));
/**
* {@code minecraft:wind_charged}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21)
public static final TypedKey<PotionEffectType> WIND_CHARGED = create(key("wind_charged"));
/**
* {@code minecraft:wither}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> WITHER = create(key("wither"));
private MobEffectKeys() {
}
private static @NotNull TypedKey<PotionEffectType> create(final @NotNull Key key) {
return TypedKey.create(RegistryKey.MOB_EFFECT, key);
}
}

View File

@ -0,0 +1,105 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Wolf;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Vanilla keys for {@link RegistryKey#WOLF_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.20.6")
@ApiStatus.Experimental
public final class WolfVariantKeys {
/**
* {@code minecraft:ashen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> ASHEN = create(key("ashen"));
/**
* {@code minecraft:black}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> BLACK = create(key("black"));
/**
* {@code minecraft:chestnut}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> CHESTNUT = create(key("chestnut"));
/**
* {@code minecraft:pale}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> PALE = create(key("pale"));
/**
* {@code minecraft:rusty}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> RUSTY = create(key("rusty"));
/**
* {@code minecraft:snowy}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> SNOWY = create(key("snowy"));
/**
* {@code minecraft:spotted}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> SPOTTED = create(key("spotted"));
/**
* {@code minecraft:striped}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> STRIPED = create(key("striped"));
/**
* {@code minecraft:woods}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> WOODS = create(key("woods"));
private WolfVariantKeys() {
}
/**
* Creates a key for {@link Wolf.Variant} in a registry.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NotNull TypedKey<Wolf.Variant> create(final @NotNull Key key) {
return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
}
}

View File

@ -8,21 +8,31 @@ import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import org.bukkit.GameEvent;
import org.bukkit.MusicInstrument;
import org.bukkit.block.Biome;
import org.bukkit.damage.DamageType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Wolf;
import org.bukkit.generator.structure.Structure;
import org.bukkit.generator.structure.StructureType;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.bukkit.potion.PotionEffectType;
public interface Generators {
SourceGenerator[] API = {
simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, true),
simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, false),
simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true),
simpleKey("TrimMaterialKeys", TrimMaterial.class, Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, true),
simpleKey("TrimPatternKeys", TrimPattern.class, Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, true),
simpleKey("StructureKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE, true),
simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false),
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, false),
simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, false),
simpleKey("MobEffectKeys", PotionEffectType.class, Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, false),
simpleKey("DamageTypeKeys", DamageType.class, Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, true),
simpleKey("WolfVariantKeys", Wolf.Variant.class, Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, true),
new MobGoalGenerator("VanillaGoal", "com.destroystokyo.paper.entity.ai")
};

View File

@ -25,11 +25,14 @@ import java.util.Set;
import java.util.stream.Collectors;
import net.kyori.adventure.key.Key;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.data.registries.UpdateOneTwentyOneRegistries;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureElement;
import net.minecraft.world.flag.FeatureFlags;
import org.bukkit.MinecraftExperimental;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@ -151,8 +154,23 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
return typeBuilder.addMethod(createMethod.build()).build();
}
@SuppressWarnings("unchecked")
private Set<ResourceKey<T>> collectExperimentalKeys(final Registry<T> registry) {
if (FeatureElement.FILTERED_REGISTRIES.contains(registry.key())) {
return this.collectExperimentalKeysBuiltIn(registry);
} else {
return this.collectExperimentalKeysDataDriven(registry);
}
}
private Set<ResourceKey<T>> collectExperimentalKeysBuiltIn(final Registry<T> registry) {
final HolderLookup.RegistryLookup<T> filteredLookup = registry.asLookup().filterElements(v -> {
return ((FeatureElement) v).requiredFeatures().contains(FeatureFlags.UPDATE_1_21);
});
return filteredLookup.listElementIds().collect(Collectors.toUnmodifiableSet());
}
@SuppressWarnings("unchecked")
private Set<ResourceKey<T>> collectExperimentalKeysDataDriven(final Registry<T> registry) {
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> experimentalBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) EXPERIMENTAL_REGISTRY_ENTRIES.get(this.registryKey);
if (experimentalBootstrap == null) {
return Collections.emptySet();

View File

@ -85,19 +85,39 @@ index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..c4b30b16ce4db754b958c493ad86d0863592c263
index 0000000000000000000000000000000000000000..7b79bf33074355020e0b3b5ef40c7f2e6ba644b4
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
@@ -0,0 +1,67 @@
@@ -0,0 +1,141 @@
+package io.papermc.paper.registry;
+
+import net.kyori.adventure.key.Keyed;
+import org.bukkit.Art;
+import org.bukkit.Fluid;
+import org.bukkit.GameEvent;
+import org.bukkit.MusicInstrument;
+import org.bukkit.Particle;
+import org.bukkit.Sound;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.block.Biome;
+import org.bukkit.block.BlockType;
+import org.bukkit.block.banner.PatternType;
+import org.bukkit.damage.DamageType;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Cat;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Frog;
+import org.bukkit.entity.Villager;
+import org.bukkit.entity.Wolf;
+import org.bukkit.entity.memory.MemoryKey;
+import org.bukkit.generator.structure.Structure;
+import org.bukkit.generator.structure.StructureType;
+import org.bukkit.inventory.ItemType;
+import org.bukkit.inventory.meta.trim.TrimMaterial;
+import org.bukkit.inventory.meta.trim.TrimPattern;
+import org.bukkit.map.MapCursor;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.potion.PotionType;
+import org.jetbrains.annotations.ApiStatus;
+
+import static io.papermc.paper.registry.RegistryKeyImpl.create;
@ -115,7 +135,6 @@ index 0000000000000000000000000000000000000000..c4b30b16ce4db754b958c493ad86d086
+ * @param <T> the value type
+ */
+@SuppressWarnings("unused")
+@ApiStatus.Experimental
+public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
+
+ /* ******************* *
@ -131,6 +150,32 @@ index 0000000000000000000000000000000000000000..c4b30b16ce4db754b958c493ad86d086
+ * @see io.papermc.paper.registry.keys.StructureTypeKeys
+ */
+ RegistryKey<StructureType> STRUCTURE_TYPE = create("worldgen/structure_type");
+ /**
+ * Built-in registry for instruments.
+ * @see io.papermc.paper.registry.keys.InstrumentKeys
+ */
+ RegistryKey<MusicInstrument> INSTRUMENT = create("instrument");
+ /**
+ * Built-in registry for enchantments.
+ * @see io.papermc.paper.registry.keys.EnchantmentKeys
+ */
+ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment");
+ /**
+ * Built-in registry for potion effect types (mob effects).
+ * @see io.papermc.paper.registry.keys.MobEffectKeys
+ */
+ RegistryKey<PotionEffectType> MOB_EFFECT = create("mob_effect");
+ /**
+ * @apiNote DO NOT USE
+ */
+ @ApiStatus.Internal
+ RegistryKey<BlockType> BLOCK = create("block");
+ /**
+ * @apiNote DO NOT USE
+ */
+ @ApiStatus.Internal
+ RegistryKey<ItemType> ITEM = create("item");
+
+
+ /* ********************** *
+ * Data-driven Registries *
@ -155,13 +200,42 @@ index 0000000000000000000000000000000000000000..c4b30b16ce4db754b958c493ad86d086
+ * @see io.papermc.paper.registry.keys.TrimPatternKeys
+ */
+ RegistryKey<TrimPattern> TRIM_PATTERN = create("trim_pattern");
+ /**
+ * Data-driven registry for damage types.
+ * @see io.papermc.paper.registry.keys.DamageTypeKeys
+ */
+ RegistryKey<DamageType> DAMAGE_TYPE = create("damage_type");
+ /**
+ * Data-driven registry for wolf variants
+ * @see io.papermc.paper.registry.keys.WolfVariantKeys
+ */
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
+
+
+ /* ******************* *
+ * API-only Registries *
+ * ******************* */
+ RegistryKey<Art> PAINTING_VARIANT = create("painting_variant");
+ RegistryKey<Attribute> ATTRIBUTE = create("attribute");
+ RegistryKey<PatternType> BANNER_PATTERN = create("banner_pattern");
+ RegistryKey<Cat.Type> CAT_VARIANT = create("cat_variant");
+ RegistryKey<EntityType> ENTITY_TYPE = create("entity_type");
+ RegistryKey<Particle> PARTICLE_TYPE = create("particle_type");
+ RegistryKey<PotionType> POTION = create("potion");
+ RegistryKey<Sound> SOUND_EVENT = create("sound_event");
+ RegistryKey<Villager.Profession> VILLAGER_PROFESSION = create("villager_profession");
+ RegistryKey<Villager.Type> VILLAGER_TYPE = create("villager_type");
+ RegistryKey<MemoryKey<?>> MEMORY_MODULE_TYPE = create("memory_module_type");
+ RegistryKey<Fluid> FLUID = create("fluid");
+ RegistryKey<Frog.Variant> FROG_VARIANT = create("frog_variant");
+ RegistryKey<MapCursor.Type> MAP_DECORATION_TYPE = create("map_decoration_type");
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..9ad300fa1668cb59bbd85ff8091591db69b8c9dc
index 0000000000000000000000000000000000000000..791813220b2504214b1adecc69093cd600fb0f8c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
@@ -0,0 +1,19 @@
@@ -0,0 +1,24 @@
+package io.papermc.paper.registry;
+
+import com.google.common.collect.Sets;
@ -175,15 +249,20 @@ index 0000000000000000000000000000000000000000..9ad300fa1668cb59bbd85ff8091591db
+ static final Set<RegistryKey<?>> REGISTRY_KEYS = Sets.newIdentityHashSet();
+
+ static <T> RegistryKey<T> create(@Subst("some_key") final String key) {
+ final RegistryKey<T> registryKey = new RegistryKeyImpl<>(Key.key(Key.MINECRAFT_NAMESPACE, key));
+ final RegistryKey<T> registryKey = createInternal(key);
+ REGISTRY_KEYS.add(registryKey);
+ return registryKey;
+ }
+
+ // creates the key without adding to the internal set of keys
+ static <T> RegistryKey<T> createInternal(@Subst("some_key") final String key) {
+ return new RegistryKeyImpl<>(Key.key(Key.MINECRAFT_NAMESPACE, key));
+ }
+
+}
diff --git a/src/main/java/io/papermc/paper/registry/TypedKey.java b/src/main/java/io/papermc/paper/registry/TypedKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..271454cd1b92ada4301025b57348ea77da9116a1
index 0000000000000000000000000000000000000000..6f5a062ba7ee7173468ecea3c1855a233bf3855e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/TypedKey.java
@@ -0,0 +1,44 @@
@ -227,13 +306,13 @@ index 0000000000000000000000000000000000000000..271454cd1b92ada4301025b57348ea77
+ * @return a new key for the value key and registry key
+ */
+ @ApiStatus.Experimental
+ static <T extends Keyed> @NotNull TypedKey<T> create(final @NotNull RegistryKey<T> registryKey, final @NotNull Key key) {
+ static <T> @NotNull TypedKey<T> create(final @NotNull RegistryKey<T> registryKey, final @NotNull Key key) {
+ return new TypedKeyImpl<>(key, registryKey);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..3c3fd73f7742bb8602e2f9164dd4c1208a412255
index 0000000000000000000000000000000000000000..1a97b3359c4ece5c29131da7c3f208aaa8fab66e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
@@ -0,0 +1,8 @@
@ -243,7 +322,7 @@ index 0000000000000000000000000000000000000000..3c3fd73f7742bb8602e2f9164dd4c120
+import net.kyori.adventure.key.Keyed;
+import org.jetbrains.annotations.NotNull;
+
+record TypedKeyImpl<T extends Keyed>(@NotNull Key key, @NotNull RegistryKey<T> registryKey) implements TypedKey<T> {
+record TypedKeyImpl<T>(@NotNull Key key, @NotNull RegistryKey<T> registryKey) implements TypedKey<T> {
+}
diff --git a/src/main/java/org/bukkit/MinecraftExperimental.java b/src/main/java/org/bukkit/MinecraftExperimental.java
index b6f4810e387c22c4a70609ea1d605130245689a5..03824ae54e1bdb8b14f79b3c5e0294ae725e43f8 100644

View File

@ -8,14 +8,14 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
diff --git a/build.gradle.kts b/build.gradle.kts
index 2f266350a787a4cfdfda1b0e760bfb7604cac43c..106d4d5756dc579c446699106f52462085ea9a52 100644
index 2f266350a787a4cfdfda1b0e760bfb7604cac43c..bae542d05c059d53199b9171bee505de818df349 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,12 +11,28 @@ java {
val annotationsVersion = "24.1.0"
val bungeeCordChatVersion = "1.20-R0.2"
+val adventureVersion = "4.17.0-SNAPSHOT"
+val adventureVersion = "4.17.0"
+val apiAndDocs: Configuration by configurations.creating {
+ attributes {
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
@ -66,12 +66,12 @@ index 2f266350a787a4cfdfda1b0e760bfb7604cac43c..106d4d5756dc579c446699106f524620
"https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",
// Paper end
+ // Paper start
+ //"https://jd.advntr.dev/api/$adventureVersion/",
+ //"https://jd.advntr.dev/text-minimessage/$adventureVersion/",
+ //"https://jd.advntr.dev/text-serializer-gson/$adventureVersion/",
+ //"https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
+ //"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
+ //"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
+ "https://jd.advntr.dev/api/$adventureVersion/",
+ "https://jd.advntr.dev/text-minimessage/$adventureVersion/",
+ "https://jd.advntr.dev/text-serializer-gson/$adventureVersion/",
+ "https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
+ "https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
+ "https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
+ // Paper end
)
options.tags("apiNote:a:API Note:")
@ -1491,7 +1491,7 @@ index ac5e263d737973af077e3406a84a84baca4370db..2d91924b7f5ef16a91d40cdc1bfc3d68
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index ef3c0410ba4f88ec8b51e79abdc97777fdc00d31..913cf8308840ca1f365eb1f456f64b96046ed060 100644
index ce9bb54a6ef8a7d31804ec63aa1f6cbbd6ae2d54..baf49da3dd46039da2f24a4af8b1b8617bb25501 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -30,6 +30,15 @@ import org.jetbrains.annotations.Nullable;
@ -3170,10 +3170,10 @@ index f4ac033ff8794a61c82a49dc6c3f863f3291455d..d944d67f544494355f03c5bc9afd8ea7
/**
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..03b4e0300d228e3f3a9f4f75c96e0cf9ed1a7d2d 100644
index 133760be6c73436512ba684a3ac77a514b2d8765..9473303bd8ab1f6b63b6999a5f5ff3eca1cc23d6 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -11,26 +11,49 @@ import org.jetbrains.annotations.Nullable;
@@ -12,26 +12,49 @@ import org.jetbrains.annotations.Nullable;
*/
public class PlayerDeathEvent extends EntityDeathEvent {
private int newExp = 0;
@ -3185,18 +3185,18 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..03b4e0300d228e3f3a9f4f75c96e0cf9
private boolean keepInventory = false;
+ // Paper start - adventure
+ @org.jetbrains.annotations.ApiStatus.Internal
+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull List<ItemStack> drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
+ this(player, drops, droppedExp, 0, deathMessage);
+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
+ this(player, damageSource, drops, droppedExp, 0, deathMessage);
+ }
+
+ @org.jetbrains.annotations.ApiStatus.Internal
+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
+ this(player, drops, droppedExp, newExp, 0, 0, deathMessage);
+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
+ this(player, damageSource, drops, droppedExp, newExp, 0, 0, deathMessage);
+ }
+
+ @org.jetbrains.annotations.ApiStatus.Internal
+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage) {
+ super(player, drops, droppedExp);
+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage) {
+ super(player, damageSource, drops, droppedExp);
+ this.newExp = newExp;
+ this.newTotalExp = newTotalExp;
+ this.newLevel = newLevel;
@ -3205,18 +3205,18 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..03b4e0300d228e3f3a9f4f75c96e0cf9
+ // Paper end - adventure
+ @Deprecated // Paper
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, @Nullable final String deathMessage) {
this(player, drops, droppedExp, 0, deathMessage);
public PlayerDeathEvent(@NotNull final Player player, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, @Nullable final String deathMessage) {
this(player, damageSource, drops, droppedExp, 0, deathMessage);
}
+ @Deprecated // Paper
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, @Nullable final String deathMessage) {
this(player, drops, droppedExp, newExp, 0, 0, deathMessage);
public PlayerDeathEvent(@NotNull final Player player, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, @Nullable final String deathMessage) {
this(player, damageSource, drops, droppedExp, newExp, 0, 0, deathMessage);
}
+ @Deprecated // Paper
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) {
super(player, drops, droppedExp);
public PlayerDeathEvent(@NotNull final Player player, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) {
super(player, damageSource, drops, droppedExp);
this.newExp = newExp;
this.newTotalExp = newTotalExp;
this.newLevel = newLevel;
@ -3225,7 +3225,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..03b4e0300d228e3f3a9f4f75c96e0cf9
}
@NotNull
@@ -39,25 +62,49 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@@ -40,25 +63,49 @@ public class PlayerDeathEvent extends EntityDeathEvent {
return (Player) entity;
}
@ -4294,7 +4294,7 @@ index e12996492c1558fed9fab30de9f8018e0ed7fac3..002acfbdce1db10f7ba1b6a013e678f5
/**
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 60ebfab9596f26cfd2d75a43f3f88f2dd56575f3..dbaf54018a7dd392378869a5a302a880c7a56338 100644
index b8bb11544bdfb5b9272c2c3c33c95a4c1c7fdf12..86fbc3902989a3baca851ab8c3866af445451787 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -215,4 +215,24 @@ public interface ItemFactory {
@ -4323,10 +4323,10 @@ index 60ebfab9596f26cfd2d75a43f3f88f2dd56575f3..dbaf54018a7dd392378869a5a302a880
+ // Paper end - Adventure
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 257b5db1aa58d57cfbf5bd1f17f9df6c509bef90..53cc84d1ef6e281e8637ec7406236e1185ad7d82 100644
index 692f67c4e27cf62451130479510d06c89274ad23..22e883c8d737cf9f799c6160ff63d90f99250020 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
* use this class to encapsulate Materials for which {@link Material#isItem()}
* returns false.</b>
*/
@ -4335,7 +4335,7 @@ index 257b5db1aa58d57cfbf5bd1f17f9df6c509bef90..53cc84d1ef6e281e8637ec7406236e11
private Material type = Material.AIR;
private int amount = 0;
private MaterialData data = null;
@@ -617,4 +617,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -624,4 +624,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
@ -4596,10 +4596,10 @@ index 9bab73c3c2ca759b8e1c7d07d98cc593c961666a..f0c6943da3f783101ca647b75b3230fa
throw new UnsupportedOperationException("Not supported yet.");
}
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aeebb9a6fd6 100644
index 3a87089ba78f1e603ef582fcda3eb915d11f21a5..a23d030d2204098be17d8b18021fd0bb79b4431b 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -34,6 +34,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -35,6 +35,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
boolean hasDisplayName();
@ -4624,7 +4624,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aee
/**
* Gets the display name that is set.
* <p>
@@ -41,7 +59,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -42,7 +60,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* before calling this method.
*
* @return the display name that is set
@ -4634,7 +4634,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aee
@NotNull
String getDisplayName();
@@ -49,7 +69,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -50,7 +70,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* Sets the display name.
*
* @param name the name to set
@ -4644,7 +4644,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aee
void setDisplayName(@Nullable String name);
/**
@@ -62,6 +84,32 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -63,6 +85,32 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
boolean hasItemName();
@ -4677,7 +4677,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aee
/**
* Gets the item name that is set.
* <br>
@@ -72,7 +120,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -73,7 +121,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* calling this method.
*
* @return the item name that is set
@ -4687,7 +4687,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aee
@NotNull
String getItemName();
@@ -83,7 +133,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -84,7 +134,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* anvil, is not styled with italics, and does not show labels.
*
* @param name the name to set
@ -4697,7 +4697,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aee
void setItemName(@Nullable String name);
/**
@@ -124,6 +176,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -125,6 +177,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
boolean hasLore();
@ -4722,7 +4722,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aee
/**
* Gets the lore that is set.
* <p>
@@ -131,7 +201,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -132,7 +202,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* calling this method.
*
* @return a list of lore that is set
@ -4732,7 +4732,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aee
@Nullable
List<String> getLore();
@@ -140,7 +212,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -141,7 +213,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* Removes lore when given null.
*
* @param lore the lore that will be set

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Paper Plugins
diff --git a/build.gradle.kts b/build.gradle.kts
index d6252c1ff21c92bf0d232d5bfdf828d1d2ce38c0..5ccdd695948d1d36173b0a4516cfe8494dd01b06 100644
index a0c6f2c36fa4c16787616a79b5d996523c274fe0..effad8017bff46e2651af01f1789cb8dd08a49d5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -52,7 +52,7 @@ dependencies {
@ -18,8 +18,8 @@ index d6252c1ff21c92bf0d232d5bfdf828d1d2ce38c0..5ccdd695948d1d36173b0a4516cfe849
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
@@ -138,6 +138,7 @@ tasks.withType<Javadoc> {
//"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
//"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
// Paper end
+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", // Paper
)
@ -1347,13 +1347,14 @@ index 0000000000000000000000000000000000000000..6bf3d212a6156ad9ab0e82d1ca0a04f8
+
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 913cf8308840ca1f365eb1f456f64b96046ed060..6e46302c272b468375f2de3f7f992f55f13805b8 100644
index baf49da3dd46039da2f24a4af8b1b8617bb25501..7cf61228754527ddaa6b39b5f1426e0527cdaac9 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -129,4 +129,13 @@ public interface UnsafeValues {
@@ -137,4 +137,14 @@ public interface UnsafeValues {
@ApiStatus.Internal
@NotNull
DamageSource.Builder createDamageSourceBuilder(@NotNull DamageType damageType);
<B extends Keyed> B get(Registry<B> registry, NamespacedKey key);
+
+ // Paper start
+ @Deprecated(forRemoval = true)
+ boolean isSupportedApiVersion(String apiVersion);

View File

@ -2897,7 +2897,7 @@ index 3bf7db7eac81e3cc6f5c6700637d10d1b4b7a47b..77f8b0889cd7039bf041fc052fba33b6
* Sends the component to the player
*
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 6e46302c272b468375f2de3f7f992f55f13805b8..01e796e487cc16710f51b457466a37ba70e1e665 100644
index 7cf61228754527ddaa6b39b5f1426e0527cdaac9..9082e67324f810857db26bb89ecea7e9f866f80d 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -40,6 +40,7 @@ public interface UnsafeValues {
@ -2908,7 +2908,7 @@ index 6e46302c272b468375f2de3f7f992f55f13805b8..01e796e487cc16710f51b457466a37ba
Material toLegacy(Material material);
Material fromLegacy(Material material);
@@ -138,4 +139,12 @@ public interface UnsafeValues {
@@ -147,4 +148,12 @@ public interface UnsafeValues {
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
}
// Paper end

View File

@ -56,10 +56,10 @@ index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c7
+ }
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 01e796e487cc16710f51b457466a37ba70e1e665..d69e5fa40702c283c370a2f712b51dc2ea3a1fa0 100644
index 9082e67324f810857db26bb89ecea7e9f866f80d..da997507b96908027c49dabc6daf7c787dcad95d 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -146,5 +146,12 @@ public interface UnsafeValues {
@@ -155,5 +155,12 @@ public interface UnsafeValues {
* @return name
*/
String getTimingsServerName();

View File

@ -74,6 +74,19 @@ index 0cf808356a1a5c6fc4bcf97a694ed9beb80a776a..dc765dea47a9a1c1520fb16ddb24f814
* @param z Z-coordinate (0-15)
* @return temperature at given coordinate
*/
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
index 3d636cb7f275df053d202356c5e9fad5b1112867..4a06ed9c769acb2eb4c6f4b76c84dc2e63176010 100644
--- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java
@@ -209,7 +209,7 @@ public enum Particle implements Keyed {
}
/**
- * Options which can be applied to redstone dust particles - a particle
+ * Options which can be applied to dust particles - a particle
* color and size.
*/
public static class DustOptions {
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
index 4c9fd558fbf7f57a948fbb7f80f4651048c0fb57..458119a9ef7ce8e1f59bd47caa5b4bc698715440 100644
--- a/src/main/java/org/bukkit/RegionAccessor.java
@ -343,10 +356,10 @@ index 91fc11dda99de506be83d40df8929bf7cd8e8d85..7dc631ebd009f5f5c3ac1699c3f3515c
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Arrow.java b/src/main/java/org/bukkit/entity/Arrow.java
index bd1116adc891b2a4243da205127f5ece76089925..4d4c9efb81ac14950b24a07edcfe1c46ab3caf91 100644
index a1615334cae50c7d64ca6d86cb7070405a26b332..e396f351a46e4220fa4df11eaa93d813dced664c 100644
--- a/src/main/java/org/bukkit/entity/Arrow.java
+++ b/src/main/java/org/bukkit/entity/Arrow.java
@@ -73,7 +73,7 @@ public interface Arrow extends AbstractArrow {
@@ -93,7 +93,7 @@ public interface Arrow extends AbstractArrow {
* Removes a custom potion effect from this arrow.
*
* @param type the potion effect type to remove
@ -600,7 +613,7 @@ index a0f6f1af304190b4c5db4b284d460f625eeb7801..7e21548cac8515c281ec86853e9272ab
* The Block is already broken as this event is called, so #getBlock() will be
* AIR in most cases. Use #getBlockState() for more Information about the broken
diff --git a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
index e534954457a9961a26dbec7ac035bec07e1d6694..8309b030c2120f1496d244f3ebc1094def41c869 100644
index e534954457a9961a26dbec7ac035bec07e1d6694..a7c297364805c58ae16895055d8eae0484384b7d 100644
--- a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
@@ -13,6 +13,9 @@ import org.jetbrains.annotations.NotNull;
@ -613,6 +626,14 @@ index e534954457a9961a26dbec7ac035bec07e1d6694..8309b030c2120f1496d244f3ebc1094d
*/
public class BlockExplodeEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -29,6 +32,7 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable {
this.cancel = false;
}
+ @io.papermc.paper.annotation.DoNotUse // Paper
@Deprecated(forRemoval = true)
public BlockExplodeEvent(@NotNull final Block what, @NotNull final List<Block> blocks, final float yield) {
this(what, what.getState(), blocks, yield);
diff --git a/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java b/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java
index 340fa397e68c024df380a28db21545a0c83d9fa6..79ac8a5db689cf9f8e2ff4cb7c06df6989128d10 100644
--- a/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java
@ -684,6 +705,31 @@ index e9de00e9e434d36117a672fa9fbfc7c52f284b67..4065432c884324b107d04f4ccd486085
*/
EXPLOSION,
/**
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
index 573165ddf3368a96e1ffc6476eb27c9e29a6f86e..148c4aad384ae8e3b8b22d264a84bddfbcafdf1e 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
@@ -12,6 +12,10 @@ import org.jetbrains.annotations.Nullable;
/**
* Called when an entity is damaged by a block
+ * <p>
+ * For explosions, the Block returned by {@link #getDamager()} has
+ * already been cleared. See {@link #getDamagerBlockState()} for a snapshot
+ * of the block if it has already been changed.
*/
public class EntityDamageByBlockEvent extends EntityDamageEvent {
private final Block damager;
@@ -51,6 +55,9 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent {
/**
* Returns the captured BlockState of the block that damaged the player.
+ * <p>
+ * This block state is not placed so {@link org.bukkit.block.BlockState#isPlaced}
+ * will be false.
*
* @return the block state
*/
diff --git a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java
index 10d0e18dfd423b108fe381e8142867eb10399359..099efafa14c10910e4ed04abb1823f0c1a96b6a6 100644
--- a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java
@ -1436,11 +1482,27 @@ index 07c3dff4d6190ef388d9c1e1c36f67f00a3e8e66..597a18a767b68b47e81454b7d44613c7
*
* @param input The input choice.
* @return The changed recipe, so you can chain calls.
diff --git a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java
index e7d905b1146b2bdd2da5bdeb6bf3541fb181d59e..c7d3041221742f6655155f19ef2addcaf2401015 100644
--- a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java
@@ -32,6 +32,11 @@ public interface BlockStateMeta extends ItemMeta {
* @param blockState the block state to attach to the block.
* @throws IllegalArgumentException if the blockState is null
* or invalid for this item.
+ *
+ * @apiNote As of 1.20.5 the block state carries a copy of the item's data deviations.
+ * As such, setting the block state via this method will reset secondary deviations of the item meta.
+ * This can manifest in the addition to an existing lore failing or a change of a previously added display name.
+ * It is hence recommended to first mutate the block state, set it back, and then mutate the item meta.
*/
void setBlockState(@NotNull BlockState blockState);
}
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 18c2864c99d4dfae16cdb35143486aeebb9a6fd6..d66857825528ee772219440dffa28ad8e820493b 100644
index a23d030d2204098be17d8b18021fd0bb79b4431b..f427334c6e875a13aa53052ac1b5a746186b4ffe 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -513,7 +513,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -514,7 +514,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
/**
* Return an immutable copy of all {@link Attribute}s and their
* {@link AttributeModifier}s for a given {@link EquipmentSlot}.<br>
@ -1450,7 +1512,7 @@ index 18c2864c99d4dfae16cdb35143486aeebb9a6fd6..d66857825528ee772219440dffa28ad8
* AttributeModifiers without a slot are active in any slot.<br>
* If there are no attributes set for the given slot, an empty map
diff --git a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
index c1676991c3cc5f8d6e3f97d8cb356d6e2aa52809..4eadbcf766e69459c036a28f6e43523170558308 100644
index c1676991c3cc5f8d6e3f97d8cb356d6e2aa52809..7f9eabcaa4d803ee524a9cc8717379fe6a93a5af 100644
--- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
@@ -8,8 +8,8 @@ import org.jetbrains.annotations.Nullable;

View File

@ -7,10 +7,10 @@ Provides basic elements of a PlayerProfile to be used by future API/events
diff --git a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
new file mode 100644
index 0000000000000000000000000000000000000000..b76f13a0266806544bde13952476d4867caaf25b
index 0000000000000000000000000000000000000000..464de9dc0539d4cb0f37a2d9266638b5f5b90b73
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
@@ -0,0 +1,231 @@
@@ -0,0 +1,234 @@
+package com.destroystokyo.paper.profile;
+
+import java.util.Collection;
@ -91,13 +91,16 @@ index 0000000000000000000000000000000000000000..b76f13a0266806544bde13952476d486
+
+ /**
+ * Sets a property. If the property already exists, the previous one will be replaced
+ *
+ * @param property Property to set.
+ * @throws IllegalArgumentException if setting the property results in more than 16 properties
+ */
+ void setProperty(@NotNull ProfileProperty property);
+
+ /**
+ * Sets multiple properties. If any of the set properties already exist, it will be replaced
+ * @param properties The properties to set
+ * @throws IllegalArgumentException if the number of properties exceeds 16
+ */
+ void setProperties(@NotNull Collection<ProfileProperty> properties);
+
@ -244,10 +247,10 @@ index 0000000000000000000000000000000000000000..b76f13a0266806544bde13952476d486
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java b/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..7b3b6ef533d32169fbeca389bd61cfc6b0e0faee
index 0000000000000000000000000000000000000000..8f913a078dd692a9feafb98a6e6c9583f3253bd4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/ProfileProperty.java
@@ -0,0 +1,72 @@
@@ -0,0 +1,75 @@
+package com.destroystokyo.paper.profile;
+
+import com.google.common.base.Preconditions;
@ -272,6 +275,9 @@ index 0000000000000000000000000000000000000000..7b3b6ef533d32169fbeca389bd61cfc6
+ this.name = Preconditions.checkNotNull(name, "ProfileProperty name can not be null");
+ this.value = Preconditions.checkNotNull(value, "ProfileProperty value can not be null");
+ this.signature = signature;
+ Preconditions.checkArgument(name.length() <= 64, "ProfileProperty name can not be longer than 64 characters");
+ Preconditions.checkArgument(value.length() <= Short.MAX_VALUE, "ProfileProperty value can not be longer than 32767 characters");
+ Preconditions.checkArgument(signature == null || signature.length() <= 1024, "ProfileProperty signature can not be longer than 1024 characters");
+ }
+
+ /**
@ -409,10 +415,10 @@ index 3b7087d5c71a498f513f67514db9e118780363c7..b165a4f99802ced243f1fb56af2bcf2c
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 012b5954a2f9dc61fb8ad29c4b8bce2648ddc681..8e4bf531c0a2f7101c2a3733fe33733d31c611fd 100644
index 012b5954a2f9dc61fb8ad29c4b8bce2648ddc681..f7a9756d3e3cd337b72b406ca862b81c27d4e44e 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2067,5 +2067,74 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2067,5 +2067,76 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if player names should be suggested
*/
boolean suggestPlayerNamesWhenNullTabCompletions();
@ -464,6 +470,7 @@ index 012b5954a2f9dc61fb8ad29c4b8bce2648ddc681..8e4bf531c0a2f7101c2a3733fe33733d
+ * @param uuid UUID to create profile for
+ * @param name Name to create profile for
+ * @return A PlayerProfile object
+ * @throws IllegalArgumentException if the name is longer than 16 characters
+ */
+ @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name);
@ -482,6 +489,7 @@ index 012b5954a2f9dc61fb8ad29c4b8bce2648ddc681..8e4bf531c0a2f7101c2a3733fe33733d
+ * @param uuid UUID to create profile for
+ * @param name Name to create profile for
+ * @return A PlayerProfile object
+ * @throws IllegalArgumentException if the name is longer than 16 characters
+ */
+ @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name);

View File

@ -8,7 +8,7 @@ Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar.
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index dbaf54018a7dd392378869a5a302a880c7a56338..213e3f3de731d85f788a4bfa8d912e1b59c3c045 100644
index 86fbc3902989a3baca851ab8c3866af445451787..aea393247c60037fb70cd8d5b8814c9849c85e03 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -235,4 +235,20 @@ public interface ItemFactory {
@ -33,10 +33,10 @@ index dbaf54018a7dd392378869a5a302a880c7a56338..213e3f3de731d85f788a4bfa8d912e1b
+ // Paper end - add getI18NDisplayName
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 53cc84d1ef6e281e8637ec7406236e1185ad7d82..22bb39a8f124d55b1dce1bcb981a94d763959e59 100644
index 22e883c8d737cf9f799c6160ff63d90f99250020..551f31fc91b91702b3093bec20113bee9660a3ec 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -633,5 +633,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -640,5 +640,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public net.kyori.adventure.text.@NotNull Component displayName() {
return Bukkit.getServer().getItemFactory().displayName(this);
}

View File

@ -7,7 +7,7 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 213e3f3de731d85f788a4bfa8d912e1b59c3c045..898c256140cc7fee2c0cc65cca33a0e86275f115 100644
index aea393247c60037fb70cd8d5b8814c9849c85e03..b6b90f2ef735407ac41efa21371cfd6b07c2c66e 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -251,4 +251,18 @@ public interface ItemFactory {
@ -30,10 +30,10 @@ index 213e3f3de731d85f788a4bfa8d912e1b59c3c045..898c256140cc7fee2c0cc65cca33a0e8
+ // Paper end - ensure server conversions API
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 22bb39a8f124d55b1dce1bcb981a94d763959e59..0586a64b780f0dee9899a42ca4ee28d12efd749a 100644
index 551f31fc91b91702b3093bec20113bee9660a3ec..76b6c21c68bc55d28b77dd53c988b40c9ae41258 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -552,7 +552,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -559,7 +559,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
}
}
@ -42,7 +42,7 @@ index 22bb39a8f124d55b1dce1bcb981a94d763959e59..0586a64b780f0dee9899a42ca4ee28d1
}
/**
@@ -634,6 +634,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -641,6 +641,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return Bukkit.getServer().getItemFactory().displayName(this);
}

View File

@ -14,13 +14,13 @@ it without having to shade it in the plugin and going through
several layers of logging abstraction.
diff --git a/build.gradle.kts b/build.gradle.kts
index 5ccdd695948d1d36173b0a4516cfe8494dd01b06..65e67b8726f1e19a6bcb1fe2f448e4ab68df11d1 100644
index effad8017bff46e2651af01f1789cb8dd08a49d5..eecf458e1250ee9968630cf5c3c3287a1693e52e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,6 +12,8 @@ java {
val annotationsVersion = "24.1.0"
val bungeeCordChatVersion = "1.20-R0.2"
val adventureVersion = "4.17.0-SNAPSHOT"
val adventureVersion = "4.17.0"
+val slf4jVersion = "2.0.9"
+val log4jVersion = "2.17.1"
val apiAndDocs: Configuration by configurations.creating {
@ -36,9 +36,9 @@ index 5ccdd695948d1d36173b0a4516cfe8494dd01b06..65e67b8726f1e19a6bcb1fe2f448e4ab
implementation("org.ow2.asm:asm:9.7")
implementation("org.ow2.asm:asm-commons:9.7")
@@ -137,6 +141,8 @@ tasks.withType<Javadoc> {
//"https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
//"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
//"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
"https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
+ "https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/",
+ "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/",
// Paper end

View File

@ -94,3 +94,16 @@ index 0000000000000000000000000000000000000000..7e4acfff16db80a75e1ff2fee1972b16
+ */
+ void setMarker(boolean marker);
+}
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
index 8dc744f253be42191ca04f8e2942c4c618655fa8..aa0f66b7187c800cd22905bfa43af3ffb53edb5f 100644
--- a/src/main/java/org/bukkit/inventory/ItemType.java
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
@@ -1879,7 +1879,7 @@ public interface ItemType extends Keyed, Translatable {
ItemType.Typed<ItemMeta> RABBIT_STEW = getItemType("rabbit_stew");
ItemType.Typed<ItemMeta> RABBIT_FOOT = getItemType("rabbit_foot");
ItemType.Typed<ItemMeta> RABBIT_HIDE = getItemType("rabbit_hide");
- ItemType.Typed<ItemMeta> ARMOR_STAND = getItemType("armor_stand");
+ ItemType.Typed<com.destroystokyo.paper.inventory.meta.ArmorStandMeta> ARMOR_STAND = getItemType("armor_stand");
ItemType.Typed<ItemMeta> IRON_HORSE_ARMOR = getItemType("iron_horse_armor");
ItemType.Typed<ItemMeta> GOLDEN_HORSE_ARMOR = getItemType("golden_horse_armor");
ItemType.Typed<ItemMeta> DIAMOND_HORSE_ARMOR = getItemType("diamond_horse_armor");

View File

@ -10,10 +10,10 @@ This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
new file mode 100644
index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b529629192cea6900
index 0000000000000000000000000000000000000000..52f639b838e8b49952c560f20bacbad0337f279c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
@@ -0,0 +1,579 @@
@@ -0,0 +1,583 @@
+package com.destroystokyo.paper;
+
+import com.google.common.base.Preconditions;
@ -454,7 +454,8 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+ }
+
+ /**
+ * Sets the particle Color. Only valid for REDSTONE.
+ * Sets the particle Color.
+ * Only valid for {@link Particle#DUST}.
+ *
+ * @param color the new particle color
+ * @return a reference to this object.
@ -465,7 +466,8 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+ }
+
+ /**
+ * Sets the particle Color and size. Only valid for REDSTONE.
+ * Sets the particle Color and size.
+ * Only valid for {@link Particle#DUST}.
+ *
+ * @param color the new particle color
+ * @param size the size of the particle
@ -474,7 +476,7 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+ @NotNull
+ public ParticleBuilder color(@Nullable Color color, float size) {
+ if (particle != Particle.DUST && color != null) {
+ throw new IllegalStateException("Color may only be set on REDSTONE");
+ throw new IllegalStateException("Color may only be set on particle DUST.");
+ }
+
+ // We don't officially support reusing these objects, but here we go
@ -491,7 +493,8 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+
+ /**
+ * Sets the particle Color.
+ * Only valid for REDSTONE.
+ * Only valid for {@link Particle#DUST}.
+ *
+ * @param r red color component
+ * @param g green color component
+ * @param b blue color component
@ -504,11 +507,10 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+
+ /**
+ * Sets the particle Color.
+ * Only valid for REDSTONE.
+ * Only valid for {@link Particle#DUST}.
+ *
+ * @param rgb an integer representing the red, green, and blue color components
+ * @return a reference to this object.
+ * @throws IllegalArgumentException if called on a particle builder that does not have
+ */
+ @NotNull
+ public ParticleBuilder color(final int rgb) {
@ -516,7 +518,8 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+ }
+
+ /**
+ * Sets the particle Color Transition. Only valid for DUST_COLOR_TRANSITION.
+ * Sets the particle Color Transition.
+ * Only valid for {@link Particle#DUST_COLOR_TRANSITION}.
+ *
+ * @param fromColor the new particle from color
+ * @param toColor the new particle to color
@ -530,7 +533,7 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+
+ /**
+ * Sets the particle Color Transition.
+ * Only valid for DUST_COLOR_TRANSITION.
+ * Only valid for {@link Particle#DUST_COLOR_TRANSITION}.
+ *
+ * @param fromRed red color component for the from color
+ * @param fromGreen green color component for the from color
@ -549,7 +552,7 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+
+ /**
+ * Sets the particle Color Transition.
+ * Only valid for DUST_COLOR_TRANSITION.
+ * Only valid for {@link Particle#DUST_COLOR_TRANSITION}.
+ *
+ * @param fromRgb an integer representing the red, green, and blue color components for the from color
+ * @param toRgb an integer representing the red, green, and blue color components for the to color
@ -562,7 +565,8 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+ }
+
+ /**
+ * Sets the particle Color Transition and size. Only valid for DUST_COLOR_TRANSITION.
+ * Sets the particle Color Transition and size.
+ * Only valid for {@link Particle#DUST_COLOR_TRANSITION}.
+ *
+ * @param fromColor the new particle color for the from color.
+ * @param toColor the new particle color for the to color.
@ -594,7 +598,7 @@ index 0000000000000000000000000000000000000000..e63aabacac12a153ee8f413b52962919
+ }
+}
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
index 3d636cb7f275df053d202356c5e9fad5b1112867..b0ccd263cabe911d43cc13261011b64cacaeb7bb 100644
index 4a06ed9c769acb2eb4c6f4b76c84dc2e63176010..c5e3a8143a166d426d87fa3d0f0b3d4f3d4bff1a 100644
--- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java
@@ -208,6 +208,18 @@ public enum Particle implements Keyed {
@ -614,7 +618,7 @@ index 3d636cb7f275df053d202356c5e9fad5b1112867..b0ccd263cabe911d43cc13261011b64c
+ // Paper end
+
/**
* Options which can be applied to redstone dust particles - a particle
* Options which can be applied to dust particles - a particle
* color and size.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index c489140bffdfdfa1e34e71489d308ed10cf10b21..b6d08d50c26aa0e69d2479d188fc3c690e8ed357 100644

View File

@ -5,10 +5,10 @@ Subject: [PATCH] PotionEffect clone methods
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
index 88f720aba13961b08e54b3fd35dbaabc5dd9a4c2..037af5fd6d71a526c0e6620f2db0cd6df9625261 100644
index 89d49ce1e9475bf2d3748e483360451359e8cef8..575156c089e45a3d6a43ca6b7adfbc7b473a60ab 100644
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
@@ -107,6 +107,33 @@ public class PotionEffect implements ConfigurationSerializable {
@@ -109,6 +109,33 @@ public class PotionEffect implements ConfigurationSerializable {
this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)));
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 0586a64b780f0dee9899a42ca4ee28d12efd749a..b92a86e9d128b1ce6f02962574e30ced74e44bc8 100644
index 76b6c21c68bc55d28b77dd53c988b40c9ae41258..8cf07089bc3c60262ff1c4c6740310b48aa4169d 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -661,5 +661,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -668,5 +668,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public String getI18NDisplayName() {
return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
}

View File

@ -5,18 +5,10 @@ Subject: [PATCH] ItemStack API additions for quantity/flags/lore
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index b92a86e9d128b1ce6f02962574e30ced74e44bc8..e388239d6d960af2102111d2ae90b2a655b2a94a 100644
index 8cf07089bc3c60262ff1c4c6740310b48aa4169d..bb77d65fd42f9b53ef88537e814bea652bb230de 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -3,6 +3,7 @@ package org.bukkit.inventory;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import java.util.LinkedHashMap;
+import java.util.List; // Paper
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -669,5 +670,185 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -676,5 +676,185 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
// Requires access to NMS
return ensureServerConversions().getMaxItemUseDuration();
}
@ -90,7 +82,7 @@ index b92a86e9d128b1ce6f02962574e30ced74e44bc8..e388239d6d960af2102111d2ae90b2a6
+ * @deprecated in favor of {@link #lore()}
+ */
+ @Deprecated
+ public @Nullable List<String> getLore() {
+ public @Nullable java.util.List<String> getLore() {
+ if (!hasItemMeta()) {
+ return null;
+ }
@ -105,7 +97,7 @@ index b92a86e9d128b1ce6f02962574e30ced74e44bc8..e388239d6d960af2102111d2ae90b2a6
+ * If the item has lore, returns it, else it will return null
+ * @return The lore, or null
+ */
+ public @Nullable List<net.kyori.adventure.text.Component> lore() {
+ public @Nullable java.util.List<net.kyori.adventure.text.Component> lore() {
+ if (!this.hasItemMeta()) {
+ return null;
+ }
@ -121,10 +113,10 @@ index b92a86e9d128b1ce6f02962574e30ced74e44bc8..e388239d6d960af2102111d2ae90b2a6
+ * Removes lore when given null.
+ *
+ * @param lore the lore that will be set
+ * @deprecated in favour of {@link #lore(List)}
+ * @deprecated in favour of {@link #lore(java.util.List)}
+ */
+ @Deprecated
+ public void setLore(@Nullable List<String> lore) {
+ public void setLore(@Nullable java.util.List<String> lore) {
+ ItemMeta itemMeta = getItemMeta();
+ if (itemMeta == null) {
+ throw new IllegalStateException("Cannot set lore on " + getType());
@ -139,7 +131,7 @@ index b92a86e9d128b1ce6f02962574e30ced74e44bc8..e388239d6d960af2102111d2ae90b2a6
+ *
+ * @param lore the lore that will be set
+ */
+ public void lore(@Nullable List<? extends net.kyori.adventure.text.Component> lore) {
+ public void lore(@Nullable java.util.List<? extends net.kyori.adventure.text.Component> lore) {
+ ItemMeta itemMeta = getItemMeta();
+ if (itemMeta == null) {
+ throw new IllegalStateException("Cannot set lore on " + getType());

View File

@ -15,10 +15,10 @@ items and experience which is otherwise only properly possible by using
internal code.
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
index a5984ab06cce95d30e70511e125f69339b574c04..130cf9e5981f701dff4fa72e71e0b5dc8295bfc8 100644
index b0c069f65da29c6e9eff8e0490fda43a6bed307c..81a3067ff5ae22943b66051f4613ab9fe095720c 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
@@ -5,14 +5,24 @@ import org.bukkit.entity.LivingEntity;
@@ -6,15 +6,25 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -30,6 +30,7 @@ index a5984ab06cce95d30e70511e125f69339b574c04..130cf9e5981f701dff4fa72e71e0b5dc
-public class EntityDeathEvent extends EntityEvent {
+public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper - make cancellable
private static final HandlerList handlers = new HandlerList();
private final DamageSource damageSource;
private final List<ItemStack> drops;
private int dropExp = 0;
+ // Paper start - make cancellable
@ -42,9 +43,9 @@ index a5984ab06cce95d30e70511e125f69339b574c04..130cf9e5981f701dff4fa72e71e0b5dc
+ private float deathSoundPitch;
+ // Paper end
public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull final List<ItemStack> drops) {
this(entity, drops, 0);
@@ -74,4 +84,133 @@ public class EntityDeathEvent extends EntityEvent {
public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops) {
this(entity, damageSource, drops, 0);
@@ -87,4 +97,133 @@ public class EntityDeathEvent extends EntityEvent {
public static HandlerList getHandlerList() {
return handlers;
}
@ -179,10 +180,10 @@ index a5984ab06cce95d30e70511e125f69339b574c04..130cf9e5981f701dff4fa72e71e0b5dc
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 03b4e0300d228e3f3a9f4f75c96e0cf9ed1a7d2d..38f81772edacb178e21c3f273e8c41ed46177d6d 100644
index 9473303bd8ab1f6b63b6999a5f5ff3eca1cc23d6..76f00e386110f361549690d20dc0f73884a2fdda 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -62,6 +62,19 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@@ -63,6 +63,19 @@ public class PlayerDeathEvent extends EntityDeathEvent {
return (Player) entity;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Material API additions
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 2750e143a3ac20797e16a15b687952157197d562..c2808db693647bdf3b9617cb6c665e8499874485 100644
index 0a5dfd728a1988d8bc937ea5122dff4cbe546cfe..fb6e030af69b085946a029d89347b19b121f6a14 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -125,6 +125,7 @@ import org.jetbrains.annotations.Nullable;
@@ -128,6 +128,7 @@ import org.jetbrains.annotations.Nullable;
/**
* An enum of all material IDs accepted by the official server and client
*/
@ -16,7 +16,7 @@ index 2750e143a3ac20797e16a15b687952157197d562..c2808db693647bdf3b9617cb6c665e84
public enum Material implements Keyed, Translatable {
//<editor-fold desc="Materials" defaultstate="collapsed">
AIR(9648, 0),
@@ -4725,6 +4726,22 @@ public enum Material implements Keyed, Translatable {
@@ -4728,6 +4729,22 @@ public enum Material implements Keyed, Translatable {
}
}

View File

@ -300,10 +300,10 @@ index 02b4ffa6b918269bd64f7c518fcceef1f6990737..f0878c7539696cc0676e6010e88914d3
if (this.world == null) {
return null;
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index c2808db693647bdf3b9617cb6c665e8499874485..c605da711c032f7091390e50b4a5d332c992d3d1 100644
index fb6e030af69b085946a029d89347b19b121f6a14..feebabf946913263461e1d0f13a478cf4bfd0f68 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4746,20 +4746,20 @@ public enum Material implements Keyed, Translatable {
@@ -4749,20 +4749,20 @@ public enum Material implements Keyed, Translatable {
* Do not use for any reason.
*
* @return ID of this material
@ -328,7 +328,7 @@ index c2808db693647bdf3b9617cb6c665e8499874485..c605da711c032f7091390e50b4a5d332
public boolean isLegacy() {
return legacy;
}
@@ -4835,8 +4835,10 @@ public enum Material implements Keyed, Translatable {
@@ -4838,8 +4838,10 @@ public enum Material implements Keyed, Translatable {
* Gets the MaterialData class associated with this Material
*
* @return MaterialData associated with this Material
@ -339,7 +339,7 @@ index c2808db693647bdf3b9617cb6c665e8499874485..c605da711c032f7091390e50b4a5d332
public Class<? extends MaterialData> getData() {
Preconditions.checkArgument(legacy, "Cannot get data class of Modern Material");
return ctor.getDeclaringClass();
@@ -9103,7 +9105,11 @@ public enum Material implements Keyed, Translatable {
@@ -5295,7 +5297,11 @@ public enum Material implements Keyed, Translatable {
* material.
*
* @return true if this material can be interacted with.
@ -349,8 +349,8 @@ index c2808db693647bdf3b9617cb6c665e8499874485..c605da711c032f7091390e50b4a5d332
*/
+ @Deprecated // Paper
public boolean isInteractable() {
switch (this) {
// <editor-fold defaultstate="collapsed" desc="isInteractable">
BlockType type = asBlockType();
return type != null && type.isInteractable();
diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java
index 9b61129c3ef83d0bfceba54aba2effa12bc90678..cbdaa121dbc1876d0cd55f4b7b57f283ecaa8f1a 100644
--- a/src/main/java/org/bukkit/NamespacedKey.java
@ -453,10 +453,10 @@ index 48aecc9421c500137bbef1dfe3bec8de277c3ff9..aff858346776386f1288b648b221404f
return note;
}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 4f8c54a84c9f737dad3feff9ffd7daf22854e97f..a04d279561676e825905f5512c399d14a3d8f828 100644
index 57dfc408fcf9036808af26bd1255afe104d40286..62a7748b7509907ac8c8c0026f0cc5911f530eb7 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -201,14 +201,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -219,14 +219,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see TrimMaterial
*/
@ -471,7 +471,7 @@ index 4f8c54a84c9f737dad3feff9ffd7daf22854e97f..a04d279561676e825905f5512c399d14
Registry<TrimPattern> TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class);
/**
* Damage types.
@@ -310,8 +308,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -328,8 +326,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @param input non-null input
* @return registered object or null if does not exist
@ -498,7 +498,7 @@ index 6277451c3c6c551078c237cd767b6d70c4f585ea..10f5cfb1885833a1d2c1027c03974da4
CRACKED(0x0),
GLYPHED(0x1),
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 69f236d965c631510b008a7eb38aa1b62a4e196a..2382322bc4f30ff3163b2941650692d9a13328ac 100644
index 3d5ef29bcfed92dc7fb3bb6d59538ba4a4e3de5f..43f8cdd600aa2c2e33136068b3c4b4b81a6544d4 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -730,9 +730,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -1399,7 +1399,7 @@ index 002acfbdce1db10f7ba1b6a013e678f504ac6e69..8d14426eb1ebea27058d5f22ea652f22
return getPlayer().getItemOnCursor();
}
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 898c256140cc7fee2c0cc65cca33a0e86275f115..e34c89a945a0f12cdc4be8cc232c8de986474372 100644
index b6b90f2ef735407ac41efa21371cfd6b07c2c66e..4c4e52b2c200408c4e33a141e1eed78126ceaaee 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -30,7 +30,7 @@ public interface ItemFactory {
@ -1412,18 +1412,18 @@ index 898c256140cc7fee2c0cc65cca33a0e86275f115..e34c89a945a0f12cdc4be8cc232c8de9
/**
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index e388239d6d960af2102111d2ae90b2a655b2a94a..276cfd52817115981fe7dc46363278f8b8c5aee3 100644
index bb77d65fd42f9b53ef88537e814bea652bb230de..d758cea1d8e88937678dbfd0ac72d49b6c160fe0 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -8,6 +8,7 @@ import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -10,6 +10,7 @@ import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.Translatable;
+import org.bukkit.UndefinedNullability;
import org.bukkit.Utility;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.enchantments.Enchantment;
@@ -170,8 +171,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -172,8 +173,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
* Gets the MaterialData for this stack of items
*
* @return MaterialData for this item
@ -1434,7 +1434,7 @@ index e388239d6d960af2102111d2ae90b2a655b2a94a..276cfd52817115981fe7dc46363278f8
public MaterialData getData() {
Material mat = Bukkit.getUnsafe().toLegacy(getType());
if (data == null && mat != null && mat.getData() != null) {
@@ -185,7 +188,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -187,7 +190,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
* Sets the MaterialData for this stack of items
*
* @param data New MaterialData for this item
@ -1444,7 +1444,7 @@ index e388239d6d960af2102111d2ae90b2a655b2a94a..276cfd52817115981fe7dc46363278f8
public void setData(@Nullable MaterialData data) {
if (data == null) {
this.data = data;
@@ -561,7 +566,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -567,7 +572,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
*
* @return a copy of the current ItemStack's ItemData
*/
@ -1587,10 +1587,10 @@ index 597a18a767b68b47e81454b7d44613c7178c1366..bc3440eb72127824b3961fbdae583bb6
public ItemStack getInput() {
return this.ingredient.getItemStack();
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index d66857825528ee772219440dffa28ad8e820493b..3ddd52b135f339ff006b5d53f46487bfbe1ff7fd 100644
index f427334c6e875a13aa53052ac1b5a746186b4ffe..abe5c56c09a29cb3dcd35936045938c1b88c8500 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -141,6 +141,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -142,6 +142,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
/**
* Checks for existence of a localized name.
*
@ -1598,7 +1598,7 @@ index d66857825528ee772219440dffa28ad8e820493b..3ddd52b135f339ff006b5d53f46487bf
* @return true if this has a localized name
* @deprecated meta no longer exists
*/
@@ -153,6 +154,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -154,6 +155,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* Plugins should check that hasLocalizedName() returns <code>true</code>
* before calling this method.
*
@ -1606,7 +1606,7 @@ index d66857825528ee772219440dffa28ad8e820493b..3ddd52b135f339ff006b5d53f46487bf
* @return the localized name that is set
* @deprecated meta no longer exists
*/
@@ -163,6 +165,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -164,6 +166,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
/**
* Sets the localized name.
*

View File

@ -8,18 +8,10 @@ Exposes a mutable array on items a player should keep on death
Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 38f81772edacb178e21c3f273e8c41ed46177d6d..9719e183036c361b909b203593c067a551b82264 100644
index 76f00e386110f361549690d20dc0f73884a2fdda..edf14dac359e996f76e0af551a81a4dd8e48bd6c 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -37,7 +37,6 @@ public class PlayerDeathEvent extends EntityDeathEvent {
}
// Paper end - adventure
- @Deprecated // Paper
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, @Nullable final String deathMessage) {
this(player, drops, droppedExp, 0, deathMessage);
}
@@ -56,6 +55,41 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@@ -57,6 +57,41 @@ public class PlayerDeathEvent extends EntityDeathEvent {
this.deathMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(deathMessage); // Paper
}

View File

@ -20,10 +20,10 @@ index 395d7245aac45a1b805e15ee1fdb9949574f3f59..d1e1c49ecf6a1ede71548fbac6143e38
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2382322bc4f30ff3163b2941650692d9a13328ac..cf242e2e6d538d3d38b7b10321ab375e018b24b1 100644
index 43f8cdd600aa2c2e33136068b3c4b4b81a6544d4..f11c1caa81c97d1a31d8cc980ad4dab2e2573ec4 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2174,5 +2174,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2176,5 +2176,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name);

View File

@ -5,28 +5,28 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 9719e183036c361b909b203593c067a551b82264..66e9d65a8dd05bed05d0ab46ec64206a6dae0507 100644
index edf14dac359e996f76e0af551a81a4dd8e48bd6c..bba3821d1215eb00489f841195c890a3f3353912 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -16,6 +16,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@@ -17,6 +17,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
private int newTotalExp = 0;
private boolean keepLevel = false;
private boolean keepInventory = false;
+ private boolean doExpDrop; // Paper - shouldDropExperience API
// Paper start - adventure
@org.jetbrains.annotations.ApiStatus.Internal
public PlayerDeathEvent(final @NotNull Player player, final @NotNull List<ItemStack> drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
@@ -29,11 +30,18 @@ public class PlayerDeathEvent extends EntityDeathEvent {
public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
@@ -30,11 +31,18 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@org.jetbrains.annotations.ApiStatus.Internal
public PlayerDeathEvent(final @NotNull Player player, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage) {
public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage) {
+ // Paper start - shouldDropExperience API
+ this(player, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true);
+ this(player, damageSource, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true);
+ }
+ @org.jetbrains.annotations.ApiStatus.Internal
+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage, final boolean doExpDrop) {
+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage, final boolean doExpDrop) {
+ // Paper end - shouldDropExperience API
super(player, drops, droppedExp);
super(player, damageSource, drops, droppedExp);
this.newExp = newExp;
this.newTotalExp = newTotalExp;
this.newLevel = newLevel;
@ -35,18 +35,18 @@ index 9719e183036c361b909b203593c067a551b82264..66e9d65a8dd05bed05d0ab46ec64206a
}
// Paper end - adventure
@@ -48,11 +56,19 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@@ -50,11 +58,19 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@Deprecated // Paper
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) {
public PlayerDeathEvent(@NotNull final Player player, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) {
+ // Paper start - shouldDropExperience API
+ this(player, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true);
+ this(player, damageSource, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true);
+ }
+
+ @Deprecated // Paper
+ public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage, boolean doExpDrop) {
+ public PlayerDeathEvent(@NotNull final Player player, final @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage, boolean doExpDrop) {
+ // Paper end - shouldDropExperience API
super(player, drops, droppedExp);
super(player, damageSource, drops, droppedExp);
this.newExp = newExp;
this.newTotalExp = newTotalExp;
this.newLevel = newLevel;
@ -55,7 +55,7 @@ index 9719e183036c361b909b203593c067a551b82264..66e9d65a8dd05bed05d0ab46ec64206a
}
@Deprecated // Paper
@@ -90,6 +106,22 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@@ -92,6 +108,22 @@ public class PlayerDeathEvent extends EntityDeathEvent {
}
// Paper end

View File

@ -26,10 +26,10 @@ index 385be33869f3850f8b1d3e690c8e0fc43adcbdce..f24d57a89dc4fdf73298bbb4cc187794
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index d6d83b22389aee98967adda2631fa65ecbf00781..015f1167bdc752fe6665807866caa0cda5ba0571 100644
index 965032124406a63c70dc9007245f74fb2e503c52..17f6b930c7d462cd8112bb5a845c25202e6c78b5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2196,5 +2196,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2198,5 +2198,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return Current tick
*/
int getCurrentTick();

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index d69e5fa40702c283c370a2f712b51dc2ea3a1fa0..30d869a7c4bba79b4c05de7860b31c14f47b341a 100644
index da997507b96908027c49dabc6daf7c787dcad95d..cb7aef53cbffc76dea9fec28445ea8aefcb29d62 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -153,5 +153,9 @@ public interface UnsafeValues {
@@ -162,5 +162,9 @@ public interface UnsafeValues {
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
}
@ -20,10 +20,10 @@ index d69e5fa40702c283c370a2f712b51dc2ea3a1fa0..30d869a7c4bba79b4c05de7860b31c14
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 276cfd52817115981fe7dc46363278f8b8c5aee3..e82eeadc7cb53572351670761c4e592a33345c6b 100644
index d758cea1d8e88937678dbfd0ac72d49b6c160fe0..066f99a1f4cc42cf0e87d495f97a0685817dfa18 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -653,6 +653,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -659,6 +659,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
}

View File

@ -247,10 +247,10 @@ index b608a6dc26bfc6d08f1e31107fed8ef1aaf90e1d..79db7b5c25a7c824b107a5c79f40c619
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 987e01f48f7f8b19fd6292a11988b1aeb90a09f6..8aba385b9d1a9b71c3304f1d802f18d4434f34d5 100644
index 1f4ebdaf9cfd14de9ff2d0cea7d110fe7630dc9a..711de014b7cf69459526e6c20c94f29ee4db11c4 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2213,5 +2213,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2215,5 +2215,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if server is in the process of being shutdown
*/
boolean isStopping();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Support components in ItemMeta
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566a97865cf 100644
index abe5c56c09a29cb3dcd35936045938c1b88c8500..a317111df3b6cda00dc700c68f4c2b789c51885d 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -5,6 +5,7 @@ import java.util.Collection;
@ -16,7 +16,7 @@ index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
@@ -65,6 +66,20 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -66,6 +67,20 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@NotNull
String getDisplayName();
@ -37,7 +37,7 @@ index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566
/**
* Sets the display name.
*
@@ -74,6 +89,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -75,6 +90,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@Deprecated // Paper
void setDisplayName(@Nullable String name);
@ -54,7 +54,7 @@ index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566
/**
* Checks for existence of an item name.
* <br>
@@ -210,6 +235,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -211,6 +236,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@Nullable
List<String> getLore();
@ -74,7 +74,7 @@ index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566
/**
* Sets the lore for this item.
* Removes lore when given null.
@@ -220,6 +258,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@@ -221,6 +259,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@Deprecated // Paper
void setLore(@Nullable List<String> lore);

View File

@ -144,10 +144,10 @@ index dc66bd69646ac949d1386ce8f6ff913e9475439d..4482e8f2c617c2f51b2b53762e775d11
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index c605da711c032f7091390e50b4a5d332c992d3d1..61e0739f002a949a204c7591dfa3074560d1459e 100644
index feebabf946913263461e1d0f13a478cf4bfd0f68..d6e2ec415eab4f55fd925a3b0982e869befbd088 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -126,7 +126,7 @@ import org.jetbrains.annotations.Nullable;
@@ -129,7 +129,7 @@ import org.jetbrains.annotations.Nullable;
* An enum of all material IDs accepted by the official server and client
*/
@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper
@ -156,7 +156,7 @@ index c605da711c032f7091390e50b4a5d332c992d3d1..61e0739f002a949a204c7591dfa30745
//<editor-fold desc="Materials" defaultstate="collapsed">
AIR(9648, 0),
STONE(22948),
@@ -4740,6 +4740,15 @@ public enum Material implements Keyed, Translatable {
@@ -4743,6 +4743,15 @@ public enum Material implements Keyed, Translatable {
}
return false;
}
@ -172,7 +172,7 @@ index c605da711c032f7091390e50b4a5d332c992d3d1..61e0739f002a949a204c7591dfa30745
// Paper end
/**
@@ -11481,9 +11490,11 @@ public enum Material implements Keyed, Translatable {
@@ -5494,9 +5503,11 @@ public enum Material implements Keyed, Translatable {
* material
* @see #getBlockTranslationKey()
* @see #getItemTranslationKey()
@ -183,7 +183,7 @@ index c605da711c032f7091390e50b4a5d332c992d3d1..61e0739f002a949a204c7591dfa30745
+ @Deprecated(forRemoval = true) // Paper
public String getTranslationKey() {
if (this.isItem()) {
return Bukkit.getUnsafe().getItemTranslationKey(this);
return asItemType().getTranslationKey();
diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java
index eae90e72b1dff5ab3b1a4fdcfe57187e85fe4d49..62d2b3f950860dee0898d77b0a29635c3f9a7e23 100644
--- a/src/main/java/org/bukkit/MusicInstrument.java
@ -480,10 +480,10 @@ index 5bd252c0ae3b09fe141d131360c67bb9bfbf5422..78587d9fabe6371a23a7963917b054db
+
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index e82eeadc7cb53572351670761c4e592a33345c6b..645cff10eef90826bb44bbe937b141289f182cde 100644
index 066f99a1f4cc42cf0e87d495f97a0685817dfa18..23686519b8c1338dd6e9f1c5a0e73467c0b59a4f 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
* use this class to encapsulate Materials for which {@link Material#isItem()}
* returns false.</b>
*/
@ -492,7 +492,7 @@ index e82eeadc7cb53572351670761c4e592a33345c6b..645cff10eef90826bb44bbe937b14128
private Material type = Material.AIR;
private int amount = 0;
private MaterialData data = null;
@@ -620,6 +620,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -626,6 +626,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@Override
@NotNull
@ -500,7 +500,7 @@ index e82eeadc7cb53572351670761c4e592a33345c6b..645cff10eef90826bb44bbe937b14128
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
@@ -879,5 +880,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -885,5 +886,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
ItemMeta itemMeta = getItemMeta();
return itemMeta != null && itemMeta.hasItemFlag(flag);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 30d869a7c4bba79b4c05de7860b31c14f47b341a..241cb853476ea35dad73d0234b2d030e9af23476 100644
index cb7aef53cbffc76dea9fec28445ea8aefcb29d62..fb1efc7dfcfbfb823c8ad8fe2943adb99104aefe 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -157,5 +157,12 @@ public interface UnsafeValues {
@@ -166,5 +166,12 @@ public interface UnsafeValues {
byte[] serializeItem(ItemStack item);
ItemStack deserializeItem(byte[] data);

View File

@ -1,92 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 2 Mar 2022 13:36:21 -0800
Subject: [PATCH] Add PaperRegistry
diff --git a/src/main/java/io/papermc/paper/registry/Reference.java b/src/main/java/io/papermc/paper/registry/Reference.java
new file mode 100644
index 0000000000000000000000000000000000000000..d880810cbf05bc45051fe29515054211572e33b4
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/Reference.java
@@ -0,0 +1,43 @@
+package io.papermc.paper.registry;
+
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a reference to a server-backed registry value that may
+ * change.
+ *
+ * @param <T> type of the value
+ */
+public interface Reference<T extends Keyed> extends Keyed {
+
+ /**
+ * Gets the value from the registry with the key.
+ *
+ * @return the value
+ * @throws java.util.NoSuchElementException if there is no value with this key
+ */
+ @NotNull T value();
+
+ /**
+ * Gets the value from the registry with the key.
+ *
+ * @return the value or null if it doesn't exist
+ */
+ @Nullable T valueOrNull();
+
+ /**
+ * Creates a reference to a registered value.
+ *
+ * @param registry the registry the value is located in
+ * @param key the key to the value
+ * @param <T> the type of the value
+ * @return a reference
+ */
+ static <T extends Keyed> @NotNull Reference<T> create(@NotNull Registry<T> registry, @NotNull NamespacedKey key) {
+ return new ReferenceImpl<>(registry, key);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/ReferenceImpl.java b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..f29e76a6b66ddfec12ddf8db6dcb2df6083b5982
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java
@@ -0,0 +1,31 @@
+package io.papermc.paper.registry;
+
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.NoSuchElementException;
+
+record ReferenceImpl<T extends Keyed>(@NotNull Registry<T> registry, @NotNull NamespacedKey key) implements Reference<T> {
+
+ @Override
+ public @NotNull T value() {
+ final T value = this.registry.get(this.key);
+ if (value == null) {
+ throw new NoSuchElementException("No such value with key " + this.key);
+ }
+ return value;
+ }
+
+ @Override
+ public @Nullable T valueOrNull() {
+ return this.registry.get(this.key);
+ }
+
+ @Override
+ public @NotNull NamespacedKey getKey() {
+ return this.key;
+ }
+}

View File

@ -0,0 +1,412 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 2 Mar 2022 13:36:21 -0800
Subject: [PATCH] Add RegistryAccess for managing registries
diff --git a/src/main/java/io/papermc/paper/registry/Reference.java b/src/main/java/io/papermc/paper/registry/Reference.java
new file mode 100644
index 0000000000000000000000000000000000000000..d8656772e0c983df7c40ddc367a73ce473348339
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/Reference.java
@@ -0,0 +1,47 @@
+package io.papermc.paper.registry;
+
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a reference to a server-backed registry value that may
+ * change.
+ *
+ * @param <T> type of the value
+ */
+@Deprecated(forRemoval = true, since = "1.20.6")
+public interface Reference<T extends Keyed> extends Keyed {
+
+ /**
+ * Gets the value from the registry with the key.
+ *
+ * @return the value
+ * @throws java.util.NoSuchElementException if there is no value with this key
+ */
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ @NotNull T value();
+
+ /**
+ * Gets the value from the registry with the key.
+ *
+ * @return the value or null if it doesn't exist
+ */
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ @Nullable T valueOrNull();
+
+ /**
+ * Creates a reference to a registered value.
+ *
+ * @param registry the registry the value is located in
+ * @param key the key to the value
+ * @param <T> the type of the value
+ * @return a reference
+ */
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ static <T extends Keyed> @NotNull Reference<T> create(@NotNull Registry<T> registry, @NotNull NamespacedKey key) {
+ return new ReferenceImpl<>(registry, key);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/ReferenceImpl.java b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..f29e76a6b66ddfec12ddf8db6dcb2df6083b5982
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java
@@ -0,0 +1,31 @@
+package io.papermc.paper.registry;
+
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.NoSuchElementException;
+
+record ReferenceImpl<T extends Keyed>(@NotNull Registry<T> registry, @NotNull NamespacedKey key) implements Reference<T> {
+
+ @Override
+ public @NotNull T value() {
+ final T value = this.registry.get(this.key);
+ if (value == null) {
+ throw new NoSuchElementException("No such value with key " + this.key);
+ }
+ return value;
+ }
+
+ @Override
+ public @Nullable T valueOrNull() {
+ return this.registry.get(this.key);
+ }
+
+ @Override
+ public @NotNull NamespacedKey getKey() {
+ return this.key;
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryAccess.java b/src/main/java/io/papermc/paper/registry/RegistryAccess.java
new file mode 100644
index 0000000000000000000000000000000000000000..86ab67ff5023bf6adea80b02648b6f67476e30e5
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryAccess.java
@@ -0,0 +1,49 @@
+package io.papermc.paper.registry;
+
+import org.bukkit.Keyed;
+import org.bukkit.Registry;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Used for accessing different {@link Registry} instances
+ * by a {@link RegistryKey}. Get the main instance of {@link RegistryAccess}
+ * with {@link RegistryAccess#registryAccess()}.
+ */
+@ApiStatus.NonExtendable
+public interface RegistryAccess {
+
+ /**
+ * Get the {@link RegistryAccess} instance for the server.
+ *
+ * @return the RegistryAccess instance
+ */
+ static @NotNull RegistryAccess registryAccess() {
+ return RegistryAccessHolder.INSTANCE.orElseThrow(() -> new IllegalStateException("No RegistryAccess implementation found"));
+ }
+
+ /**
+ * Gets the registry based on the type.
+ *
+ * @param type the type
+ * @return the registry or null if none found
+ * @param <T> the type
+ * @deprecated use {@link #getRegistry(RegistryKey)} with keys from {@link RegistryKey}
+ */
+ @Deprecated(since = "1.20.6", forRemoval = true)
+ <T extends Keyed> @Nullable Registry<T> getRegistry(@NotNull Class<T> type);
+
+ /**
+ * Gets the registry with the specified key.
+ *
+ * @param registryKey the key
+ * @return the registry
+ * @param <T> the type
+ * @throws java.util.NoSuchElementException if no registry with the key is found
+ * @throws IllegalArgumentException if the registry is not available yet
+ */
+ // Future note: We should have no trouble removing this generic qualifier when
+ // registry types no longer have to be "keyed" as it shouldn't break ABI or API.
+ <T extends Keyed> @NotNull Registry<T> getRegistry(@NotNull RegistryKey<T> registryKey);
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java b/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java
new file mode 100644
index 0000000000000000000000000000000000000000..b89e19c070f97c9662f1e16309446494b30aa7c9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java
@@ -0,0 +1,12 @@
+package io.papermc.paper.registry;
+
+import java.util.Optional;
+import java.util.ServiceLoader;
+
+final class RegistryAccessHolder {
+
+ static final Optional<RegistryAccess> INSTANCE = ServiceLoader.load(RegistryAccess.class).findFirst();
+
+ private RegistryAccessHolder() {
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
index 791813220b2504214b1adecc69093cd600fb0f8c..47fe5b0d5d031110c27210a0a256c260b35d9ba1 100644
--- a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
+++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
@@ -10,6 +10,17 @@ record RegistryKeyImpl<T>(@NotNull Key key) implements RegistryKey<T> {
static final Set<RegistryKey<?>> REGISTRY_KEYS = Sets.newIdentityHashSet();
+ // override equals and hashCode to this can be used to simulate an "identity" hashmap
+ @Override
+ public boolean equals(final Object obj) {
+ return obj == this;
+ }
+
+ @Override
+ public int hashCode() {
+ return System.identityHashCode(this);
+ }
+
static <T> RegistryKey<T> create(@Subst("some_key") final String key) {
final RegistryKey<T> registryKey = createInternal(key);
REGISTRY_KEYS.add(registryKey);
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 732ed3724e784ad659cb4411dbd73b42a8330a2c..7be6710d28dea19bd0f9054c1c2e32dacd355c45 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2398,8 +2398,11 @@ public final class Bukkit {
* @param tClass of the registry to get
* @param <T> type of the registry
* @return the corresponding registry or null if not present
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}
+ * with keys from {@link io.papermc.paper.registry.RegistryKey}
*/
@Nullable
+ @Deprecated(since = "1.20.6")
public static <T extends Keyed> Registry<T> getRegistry(@NotNull Class<T> tClass) {
return server.getRegistry(tClass);
}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 62a7748b7509907ac8c8c0026f0cc5911f530eb7..e5393d3204f4d04d8e9640a45c6b4ba6a912079b 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -101,7 +101,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @apiNote BlockType is not ready for public usage yet
*/
@ApiStatus.Internal
- Registry<BlockType> BLOCK = Objects.requireNonNull(Bukkit.getRegistry(BlockType.class), "No registry present for BlockType. This is a bug.");
+ Registry<BlockType> BLOCK = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.BLOCK); // Paper
/**
* Custom boss bars.
*
@@ -139,7 +139,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see Enchantment
*/
- Registry<Enchantment> ENCHANTMENT = Objects.requireNonNull(Bukkit.getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug.");
+ Registry<Enchantment> ENCHANTMENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ENCHANTMENT); // Paper
/**
* Server entity types.
*
@@ -151,7 +151,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see MusicInstrument
*/
- Registry<MusicInstrument> INSTRUMENT = Objects.requireNonNull(Bukkit.getRegistry(MusicInstrument.class), "No registry present for MusicInstrument. This is a bug.");
+ Registry<MusicInstrument> INSTRUMENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.INSTRUMENT); // Paper
/**
* Server item types.
*
@@ -159,7 +159,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @apiNote ItemType is not ready for public usage yet
*/
@ApiStatus.Internal
- Registry<ItemType> ITEM = Objects.requireNonNull(Bukkit.getRegistry(ItemType.class), "No registry present for ItemType. This is a bug.");
+ Registry<ItemType> ITEM = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ITEM); // Paper
/**
* Default server loot tables.
*
@@ -177,7 +177,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see PotionEffectType
*/
- Registry<PotionEffectType> EFFECT = Objects.requireNonNull(Bukkit.getRegistry(PotionEffectType.class), "No registry present for PotionEffectType. This is a bug.");
+ Registry<PotionEffectType> EFFECT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.MOB_EFFECT); // Paper
/**
* Server particles.
*
@@ -200,14 +200,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Server structures.
*
* @see Structure
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}
*/
- Registry<Structure> STRUCTURE = Bukkit.getRegistry(Structure.class);
+ @Deprecated(since = "1.20.6") // Paper
+ Registry<Structure> STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Structure.class), "No registry present for Structure. This is a bug."); // Paper
/**
* Server structure types.
*
* @see StructureType
*/
- Registry<StructureType> STRUCTURE_TYPE = Bukkit.getRegistry(StructureType.class);
+ Registry<StructureType> STRUCTURE_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.STRUCTURE_TYPE); // Paper
/**
* Sound keys.
*
@@ -218,21 +220,26 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Trim materials.
*
* @see TrimMaterial
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL}
*/
- Registry<TrimMaterial> TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class);
+ @Deprecated(since = "1.20.6") // Paper
+ Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug."); // Paper
/**
* Trim patterns.
*
* @see TrimPattern
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN}
*/
- Registry<TrimPattern> TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class);
+ @Deprecated(since = "1.20.6")
+ Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug."); // Paper
/**
* Damage types.
*
* @see DamageType
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#DAMAGE_TYPE}
*/
- @ApiStatus.Experimental
- Registry<DamageType> DAMAGE_TYPE = Objects.requireNonNull(Bukkit.getRegistry(DamageType.class), "No registry present for DamageType. This is a bug.");
+ @Deprecated(since = "1.20.6")
+ Registry<DamageType> DAMAGE_TYPE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(DamageType.class), "No registry present for DamageType. This is a bug."); // Paper
/**
* Villager profession.
*
@@ -286,8 +293,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Wolf variants.
*
* @see Wolf.Variant
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#WOLF_VARIANT}
*/
- Registry<Wolf.Variant> WOLF_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Wolf.Variant.class), "No registry present for Wolf Variant. This is a bug.");
+ @Deprecated(since = "1.20.6")
+ Registry<Wolf.Variant> WOLF_VARIANT = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Wolf.Variant.class), "No registry present for Wolf$Variant. This is a bug."); // Paper
/**
* Map cursor types.
*
@@ -300,7 +309,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see GameEvent
*/
- Registry<GameEvent> GAME_EVENT = Objects.requireNonNull(Bukkit.getRegistry(GameEvent.class), "No registry present for GameEvent. This is a bug.");
+ Registry<GameEvent> GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper
/**
* Get the object by its key.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f0c1d16c6bee58826a3cde3c4988e02690207fce..c53268bc4c3ae275ad8765f0848e46e1d6c7372d 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2046,8 +2046,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param tClass of the registry to get
* @param <T> type of the registry
* @return the corresponding registry or null if not present
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}
+ * with keys from {@link io.papermc.paper.registry.RegistryKey}
*/
@Nullable
+ @Deprecated(since = "1.20.6") // Paper
<T extends Keyed> Registry<T> getRegistry(@NotNull Class<T> tClass);
/**
diff --git a/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java b/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java
new file mode 100644
index 0000000000000000000000000000000000000000..f5ece852f97017f71bc129e194cb212979b2537b
--- /dev/null
+++ b/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java
@@ -0,0 +1,20 @@
+package io.papermc.paper.registry;
+
+import org.bukkit.Keyed;
+import org.bukkit.Registry;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class TestRegistryAccess implements RegistryAccess {
+
+ @Override
+ @Deprecated(since = "1.20.6", forRemoval = true)
+ public @Nullable <T extends Keyed> Registry<T> getRegistry(final @NotNull Class<T> type) {
+ throw new UnsupportedOperationException("Not supported");
+ }
+
+ @Override
+ public @NotNull <T extends Keyed> Registry<T> getRegistry(final @NotNull RegistryKey<T> registryKey) {
+ throw new UnsupportedOperationException("Not supported");
+ }
+}
diff --git a/src/test/java/org/bukkit/support/TestServer.java b/src/test/java/org/bukkit/support/TestServer.java
index b208150297a23c0b4acb79135416809718f5650e..f11c639f1dc3c5034678d80bde3127a2e81a4a93 100644
--- a/src/test/java/org/bukkit/support/TestServer.java
+++ b/src/test/java/org/bukkit/support/TestServer.java
@@ -36,26 +36,11 @@ public final class TestServer {
when(instance.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion());
- Map<Class<? extends Keyed>, Registry<?>> registers = new HashMap<>();
- when(instance.getRegistry(any())).then(invocationOnMock -> registers.computeIfAbsent(invocationOnMock.getArgument(0), aClass -> new Registry<Keyed>() {
- private final Map<NamespacedKey, Keyed> cache = new HashMap<>();
-
- @Override
- public Keyed get(NamespacedKey key) {
- return cache.computeIfAbsent(key, key2 -> mock(aClass, withSettings().stubOnly()));
- }
-
- @NotNull
- @Override
- public Stream<Keyed> stream() {
- throw new UnsupportedOperationException("Not supported");
- }
-
- @Override
- public Iterator<Keyed> iterator() {
- throw new UnsupportedOperationException("Not supported");
- }
- }));
+ // Paper start - RegistryAccess
+ when(instance.getRegistry(any())).then(invocationOnMock -> {
+ return io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(((Class<Keyed>)invocationOnMock.getArgument(0)));
+ });
+ // Paper end - RegistryAccess
UnsafeValues unsafeValues = mock(withSettings().stubOnly());
when(instance.getUnsafe()).thenReturn(unsafeValues);
diff --git a/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess b/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess
new file mode 100644
index 0000000000000000000000000000000000000000..f0a5e6d6b99aeef349fe465080ef2ff7b58617a6
--- /dev/null
+++ b/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess
@@ -0,0 +1 @@
+io.papermc.paper.registry.TestRegistryAccess

View File

@ -513,24 +513,22 @@ index 0000000000000000000000000000000000000000..1e7b53f9bc13dcd5a0a4a40004591e4f
+ }
+}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index a04d279561676e825905f5512c399d14a3d8f828..ac8fe849dfd407bb2beeca16aeda3ebbe5c7a874 100644
index e5393d3204f4d04d8e9640a45c6b4ba6a912079b..d573d8e36fbe6b7f5a298fb64910feba9cba0697 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -283,6 +283,17 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -310,6 +310,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see GameEvent
*/
Registry<GameEvent> GAME_EVENT = Objects.requireNonNull(Bukkit.getRegistry(GameEvent.class), "No registry present for GameEvent. This is a bug.");
+
Registry<GameEvent> GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper
+ // Paper start
+ /**
+ * Configured structures.
+ * @see io.papermc.paper.world.structure.ConfiguredStructure
+ * @deprecated use {@link #STRUCTURE}
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}
+ */
+ @Deprecated(forRemoval = true)
+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Bukkit.getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class);
+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for ConfiguredStructure. This is a bug.");
+ // Paper end
+
/**
* Get the object by its key.
*

View File

@ -1,38 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Tue, 2 Mar 2021 15:24:58 -0800
Subject: [PATCH] Cache the result of Material#isBlock
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 61e0739f002a949a204c7591dfa3074560d1459e..5aa595860c73e78cf3c9f2a8984c62744cfe5612 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4684,6 +4684,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
public final Class<?> data;
private final boolean legacy;
private final NamespacedKey key;
+ private boolean isBlock; // Paper
private Material(final int id) {
this(id, 64);
@@ -4887,6 +4888,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
* @return true if this material is a block
*/
public boolean isBlock() {
+ // Paper start - cache isBlock
+ return this.isBlock;
+ }
+ private boolean isBlock0() {
+ // Paper end
switch (this) {
//<editor-fold defaultstate="collapsed" desc="isBlock">
case ACACIA_BUTTON:
@@ -6131,6 +6137,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
static {
for (Material material : values()) {
BY_NAME.put(material.name(), material);
+ material.isBlock = material.isBlock0(); // Paper
}
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expand world key API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 732ed3724e784ad659cb4411dbd73b42a8330a2c..d078ea797cf4c6ab291aec3ad7fbd4740017286c 100644
index 7be6710d28dea19bd0f9054c1c2e32dacd355c45..8fd1de659777595d9d8198e7ee638ad5500a6317 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -864,6 +864,18 @@ public final class Bukkit {
@ -56,7 +56,7 @@ index 27eff0826d5b5b48697fefd9571886e7bbce74b1..d8b1fa79dc24138dc71e32c14bda71c1
// Paper end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 395f7910f535bfd33a5676b011ab62a53e30e140..e6598c36cfc98282f30a57105986a295f1c94676 100644
index c53268bc4c3ae275ad8765f0848e46e1d6c7372d..e1ab2090c1b219f12af382079907e440e9cf4379 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -722,6 +722,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -78,10 +78,10 @@ index 395f7910f535bfd33a5676b011ab62a53e30e140..e6598c36cfc98282f30a57105986a295
* Create a new virtual {@link WorldBorder}.
* <p>
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 241cb853476ea35dad73d0234b2d030e9af23476..5de86f8cd3cc7f7e8ebc4a22d3921273378704f2 100644
index fb1efc7dfcfbfb823c8ad8fe2943adb99104aefe..1b2b0e6d10393b4f4d0716256aa4c87b57affbe1 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -164,5 +164,10 @@ public interface UnsafeValues {
@@ -173,5 +173,10 @@ public interface UnsafeValues {
* Use this when sending custom packets, so that there are no collisions on the client or server.
*/
public int nextEntityId();

View File

@ -43,10 +43,10 @@ index 0000000000000000000000000000000000000000..f1cd5a4f37eee8975ac3d0421b524afc
+ }
+}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 5aa595860c73e78cf3c9f2a8984c62744cfe5612..1e4ebe9bdc6aadf18029377e7ce70ca0d88bd1a1 100644
index d6e2ec415eab4f55fd925a3b0982e869befbd088..044c563daee7898c676bd6ba58ee395c52eda121 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4750,6 +4750,19 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -4752,6 +4752,19 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
return Bukkit.getUnsafe().getBlockTranslationKey(this);
}
}
@ -108,10 +108,10 @@ index e7931f73f10fe35ebd5fe4a04b036d53bb117ebd..cbce835ed6d44e5b8c9aaae4e36a77f8
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 645cff10eef90826bb44bbe937b141289f182cde..a92421bbf0ee40ecbe4f272459c6a918dc45344c 100644
index 23686519b8c1338dd6e9f1c5a0e73467c0b59a4f..f0221815cbd30f3ccaacc87a57403491b55de128 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -891,5 +891,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -897,5 +897,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public @NotNull String translationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 5de86f8cd3cc7f7e8ebc4a22d3921273378704f2..a874faec93468c83fc475b60629fc36f933bd11c 100644
index 1b2b0e6d10393b4f4d0716256aa4c87b57affbe1..8635846c9f672e39f0929eec7bf83b22536ed284 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -169,5 +169,12 @@ public interface UnsafeValues {
@@ -178,5 +178,12 @@ public interface UnsafeValues {
* Just don't use it.
*/
@org.jetbrains.annotations.NotNull String getMainLevelName();

View File

@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f7
+
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index d078ea797cf4c6ab291aec3ad7fbd4740017286c..c3d3c7d05a03658157d49c6ff1ea1d7d085a6fd4 100644
index 8fd1de659777595d9d8198e7ee638ad5500a6317..e62d46629305a268906cd2cd5d5977d063c2f484 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -330,9 +330,11 @@ public final class Bukkit {
@ -85,7 +85,7 @@ index d078ea797cf4c6ab291aec3ad7fbd4740017286c..c3d3c7d05a03658157d49c6ff1ea1d7d
public static DataPackManager getDataPackManager() {
return server.getDataPackManager();
}
@@ -2585,6 +2587,14 @@ public final class Bukkit {
@@ -2588,6 +2590,14 @@ public final class Bukkit {
public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return server.getMobGoals();
}
@ -101,7 +101,7 @@ index d078ea797cf4c6ab291aec3ad7fbd4740017286c..c3d3c7d05a03658157d49c6ff1ea1d7d
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e6598c36cfc98282f30a57105986a295f1c94676..61ee087ec4a75ee8b10e204b4cdd1bab5f066819 100644
index e1ab2090c1b219f12af382079907e440e9cf4379..e3a494b9d3727973d225de3042da93594f36ca12 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -266,9 +266,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -116,7 +116,7 @@ index e6598c36cfc98282f30a57105986a295f1c94676..61ee087ec4a75ee8b10e204b4cdd1bab
public DataPackManager getDataPackManager();
/**
@@ -2251,5 +2253,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2256,5 +2258,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
@ -144,10 +144,10 @@ index 3d5af25a399589f1bdf95b77f584ae0ae5c26f02..ab512c7ee9d2442055b719d02d0d0ecc
/**
diff --git a/src/main/java/org/bukkit/packs/DataPackManager.java b/src/main/java/org/bukkit/packs/DataPackManager.java
index d7fb6310e6b1050c496d748388310bc6f8d78e23..2cd505046277febe010e9476539b064321d8b2ec 100644
index c33ca7b86426223200efa7df53faef061c3c7c0b..5ec17312564e245e6d482e89c2ef2a886d463154 100644
--- a/src/main/java/org/bukkit/packs/DataPackManager.java
+++ b/src/main/java/org/bukkit/packs/DataPackManager.java
@@ -11,8 +11,10 @@ import org.jetbrains.annotations.Nullable;
@@ -13,8 +13,10 @@ import org.jetbrains.annotations.Nullable;
/**
* Manager of data packs.

View File

@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index a874faec93468c83fc475b60629fc36f933bd11c..4130481843c9e0b847bd656622b0c1107ac1297b 100644
index 8635846c9f672e39f0929eec7bf83b22536ed284..51f1a09164d501de6d2561ed90175f2c24a668c1 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -176,5 +176,15 @@ public interface UnsafeValues {
@@ -185,5 +185,15 @@ public interface UnsafeValues {
* @return the server's protocol version
*/
int getProtocolVersion();
@ -25,10 +25,10 @@ index a874faec93468c83fc475b60629fc36f933bd11c..4130481843c9e0b847bd656622b0c110
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index a92421bbf0ee40ecbe4f272459c6a918dc45344c..04ff6579282708c48edee419381c698707fe0a3b 100644
index f0221815cbd30f3ccaacc87a57403491b55de128..ca2dac7b377ea098158ff3c84fd47f405b636869 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -903,5 +903,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -909,5 +909,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public io.papermc.paper.inventory.ItemRarity getRarity() {
return io.papermc.paper.inventory.ItemRarity.valueOf(this.getItemMeta().getRarity().name());
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack#editMeta
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 04ff6579282708c48edee419381c698707fe0a3b..351f5c0feec38377fccf09bfc1cef2df88fc2dcd 100644
index ca2dac7b377ea098158ff3c84fd47f405b636869..5fb8f7c1b79bd256925cb68cccfe0b974fb84043 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -561,6 +561,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -567,6 +567,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return result.ensureServerConversions(); // Paper
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Attributes API for item defaults
(Now replaced by upstream's API)
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 1e4ebe9bdc6aadf18029377e7ce70ca0d88bd1a1..3cb658023d738617a310099fa3759af253a9f4c2 100644
index 044c563daee7898c676bd6ba58ee395c52eda121..f6c3a4de2f07348d599e44d0b3173b8674ee85ac 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4763,6 +4763,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -4765,6 +4765,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
public io.papermc.paper.inventory.ItemRarity getItemRarity() {
return new org.bukkit.inventory.ItemStack(this).getRarity();
}

View File

@ -143,10 +143,10 @@ index 0d88dce9978243a1f995c5fb448c5d71b01136eb..8b1048c94dffd058eb9fd9144f7f59fc
+ // Paper end - Horse API
}
diff --git a/src/main/java/org/bukkit/entity/AreaEffectCloud.java b/src/main/java/org/bukkit/entity/AreaEffectCloud.java
index 3c65da551aca046986fc0302de3ccc149ee9526c..7f989f2025d16b368829c45f08b8cc8537c99e13 100644
index 1df234d6538f08724297ed4ad916f6d488736171..3eba2a9f60636c7d58d311d46f0447bb6bcc5cfb 100644
--- a/src/main/java/org/bukkit/entity/AreaEffectCloud.java
+++ b/src/main/java/org/bukkit/entity/AreaEffectCloud.java
@@ -239,4 +239,20 @@ public interface AreaEffectCloud extends Entity {
@@ -259,4 +259,20 @@ public interface AreaEffectCloud extends Entity {
* @param source the {@link ProjectileSource} that threw the LingeringPotion
*/
public void setSource(@Nullable ProjectileSource source);
@ -462,10 +462,10 @@ index c7d6a328def83619dca9b6122aeb5870e4585e70..795e799fec7cfd65a0e08bb3f941148d
* Mark the entity's removal.
*
diff --git a/src/main/java/org/bukkit/entity/Fireball.java b/src/main/java/org/bukkit/entity/Fireball.java
index 7a44707f2307dc4dbfea4de3f4baf3cc0490dc93..d0e82102425e54274be9c4769634d754319d6196 100644
index ceaf263bc554a92a232bd3ed18ea67ce4e0b487a..dc8ed9164f22eb140e16b9b25a82f85b873ada42 100644
--- a/src/main/java/org/bukkit/entity/Fireball.java
+++ b/src/main/java/org/bukkit/entity/Fireball.java
@@ -23,4 +23,32 @@ public interface Fireball extends Projectile, Explosive {
@@ -32,4 +32,32 @@ public interface Fireball extends Projectile, Explosive {
@NotNull
public Vector getDirection();

Some files were not shown because too many files have changed in this diff Show More