diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 7280fb743d..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,12 +0,0 @@ -[submodule "work/Bukkit"] - path = work/Bukkit - url = https://hub.spigotmc.org/stash/scm/spigot/bukkit.git -[submodule "work/CraftBukkit"] - path = work/CraftBukkit - url = https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git -[submodule "work/BuildData"] - path = work/BuildData - url = https://hub.spigotmc.org/stash/scm/spigot/builddata.git -[submodule "work/Spigot"] - path = work/Spigot - url = https://hub.spigotmc.org/stash/scm/spigot/spigot.git diff --git a/patches/api/API-for-an-entity-s-scoreboard-name.patch b/patches/api/API-for-an-entity-s-scoreboard-name.patch deleted file mode 100644 index 302d77e841..0000000000 --- a/patches/api/API-for-an-entity-s-scoreboard-name.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 9 Jul 2023 11:54:54 -0700 -Subject: [PATCH] API for an entity's scoreboard name - -Was obtainable through different methods, but you had to use different -methods depending on the implementation of Entity you were working with. - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - @NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler(); - // Paper end - Folia schedulers -+ -+ // Paper start - entity scoreboard name -+ /** -+ * Gets the string name of the entity used to track it in {@link org.bukkit.scoreboard.Scoreboard Scoreboards}. -+ * -+ * @return the scoreboard entry name -+ * @see org.bukkit.scoreboard.Scoreboard#getScores(String) -+ * @see org.bukkit.scoreboard.Scoreboard#getEntries() -+ */ -+ @NotNull String getScoreboardEntryName(); -+ // Paper end - entity scoreboard name - } diff --git a/patches/api/API-for-checking-sent-chunks.patch b/patches/api/API-for-checking-sent-chunks.patch deleted file mode 100644 index 1809565a69..0000000000 --- a/patches/api/API-for-checking-sent-chunks.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Flo0 -Date: Mon, 8 Apr 2024 16:22:07 +0200 -Subject: [PATCH] API for checking sent chunks - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void resetIdleDuration(); - // Paper end - -+ // Paper start - Add chunk view API -+ /** -+ * Gets the a set of chunk keys for all chunks that have been sent to the player. -+ * -+ * @return an immutable set of chunk keys -+ * @apiNote currently marked as experimental to gather feedback regarding the returned set being an immutable copy -+ * vs it potentially being an unmodifiable view of the set chunks. -+ */ -+ @ApiStatus.Experimental -+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable Set getSentChunkKeys(); -+ -+ /** -+ * Gets the set of chunks that have been sent to the player. -+ * -+ * @return an immutable set of chunks -+ * @apiNote currently marked as experimental to gather feedback regarding the returned set being an immutable copy -+ * vs it potentially being an unmodifiable view of the set chunks. -+ */ -+ @ApiStatus.Experimental -+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable Set getSentChunks(); -+ -+ /** -+ * Checks if the player has been sent a specific chunk. -+ * -+ * @param chunk the chunk to check -+ * @return true if the player has been sent the chunk, false otherwise -+ */ -+ default boolean isChunkSent(@NotNull org.bukkit.Chunk chunk) { -+ return this.isChunkSent(chunk.getChunkKey()); -+ } -+ -+ /** -+ * Checks if the player has been sent a specific chunk. -+ * -+ * @param chunkKey the chunk key to check -+ * @return true if the player has been sent the chunk, false otherwise -+ * @see org.bukkit.Chunk#getChunkKey() -+ */ -+ boolean isChunkSent(long chunkKey); -+ // Paper end -+ - @NotNull - @Override - Spigot spigot(); diff --git a/patches/api/API-for-creating-command-sender-which-forwards-feedb.patch b/patches/api/API-for-creating-command-sender-which-forwards-feedb.patch deleted file mode 100644 index 0f5eacb4cd..0000000000 --- a/patches/api/API-for-creating-command-sender-which-forwards-feedb.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Tue, 1 Feb 2022 15:51:44 -0700 -Subject: [PATCH] API for creating command sender which forwards feedback - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.getConsoleSender(); - } - -+ // Paper start -+ /** -+ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the -+ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}. -+ * -+ * @param feedback feedback listener -+ * @return a command sender -+ */ -+ @NotNull -+ public static CommandSender createCommandSender(final @NotNull java.util.function.Consumer feedback) { -+ return server.createCommandSender(feedback); -+ } -+ // Paper end -+ - /** - * Gets the folder that contains all of the various {@link World}s. - * -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public ConsoleCommandSender getConsoleSender(); - -+ // Paper start -+ /** -+ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the -+ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}. -+ * -+ * @param feedback feedback listener -+ * @return a command sender -+ */ -+ @NotNull -+ public CommandSender createCommandSender(final @NotNull java.util.function.Consumer feedback); -+ // Paper end -+ - /** - * Gets the folder that contains all of the various {@link World}s. - * diff --git a/patches/api/API-for-updating-recipes-on-clients.patch b/patches/api/API-for-updating-recipes-on-clients.patch deleted file mode 100644 index 54d7b26bbd..0000000000 --- a/patches/api/API-for-updating-recipes-on-clients.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 21 Aug 2021 17:25:54 -0700 -Subject: [PATCH] API for updating recipes on clients - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - server.reloadData(); - } - -+ // Paper start - update reloadable data -+ /** -+ * Updates all advancement, tag, and recipe data for all connected clients. -+ * Useful for updating clients to new advancements/recipes/tags. -+ * @see #updateRecipes() -+ */ -+ public static void updateResources() { -+ server.updateResources(); -+ } -+ -+ /** -+ * Updates recipe data and the recipe book for all connected clients. Useful for -+ * updating clients to new recipes. -+ * @see #updateResources() -+ */ -+ public static void updateRecipes() { -+ server.updateRecipes(); -+ } -+ // Paper end - update reloadable data -+ - /** - * Returns the primary logger associated with this server instance. - * -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.addRecipe(recipe); - } - -+ // Paper start - method to send recipes immediately -+ /** -+ * Adds a recipe to the crafting manager. -+ * -+ * @param recipe the recipe to add -+ * @param resendRecipes true to update the client with the full set of recipes -+ * @return true if the recipe was added, false if it wasn't for some reason -+ */ -+ @Contract("null, _ -> false") -+ public static boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes) { -+ return server.addRecipe(recipe, resendRecipes); -+ } -+ // Paper end - method to send recipes immediately -+ - /** - * Get a list of all recipes for a given item. The stack size is ignored - * in comparisons. If the durability is -1, it will match any data value. -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.removeRecipe(key); - } - -+ // Paper start - method to resend recipes -+ /** -+ * Remove a recipe from the server. -+ *

-+ * Note that removing a recipe may cause permanent loss of data -+ * associated with that recipe (eg whether it has been discovered by -+ * players). -+ * -+ * @param key NamespacedKey of recipe to remove. -+ * @param resendRecipes true to update all clients on the new recipe list. -+ * Will only update if a recipe was actually removed -+ * @return True if recipe was removed -+ */ -+ public static boolean removeRecipe(@NotNull NamespacedKey key, boolean resendRecipes) { -+ return server.removeRecipe(key, resendRecipes); -+ } -+ // Paper end - method to resend recipes -+ - /** - * Gets a list of command aliases defined in the server properties. - * -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - public void reloadData(); - -+ // Paper start - update reloadable data -+ /** -+ * Updates all advancement, tag, and recipe data to all connected clients. -+ * Useful for updating clients to new advancements/recipes/tags. -+ * @see #updateRecipes() -+ */ -+ void updateResources(); -+ -+ /** -+ * Updates recipe data and the recipe book to each player. Useful for -+ * updating clients to new recipes. -+ * @see #updateResources() -+ */ -+ void updateRecipes(); -+ // Paper end - update reloadable data -+ - /** - * Returns the primary logger associated with this server instance. - * -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - public boolean dispatchCommand(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException; - - /** -- * Adds a recipe to the crafting manager. -+ * Adds a recipe to the crafting manager. Recipes added with -+ * this method won't be sent to the client automatically. Use -+ * {@link #updateRecipes()} or {@link #updateResources()} to -+ * update clients to new recipes added. -+ *

-+ * Player's still have to discover recipes via {@link Player#discoverRecipe(NamespacedKey)} -+ * before seeing them in their recipe book. - * - * @param recipe the recipe to add - * @return true if the recipe was added, false if it wasn't for some - * reason -+ * @see #addRecipe(Recipe, boolean) - */ - @Contract("null -> false") - public boolean addRecipe(@Nullable Recipe recipe); - -+ // Paper start - method to send recipes immediately -+ /** -+ * Adds a recipe to the crafting manager. -+ * -+ * @param recipe the recipe to add -+ * @param resendRecipes true to update the client with the full set of recipes -+ * @return true if the recipe was added, false if it wasn't for some reason -+ */ -+ @Contract("null, _ -> false") -+ boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes); -+ // Paper end - method to send recipes immediately -+ - /** - * Get a list of all recipes for a given item. The stack size is ignored - * in comparisons. If the durability is -1, it will match any data value. -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - public boolean removeRecipe(@NotNull NamespacedKey key); - -+ // Paper start - method to resend recipes -+ /** -+ * Remove a recipe from the server. -+ *

-+ * Note that removing a recipe may cause permanent loss of data -+ * associated with that recipe (eg whether it has been discovered by -+ * players). -+ * -+ * @param key NamespacedKey of recipe to remove. -+ * @param resendRecipes true to update all clients on the new recipe list. -+ * Will only update if a recipe was actually removed -+ * @return True if recipe was removed -+ */ -+ boolean removeRecipe(@NotNull NamespacedKey key, boolean resendRecipes); -+ // Paper end - method to resend recipes -+ - /** - * Gets a list of command aliases defined in the server properties. - * diff --git a/patches/api/API-to-allow-disallow-tick-sleeping.patch b/patches/api/API-to-allow-disallow-tick-sleeping.patch deleted file mode 100644 index 9b68f992e3..0000000000 --- a/patches/api/API-to-allow-disallow-tick-sleeping.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Abel -Date: Tue, 12 Nov 2024 22:25:35 +0100 -Subject: [PATCH] API to allow/disallow tick sleeping - - -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * Returns whether the server is sleeping/paused. - */ - boolean isPaused(); -+ -+ /** -+ * Allows or disallows the server to sleep/pause. -+ * If any plugin disallows pausing, the server will never pause. -+ * -+ * @param plugin The {@link org.bukkit.plugin.Plugin} that's allowing or disallowing pausing. -+ * @param value Whether to allow sleeping of the server (defaults to true). -+ */ -+ void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value); - // Paper end - API to check if the server is sleeping - } diff --git a/patches/api/API-to-check-if-the-server-is-sleeping.patch b/patches/api/API-to-check-if-the-server-is-sleeping.patch deleted file mode 100644 index c4d0ed1cb3..0000000000 --- a/patches/api/API-to-check-if-the-server-is-sleeping.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Abel -Date: Sun, 10 Nov 2024 16:32:51 +0100 -Subject: [PATCH] API to check if the server is sleeping - - -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - public boolean isGlobalTickThread(); - // Paper end - Folia region threading API -+ -+ // Paper start - API to check if the server is sleeping -+ /** -+ * Returns whether the server is sleeping/paused. -+ */ -+ boolean isPaused(); -+ // Paper end - API to check if the server is sleeping - } diff --git a/patches/api/API-to-get-a-BlockState-without-a-snapshot.patch b/patches/api/API-to-get-a-BlockState-without-a-snapshot.patch deleted file mode 100644 index 158eaae091..0000000000 --- a/patches/api/API-to-get-a-BlockState-without-a-snapshot.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 6 Nov 2017 21:10:01 -0500 -Subject: [PATCH] API to get a BlockState without a snapshot - -This allows you to get a BlockState without creating a snapshot, operating -on the real tile entity. - -This is useful for where performance is needed - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable { - @NotNull - BlockState getState(); - -+ // Paper start -+ /** -+ * @see #getState() optionally disables use of snapshot, to operate on real block data -+ * @param useSnapshot if this block is a TE, should we create a fully copy of the TileEntity -+ * @return BlockState with the current state of this block -+ */ -+ @NotNull -+ BlockState getState(boolean useSnapshot); -+ // Paper end -+ - /** - * Returns the biome that this block resides in - * -diff --git a/src/main/java/org/bukkit/block/TileState.java b/src/main/java/org/bukkit/block/TileState.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/TileState.java -+++ b/src/main/java/org/bukkit/block/TileState.java -@@ -0,0 +0,0 @@ public interface TileState extends BlockState, PersistentDataHolder { - @NotNull - @Override - PersistentDataContainer getPersistentDataContainer(); -+ -+ // Paper start -+ /** -+ * Checks if this TileState is a snapshot or a live -+ * representation of the underlying tile entity. -+ *

-+ * NOTE: You may still have to call {@link BlockState#update()} on -+ * live representations to update any visuals on the block. -+ * -+ * @return true if this is a snapshot -+ * @see Block#getState(boolean) -+ */ -+ boolean isSnapshot(); -+ // Paper end - } diff --git a/patches/api/Ability-to-apply-mending-to-XP-API.patch b/patches/api/Ability-to-apply-mending-to-XP-API.patch deleted file mode 100644 index a469407ed7..0000000000 --- a/patches/api/Ability-to-apply-mending-to-XP-API.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 20 Dec 2017 17:38:07 -0500 -Subject: [PATCH] Ability to apply mending to XP API - -This allows plugins that give players the ability to apply the experience -points to the Item Mending formula, which will repair an item instead -of giving the player experience points. - -Both an API To standalone mend, and apply mending logic to .giveExp has been added. - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ - public void resetPlayerWeather(); - -+ // Paper start -+ /** -+ * Gives the player the amount of experience specified. -+ * -+ * @param amount Exp amount to give -+ */ -+ public default void giveExp(int amount) { -+ giveExp(amount, false); -+ } - /** - * Gets the player's cooldown between picking up experience orbs. - * -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * Gives the player the amount of experience specified. - * - * @param amount Exp amount to give -+ * @param applyMending Mend players items with mending, with same behavior as picking up orbs. calls {@link #applyMending(int)} - */ -- public void giveExp(int amount); -+ public void giveExp(int amount, boolean applyMending); -+ -+ /** -+ * Applies the mending effect to any items just as picking up an orb would. -+ * -+ * Can also be called with {@link #giveExp(int, boolean)} by passing true to applyMending -+ * -+ * @param amount Exp to apply -+ * @return the remaining experience -+ */ -+ public int applyMending(int amount); -+ // Paper end - - /** - * Gives the player the amount of experience levels specified. Levels can diff --git a/patches/api/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/api/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch deleted file mode 100644 index 35fc9b634e..0000000000 --- a/patches/api/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 15 Aug 2018 01:04:58 -0400 -Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots - - -diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Chunk.java -+++ b/src/main/java/org/bukkit/Chunk.java -@@ -0,0 +0,0 @@ public interface Chunk extends PersistentDataHolder { - * @return The tile entities. - */ - @NotNull -- BlockState[] getTileEntities(); -+ // Paper start -+ default BlockState[] getTileEntities() { -+ return getTileEntities(true); -+ } -+ -+ /** -+ * Get a list of all tile entities in the chunk. -+ * -+ * @param useSnapshot Take snapshots or direct references -+ * @return The tile entities. -+ */ -+ @NotNull -+ BlockState[] getTileEntities(boolean useSnapshot); -+ -+ /** -+ * Get a list of all tile entities that match a given predicate in the chunk. -+ * -+ * @param blockPredicate The predicate of blocks to return tile entities for -+ * @param useSnapshot Take snapshots or direct references -+ * @return The tile entities. -+ */ -+ @NotNull -+ Collection getTileEntities(java.util.function.@NotNull Predicate blockPredicate, boolean useSnapshot); -+ // Paper end - - /** - * Checks if the chunk is fully generated. diff --git a/patches/api/Add-API-for-item-entity-health.patch b/patches/api/Add-API-for-item-entity-health.patch deleted file mode 100644 index ec0789efc9..0000000000 --- a/patches/api/Add-API-for-item-entity-health.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 28 Aug 2021 09:00:35 -0700 -Subject: [PATCH] Add API for item entity health - - -diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Item.java -+++ b/src/main/java/org/bukkit/entity/Item.java -@@ -0,0 +0,0 @@ public interface Item extends Entity { - * @param willAge True if the item should age - */ - public void setWillAge(boolean willAge); -+ -+ /** -+ * Gets the health of item stack. -+ *

-+ * Currently the default max health is 5. -+ * -+ * @return the health -+ */ -+ public int getHealth(); -+ -+ /** -+ * Sets the health of the item stack. If the value is non-positive -+ * the itemstack's normal "on destroy" functionality will be run. -+ *

-+ * Currently, the default max health is 5. -+ * -+ * @param health the health, a non-positive value will destroy the entity -+ */ -+ public void setHealth(int health); - // Paper end - } diff --git a/patches/api/Add-API-for-quit-reason.patch b/patches/api/Add-API-for-quit-reason.patch deleted file mode 100644 index 2be5edbfed..0000000000 --- a/patches/api/Add-API-for-quit-reason.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Sat, 14 Nov 2020 16:19:58 +0100 -Subject: [PATCH] Add API for quit reason - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - public class PlayerQuitEvent extends PlayerEvent { - private static final HandlerList handlers = new HandlerList(); - private net.kyori.adventure.text.Component quitMessage; // Paper -+ private final QuitReason reason; // Paper - - @Deprecated // Paper - public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) { -+ // Paper start -+ this(who, quitMessage, null); -+ } -+ @Deprecated // Paper -+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) { - super(who); - this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper -+ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason; - } - // Paper start -+ @Deprecated - public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) { -+ this(who, quitMessage, null); -+ } -+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage, @Nullable QuitReason quitReason) { - super(who); - this.quitMessage = quitMessage; -+ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason; - } - - /** -@@ -0,0 +0,0 @@ public class PlayerQuitEvent extends PlayerEvent { - public static HandlerList getHandlerList() { - return handlers; - } -+ -+ // Paper start -+ @NotNull -+ public QuitReason getReason() { -+ return this.reason; -+ } -+ -+ public enum QuitReason { -+ /** -+ * The player left on their own behalf. -+ *

-+ * This does not mean they pressed the disconnect button in their client, but rather that the client severed the -+ * connection themselves. This may occur if no keep-alive packet is received on their side, among other things. -+ */ -+ DISCONNECTED, -+ -+ /** -+ * The player was kicked from the server. -+ */ -+ KICKED, -+ -+ /** -+ * The player has timed out. -+ */ -+ TIMED_OUT, -+ -+ /** -+ * The player's connection has entered an erroneous state. -+ *

-+ * Reasons for this may include invalid packets, invalid data, and uncaught exceptions in the packet handler, -+ * among others. -+ */ -+ ERRONEOUS_STATE, -+ } -+ // Paper end - } diff --git a/patches/api/Add-API-for-resetting-a-single-score.patch b/patches/api/Add-API-for-resetting-a-single-score.patch deleted file mode 100644 index fb565a0dd9..0000000000 --- a/patches/api/Add-API-for-resetting-a-single-score.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: booky10 -Date: Fri, 5 Nov 2021 21:01:36 +0100 -Subject: [PATCH] Add API for resetting a single score - -It was only possible to reset all scores for a specific entry, instead of resetting only specific scores. - -diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/scoreboard/Score.java -+++ b/src/main/java/org/bukkit/scoreboard/Score.java -@@ -0,0 +0,0 @@ public interface Score { - */ - @Nullable - Scoreboard getScoreboard(); -+ -+ // Paper start -+ /** -+ * Resets this score, if a value has been set. -+ * -+ * @throws IllegalStateException if the associated objective has been -+ * unregistered -+ */ -+ void resetScore() throws IllegalStateException; -+ // Paper end - } diff --git a/patches/api/Add-API-methods-to-control-if-armour-stands-can-move.patch b/patches/api/Add-API-methods-to-control-if-armour-stands-can-move.patch deleted file mode 100644 index 87734f2f91..0000000000 --- a/patches/api/Add-API-methods-to-control-if-armour-stands-can-move.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Wed, 21 Dec 2016 11:47:25 -0600 -Subject: [PATCH] Add API methods to control if armour stands can move - - -diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/ArmorStand.java -+++ b/src/main/java/org/bukkit/entity/ArmorStand.java -@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity { - */ - ADDING; - } -+ // Paper start -+ /** -+ * Tests if this armor stand can move. -+ * -+ *

The default value is {@code true}.

-+ * -+ * @return {@code true} if this armour stand can move, {@code false} otherwise -+ */ -+ boolean canMove(); -+ -+ /** -+ * Sets if this armor stand can move. -+ * -+ * @param move {@code true} if this armour stand can move, {@code false} otherwise -+ */ -+ void setCanMove(boolean move); -+ // Paper end - } diff --git a/patches/api/Add-API-to-get-Material-from-Boats-and-Minecarts.patch b/patches/api/Add-API-to-get-Material-from-Boats-and-Minecarts.patch deleted file mode 100644 index e03ef9ceed..0000000000 --- a/patches/api/Add-API-to-get-Material-from-Boats-and-Minecarts.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Madeline Miller -Date: Thu, 31 Dec 2020 12:48:38 +1000 -Subject: [PATCH] Add API to get Material from Boats and Minecarts - - -diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Boat.java -+++ b/src/main/java/org/bukkit/entity/Boat.java -@@ -0,0 +0,0 @@ public interface Boat extends Vehicle { - ON_LAND, - IN_AIR; - } -+ -+ // Paper start -+ /** -+ * Gets the {@link Material} that represents this Boat type. -+ * -+ * @return the boat material. -+ */ -+ @NotNull -+ public Material getBoatMaterial(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Minecart.java -+++ b/src/main/java/org/bukkit/entity/Minecart.java -@@ -0,0 +0,0 @@ - package org.bukkit.entity; - - import org.bukkit.GameRule; -+import org.bukkit.Material; - import org.bukkit.block.data.BlockData; - import org.bukkit.material.MaterialData; - import org.bukkit.util.Vector; -@@ -0,0 +0,0 @@ public interface Minecart extends Vehicle { - * @return the current block offset for this minecart. - */ - public int getDisplayBlockOffset(); -+ -+ // Paper start -+ /** -+ * Gets the {@link Material} that represents this Minecart type. -+ * -+ * @return the minecart material. -+ */ -+ @NotNull -+ public Material getMinecartMaterial(); -+ // Paper end - } diff --git a/patches/api/Add-API-to-get-exact-interaction-point-in-PlayerInte.patch b/patches/api/Add-API-to-get-exact-interaction-point-in-PlayerInte.patch deleted file mode 100644 index c1464806b4..0000000000 --- a/patches/api/Add-API-to-get-exact-interaction-point-in-PlayerInte.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Madeline Miller -Date: Mon, 4 Jan 2021 16:40:55 +1000 -Subject: [PATCH] Add API to get exact interaction point in PlayerInteractEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java -@@ -0,0 +0,0 @@ - package org.bukkit.event.player; - -+import org.bukkit.Location; - import org.bukkit.Material; - import org.bukkit.block.Block; - import org.bukkit.block.BlockFace; -@@ -0,0 +0,0 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable { - *

- * All vector components are between 0.0 and 1.0 inclusive. - * -+ * @deprecated misleading, use {@link #getInteractionPoint()} - * @return the clicked position. May be null. - */ - @Nullable -+ @Deprecated // Paper - public Vector getClickedPosition() { - return clickedPosistion; - } - -+ // Paper start -+ /** -+ * The exact point at which the interaction occurred. May be null. -+ * -+ * @return the exact interaction point. May be null. -+ */ -+ @Nullable -+ public Location getInteractionPoint() { -+ if (this.blockClicked == null || this.clickedPosistion == null) { -+ return null; -+ } -+ return this.blockClicked.getLocation().add(this.clickedPosistion); -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { diff --git a/patches/api/Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/api/Add-API-to-get-the-collision-shape-of-a-block-before.patch deleted file mode 100644 index 6e321886fa..0000000000 --- a/patches/api/Add-API-to-get-the-collision-shape-of-a-block-before.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TrollyLoki -Date: Wed, 11 Oct 2023 00:45:54 -0400 -Subject: [PATCH] Add API to get the collision shape of a block before it's - placed - - -diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/BlockData.java -+++ b/src/main/java/org/bukkit/block/data/BlockData.java -@@ -0,0 +0,0 @@ public interface BlockData extends Cloneable { - */ - boolean isFaceSturdy(@NotNull BlockFace face, @NotNull BlockSupport support); - -+ // Paper start -+ /** -+ * Calculates the collision shape this block data would have at a particular location. -+ *

-+ * This does not take into account any block updates that may occur if the block was to be actually placed in the world. -+ * -+ * @param location the location to calculate the collision shape at -+ * -+ * @return a {@link org.bukkit.util.VoxelShape} representing the collision shape of this block data. -+ */ -+ @NotNull org.bukkit.util.VoxelShape getCollisionShape(@NotNull Location location); -+ // Paper end -+ - /** - * Gets the color this block should appear as when rendered on a map. - * diff --git a/patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch deleted file mode 100644 index 77ef20b948..0000000000 --- a/patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Wed, 2 Jan 2019 00:31:12 -0600 -Subject: [PATCH] Add APIs to replace OfflinePlayer#getLastPlayed - -Currently OfflinePlayer#getLastPlayed could more accurately be described -as "OfflinePlayer#getLastTimeTheirDataWasSaved". - -The API doc says it should return the last time the server "witnessed" -the player, whilst also saying it should return the last time they -logged in. The current implementation does neither. - -Given this interesting contradiction in the API documentation and the -current defacto implementation, I've elected to deprecate (with no -intent to remove) and replace it with two new methods, clearly named and -documented as to their purpose. - -diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/OfflinePlayer.java -+++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - * UTC. - * - * @return Date of last log-in for this player, or 0 -+ * @deprecated The API contract is ambiguous and the implementation may or may not return the correct value given this API ambiguity. It is instead recommended use {@link #getLastLogin()} or {@link #getLastSeen()} depending on your needs. - */ -+ @Deprecated - public long getLastPlayed(); - - /** -@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - @Nullable - @Deprecated(since = "1.20.4") - public Location getBedSpawnLocation(); -+ // Paper start -+ /** -+ * Gets the last date and time that this player logged into the server. -+ *

-+ * If the player has never played before, this will return 0. Otherwise, -+ * it will be the amount of milliseconds since midnight, January 1, 1970 -+ * UTC. -+ * -+ * @return last login time -+ */ -+ public long getLastLogin(); -+ -+ /** -+ * Gets the last date and time that this player was seen on the server. -+ *

-+ * If the player has never played before, this will return 0. If the -+ * player is currently online, this will return the current time. -+ * Otherwise it will be the amount of milliseconds since midnight, -+ * January 1, 1970 UTC. -+ * -+ * @return last seen time -+ */ -+ public long getLastSeen(); -+ // Paper end - - /** - * Gets the Location where the player will spawn at, null if they diff --git a/patches/api/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/api/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch deleted file mode 100644 index 26b062e982..0000000000 --- a/patches/api/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com> -Date: Fri, 8 Jan 2021 20:29:58 +0100 -Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java -@@ -0,0 +0,0 @@ import org.bukkit.advancement.Advancement; - import org.bukkit.entity.Player; - import org.bukkit.event.HandlerList; - import org.jetbrains.annotations.NotNull; -+// Paper start -+import org.jetbrains.annotations.Nullable; -+import net.kyori.adventure.text.Component; -+// Paper end - - /** - * Called when a player has completed all criteria in an advancement. -@@ -0,0 +0,0 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent { - private static final HandlerList handlers = new HandlerList(); - // - private final Advancement advancement; -+ private Component message; // Paper - Add Adventure message - - public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement) { -+ // Paper start - Add Adventure message -+ this(who, advancement, null); -+ } -+ public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement, @Nullable Component message) { -+ // Paper end - super(who); - this.advancement = advancement; -+ this.message = message; // Paper - Add Adventure message - } - - /** -@@ -0,0 +0,0 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent { - return advancement; - } - -+ // Paper start - Add Adventure message -+ /** -+ * Gets the message to send to all online players. -+ *

-+ * Will be null if the advancement does not announce to chat, for example if -+ * it is a recipe unlock or a root advancement. -+ * -+ * @return The announcement message, or null -+ */ -+ @Nullable -+ public Component message() { -+ return this.message; -+ } -+ -+ /** -+ * Sets the message to send to all online players. -+ *

-+ * If set to null the message will not be sent. -+ * -+ * @param message The new message -+ */ -+ public void message(@Nullable Component message) { -+ this.message = message; -+ } -+ // Paper end - @NotNull - @Override - public HandlerList getHandlers() { diff --git a/patches/api/Add-AnvilView-bypassEnchantmentLevelRestriction.patch b/patches/api/Add-AnvilView-bypassEnchantmentLevelRestriction.patch deleted file mode 100644 index 86313f638a..0000000000 --- a/patches/api/Add-AnvilView-bypassEnchantmentLevelRestriction.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Doc -Date: Sun, 6 Oct 2024 16:45:20 -0300 -Subject: [PATCH] Add AnvilView#bypassEnchantmentLevelRestriction - -Anvils, by default, limit applied enchantment levels to their respective -maximum level. The added API enables plugins to disable this behaviour, -allowing enchantments that are overleveled to be applied via the anvil. - -diff --git a/src/main/java/org/bukkit/inventory/view/AnvilView.java b/src/main/java/org/bukkit/inventory/view/AnvilView.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/view/AnvilView.java -+++ b/src/main/java/org/bukkit/inventory/view/AnvilView.java -@@ -0,0 +0,0 @@ public interface AnvilView extends InventoryView { - * @param levels the levels to set - */ - void setMaximumRepairCost(int levels); -+ -+ // Paper start - bypass anvil level restrictions -+ /** -+ * Returns whether this view will bypass the vanilla enchantment level restriction -+ * when applying enchantments to an item or not. -+ *

-+ * By default, vanilla will limit enchantments applied to items to the respective -+ * {@link org.bukkit.enchantments.Enchantment#getMaxLevel()}, even if the applied enchantment itself is above said -+ * limit. -+ * Disabling this limit via {@link AnvilView#bypassEnchantmentLevelRestriction(boolean)} allows for, e.g., enchanted -+ * books to be applied fully, even if their enchantments are beyond the limit. -+ * -+ * @return {@code true} if this view bypasses the vanilla restrictions. -+ */ -+ boolean bypassesEnchantmentLevelRestriction(); -+ -+ /** -+ * Sets if enchantments applied via this anvil view may bypass vanilla's level restrictions. -+ * -+ * @param bypassEnchantmentLevelRestriction if this view bypasses the vanilla level restrictions. -+ * @see AnvilView#bypassesEnchantmentLevelRestriction() -+ */ -+ void bypassEnchantmentLevelRestriction(boolean bypassEnchantmentLevelRestriction); -+ // Paper end - bypass anvil level restrictions - } diff --git a/patches/api/Add-ArmorStand-Item-Meta.patch b/patches/api/Add-ArmorStand-Item-Meta.patch deleted file mode 100644 index 78cb5cbb68..0000000000 --- a/patches/api/Add-ArmorStand-Item-Meta.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sat, 27 Jan 2018 17:06:24 -0500 -Subject: [PATCH] Add ArmorStand Item Meta - -This is adds basic item meta for armor stands. It does not add all -possible metadata however. - -There are armor, hand, and equipment types, as well as position data -that can also be added here. This initial addition should serve a -starting point for future additions in this area. - -diff --git a/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java b/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.inventory.meta; -+ -+import org.bukkit.inventory.meta.ItemMeta; -+ -+public interface ArmorStandMeta extends ItemMeta { -+ -+ /** -+ * Gets whether the ArmorStand should be invisible when spawned -+ * -+ * @return true if this should be invisible -+ */ -+ boolean isInvisible(); -+ -+ /** -+ * Gets whether this ArmorStand should have no base plate when spawned -+ * -+ * @return true if it will not have a base plate -+ */ -+ boolean hasNoBasePlate(); -+ -+ /** -+ * Gets whether this ArmorStand should show arms when spawned -+ * -+ * @return true if it will show arms -+ */ -+ boolean shouldShowArms(); -+ -+ /** -+ * Gets whether this ArmorStand will be small when spawned -+ * -+ * @return true if it will be small -+ */ -+ boolean isSmall(); -+ -+ /** -+ * Gets whether this ArmorStand will be a marker when spawned -+ * The exact details of this flag are an implementation detail -+ * -+ * @return true if it will be a marker -+ */ -+ boolean isMarker(); -+ -+ /** -+ * Sets that this ArmorStand should be invisible when spawned -+ * -+ * @param invisible true if set invisible -+ */ -+ void setInvisible(boolean invisible); -+ -+ /** -+ * Sets that this ArmorStand should have no base plate when spawned -+ * -+ * @param noBasePlate true if no base plate -+ */ -+ void setNoBasePlate(boolean noBasePlate); -+ -+ /** -+ * Sets that this ArmorStand should show arms when spawned -+ * -+ * @param showArms true if show arms -+ */ -+ void setShowArms(boolean showArms); -+ -+ /** -+ * Sets that this ArmorStand should be small when spawned -+ * -+ * @param small true if small -+ */ -+ void setSmall(boolean small); -+ -+ /** -+ * Sets that this ArmorStand should be a marker when spawned -+ * The exact details of this flag are an implementation detail -+ * -+ * @param marker true if a marker -+ */ -+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemType.java -+++ b/src/main/java/org/bukkit/inventory/ItemType.java -@@ -0,0 +0,0 @@ public interface ItemType extends Keyed, Translatable { - ItemType.Typed RABBIT_STEW = getItemType("rabbit_stew"); - ItemType.Typed RABBIT_FOOT = getItemType("rabbit_foot"); - ItemType.Typed RABBIT_HIDE = getItemType("rabbit_hide"); -- ItemType.Typed ARMOR_STAND = getItemType("armor_stand"); -+ ItemType.Typed ARMOR_STAND = getItemType("armor_stand"); - ItemType.Typed IRON_HORSE_ARMOR = getItemType("iron_horse_armor"); - ItemType.Typed GOLDEN_HORSE_ARMOR = getItemType("golden_horse_armor"); - ItemType.Typed DIAMOND_HORSE_ARMOR = getItemType("diamond_horse_armor"); diff --git a/patches/api/Add-Ban-Methods-to-Player-Objects.patch b/patches/api/Add-Ban-Methods-to-Player-Objects.patch deleted file mode 100644 index 1246b8b15e..0000000000 --- a/patches/api/Add-Ban-Methods-to-Player-Objects.patch +++ /dev/null @@ -1,278 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 28 Apr 2018 10:28:50 -0400 -Subject: [PATCH] Add Ban Methods to Player Objects - -Allows a more logical API for banning players. - -player.banPlayer("Breaking the rules"); - -diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/OfflinePlayer.java -+++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - * @return true if banned, otherwise false - */ - public boolean isBanned(); -+ // Paper start -+ /** -+ * Permanently Bans this player from the server -+ * -+ * @param reason Reason for Ban -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} -+ */ -+ @NotNull -+ @Deprecated(since = "1.20.4") -+ public default BanEntry banPlayer(@Nullable String reason) { -+ return banPlayer(reason, null, null); -+ } -+ -+ /** -+ * Permanently Bans this player from the server -+ * @param reason Reason for Ban -+ * @param source Source of the ban, or null for default -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} -+ */ -+ @NotNull -+ @Deprecated(since = "1.20.4") -+ public default BanEntry banPlayer(@Nullable String reason, @Nullable String source) { -+ return banPlayer(reason, null, source); -+ } -+ -+ /** -+ * Bans this player from the server -+ * @param reason Reason for Ban -+ * @param expires When to expire the ban -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} -+ */ -+ @NotNull -+ @Deprecated(since = "1.20.4") -+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires) { -+ return banPlayer(reason, expires, null); -+ } -+ -+ /** -+ * Bans this player from the server -+ * @param reason Reason for Ban -+ * @param expires When to expire the ban -+ * @param source Source of the ban or null for default -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} -+ */ -+ @NotNull -+ @Deprecated(since = "1.20.4") -+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) { -+ return banPlayer(reason, expires, source, true); -+ } -+ -+ /** -+ * @deprecated use {@link #ban(String, Date, String)} -+ */ -+ @NotNull -+ @Deprecated(since = "1.20.4") -+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickIfOnline) { -+ BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.NAME).addBan(getName(), reason, expires, source); -+ if (kickIfOnline && isOnline()) { -+ getPlayer().kickPlayer(reason); -+ } -+ return banEntry; -+ } -+ // Paper end - - /** - * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - public void sendMap(@NotNull MapView map); - - // Paper start -+ /** -+ * Permanently Bans the Profile and IP address currently used by the player. -+ * -+ * @param reason Reason for ban -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ // For reference, Bukkit defines this as nullable, while they impl isn't, we'll follow API. -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason) { -+ return banPlayerFull(reason, null, null); -+ } -+ -+ /** -+ * Permanently Bans the Profile and IP address currently used by the player. -+ * -+ * @param reason Reason for ban -+ * @param source Source of ban, or null for default -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable String source) { -+ return banPlayerFull(reason, null, source); -+ } -+ -+ /** -+ * Bans the Profile and IP address currently used by the player. -+ * -+ * @param reason Reason for Ban -+ * @param expires When to expire the ban -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable java.util.Date expires) { -+ return banPlayerFull(reason, expires, null); -+ } -+ -+ /** -+ * Bans the Profile and IP address currently used by the player. -+ * -+ * @param reason Reason for Ban -+ * @param expires When to expire the ban -+ * @param source Source of the ban, or null for default -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) { -+ banPlayer(reason, expires, source); -+ return banPlayerIP(reason, expires, source, true); -+ } -+ -+ /** -+ * Permanently Bans the IP address currently used by the player. -+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)} -+ * -+ * @param reason Reason for ban -+ * @param kickPlayer Whether or not to kick the player afterwards -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, boolean kickPlayer) { -+ return banPlayerIP(reason, null, null, kickPlayer); -+ } -+ -+ /** -+ * Permanently Bans the IP address currently used by the player. -+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)} -+ * @param reason Reason for ban -+ * @param source Source of ban, or null for default -+ * @param kickPlayer Whether or not to kick the player afterwards -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable String source, boolean kickPlayer) { -+ return banPlayerIP(reason, null, source, kickPlayer); -+ } -+ -+ /** -+ * Bans the IP address currently used by the player. -+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)} -+ * @param reason Reason for Ban -+ * @param expires When to expire the ban -+ * @param kickPlayer Whether or not to kick the player afterwards -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, boolean kickPlayer) { -+ return banPlayerIP(reason, expires, null, kickPlayer); -+ } -+ -+ /** -+ * Permanently Bans the IP address currently used by the player. -+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)} -+ * -+ * @param reason Reason for ban -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason) { -+ return banPlayerIP(reason, null, null); -+ } -+ -+ /** -+ * Permanently Bans the IP address currently used by the player. -+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)} -+ * @param reason Reason for ban -+ * @param source Source of ban, or null for default -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable String source) { -+ return banPlayerIP(reason, null, source); -+ } -+ -+ /** -+ * Bans the IP address currently used by the player. -+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)} -+ * @param reason Reason for Ban -+ * @param expires When to expire the ban -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires) { -+ return banPlayerIP(reason, expires, null); -+ } -+ -+ /** -+ * Bans the IP address currently used by the player. -+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)} -+ * @param reason Reason for Ban -+ * @param expires When to expire the ban -+ * @param source Source of the ban or null for default -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) { -+ return banPlayerIP(reason, expires, source, true); -+ } -+ -+ /** -+ * Bans the IP address currently used by the player. -+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)} -+ * @param reason Reason for Ban -+ * @param expires When to expire the ban -+ * @param source Source of the ban or null for default -+ * @param kickPlayer if the targeted player should be kicked -+ * @return Ban Entry -+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)} -+ */ -+ @Nullable -+ @Deprecated(since = "1.20.4") -+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickPlayer) { -+ org.bukkit.BanEntry banEntry = org.bukkit.Bukkit.getServer().getBanList(org.bukkit.BanList.Type.IP).addBan(getAddress().getAddress().getHostAddress(), reason, expires, source); -+ if (kickPlayer && isOnline()) { -+ getPlayer().kickPlayer(reason); -+ } -+ -+ return banEntry; -+ } - - /** - * Sends an Action Bar message to the client. diff --git a/patches/api/Add-BaseComponent-sendMessage-methods-to-CommandSend.patch b/patches/api/Add-BaseComponent-sendMessage-methods-to-CommandSend.patch deleted file mode 100644 index f3e6d2427f..0000000000 --- a/patches/api/Add-BaseComponent-sendMessage-methods-to-CommandSend.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Tue, 8 Mar 2016 13:05:59 -0800 -Subject: [PATCH] Add BaseComponent sendMessage methods to CommandSender - - -diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/CommandSender.java -+++ b/src/main/java/org/bukkit/command/CommandSender.java -@@ -0,0 +0,0 @@ - package org.bukkit.command; - - import java.util.UUID; -+import net.kyori.adventure.audience.MessageType; -+import net.kyori.adventure.identity.Identity; -+import net.kyori.adventure.text.Component; - import org.bukkit.Server; - import org.bukkit.permissions.Permissible; - import org.jetbrains.annotations.NotNull; -@@ -0,0 +0,0 @@ public interface CommandSender extends net.kyori.adventure.audience.Audience, Pe - default void sendPlainMessage(final @NotNull String message) { - this.sendMessage(net.kyori.adventure.text.Component.text(message)); - } -+ -+ /** -+ * Sends the component to the sender -+ * -+ *

If this sender does not support sending full components then -+ * the component will be sent as legacy text.

-+ * -+ * @param component the component to send -+ * @deprecated use {@link #sendMessage(Identity, Component, MessageType)} instead -+ */ -+ @Deprecated -+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) { -+ this.sendMessage(component.toLegacyText()); -+ } -+ -+ /** -+ * Sends an array of components as a single message to the sender -+ * -+ *

If this sender does not support sending full components then -+ * the components will be sent as legacy text.

-+ * -+ * @param components the components to send -+ * @deprecated use {@link #sendMessage(Identity, Component, MessageType)} instead -+ */ -+ @Deprecated -+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) { -+ this.sendMessage(new net.md_5.bungee.api.chat.TextComponent(components).toLegacyText()); -+ } - // Paper end - } diff --git a/patches/api/Add-BeaconEffectEvent.patch b/patches/api/Add-BeaconEffectEvent.patch deleted file mode 100644 index 93ca07efb8..0000000000 --- a/patches/api/Add-BeaconEffectEvent.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Mon, 29 Feb 2016 18:09:40 -0600 -Subject: [PATCH] Add BeaconEffectEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.bukkit.potion.PotionEffect; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a beacon effect is being applied to a player. -+ */ -+@NullMarked -+public class BeaconEffectEvent extends BlockEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Player player; -+ private final boolean primary; -+ private PotionEffect effect; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public BeaconEffectEvent(final Block block, final PotionEffect effect, final Player player, final boolean primary) { -+ super(block); -+ this.effect = effect; -+ this.player = player; -+ this.primary = primary; -+ } -+ -+ /** -+ * Gets the potion effect being applied. -+ * -+ * @return Potion effect -+ */ -+ public PotionEffect getEffect() { -+ return this.effect; -+ } -+ -+ /** -+ * Sets the potion effect that will be applied. -+ * -+ * @param effect Potion effect -+ */ -+ public void setEffect(final PotionEffect effect) { -+ this.effect = effect; -+ } -+ -+ /** -+ * Gets the player who the potion effect is being applied to. -+ * -+ * @return Affected player -+ */ -+ public Player getPlayer() { -+ return this.player; -+ } -+ -+ /** -+ * Gets whether the effect is a primary beacon effect. -+ * -+ * @return {@code true} if this event represents a primary effect -+ */ -+ public boolean isPrimary() { -+ return this.primary; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-BellRevealRaiderEvent.patch b/patches/api/Add-BellRevealRaiderEvent.patch deleted file mode 100644 index 96a60a09ca..0000000000 --- a/patches/api/Add-BellRevealRaiderEvent.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Wed, 26 May 2021 17:08:57 -0400 -Subject: [PATCH] Add BellRevealRaiderEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Raider; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a {@link Raider} is revealed by a bell. -+ * -+ * @deprecated use {@link org.bukkit.event.block.BellResonateEvent} -+ */ -+@Deprecated(since = "1.19.4") -+public class BellRevealRaiderEvent extends BlockEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Raider raider; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public BellRevealRaiderEvent(@NotNull Block theBlock, @NotNull Raider raider) { -+ super(theBlock); -+ this.raider = raider; -+ } -+ -+ /** -+ * Gets the raider that the bell revealed. -+ * -+ * @return The raider -+ */ -+ @NotNull -+ public Raider getEntity() { -+ return this.raider; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * This does not cancel the particle effects shown on the bell, only the entity. -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-BellRingEvent.patch b/patches/api/Add-BellRingEvent.patch deleted file mode 100644 index 5c2ab07644..0000000000 --- a/patches/api/Add-BellRingEvent.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Eearslya Sleiarion -Date: Mon, 24 Jun 2019 21:27:39 -0700 -Subject: [PATCH] Add BellRingEvent - -Add a new event, BellRingEvent, to trigger whenever a player rings a -village bell. Passes along the bell block and the player who rang it. - -diff --git a/src/main/java/io/papermc/paper/event/block/BellRingEvent.java b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockFace; -+import org.bukkit.entity.Entity; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when a bell is rung. -+ * -+ * @deprecated use {@link org.bukkit.event.block.BellRingEvent} -+ */ -+@Deprecated(since = "1.19.4") -+public class BellRingEvent extends org.bukkit.event.block.BellRingEvent { -+ -+ @ApiStatus.Internal -+ public BellRingEvent(@NotNull Block block, @NotNull BlockFace direction, @Nullable Entity entity) { -+ super(block, direction, entity); -+ } -+} diff --git a/patches/api/Add-Block-isValidTool.patch b/patches/api/Add-Block-isValidTool.patch deleted file mode 100644 index b5f9bf8d11..0000000000 --- a/patches/api/Add-Block-isValidTool.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 6 Jul 2020 12:44:23 -0700 -Subject: [PATCH] Add Block#isValidTool - -Deprecated for removal - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - } - // Paper end - -+ // Paper start - add isValidTool -+ /** -+ * Checks if the itemstack is a valid tool to -+ * break the block with -+ * -+ * @param itemStack The (tool) itemstack -+ * @return whether the block will drop items -+ * @deprecated partially replaced by {@link Block#isPreferredTool(ItemStack)} -+ */ -+ @Deprecated(since = "1.21", forRemoval = true) // Paper -+ boolean isValidTool(@NotNull ItemStack itemStack); -+ // Paper end - add isValidTool -+ - /** - * Gets the Location of the block - * diff --git a/patches/api/Add-BlockBreakBlockEvent.patch b/patches/api/Add-BlockBreakBlockEvent.patch deleted file mode 100644 index 20c95a9c64..0000000000 --- a/patches/api/Add-BlockBreakBlockEvent.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 3 Jan 2021 17:58:25 -0800 -Subject: [PATCH] Add BlockBreakBlockEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import java.util.List; -+import org.bukkit.block.Block; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockExpEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a block forces another block to break and drop items. -+ *

-+ * Currently called for piston's and liquid flows. -+ */ -+@NullMarked -+public class BlockBreakBlockEvent extends BlockExpEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block source; -+ private final List drops; -+ -+ @ApiStatus.Internal -+ public BlockBreakBlockEvent(final Block block, final Block source, final List drops) { -+ super(block, 0); -+ this.source = source; -+ this.drops = drops; -+ } -+ -+ /** -+ * Gets a mutable list of drops for this event -+ * -+ * @return the drops -+ */ -+ public List getDrops() { -+ return this.drops; -+ } -+ -+ /** -+ * Gets the block that cause this (e.g. a piston, or adjacent liquid) -+ * -+ * @return the source -+ */ -+ public Block getSource() { -+ return this.source; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-BlockBreakProgressUpdateEvent.patch b/patches/api/Add-BlockBreakProgressUpdateEvent.patch deleted file mode 100644 index 93a8f66af6..0000000000 --- a/patches/api/Add-BlockBreakProgressUpdateEvent.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Badbird5907 <50347938+Badbird5907@users.noreply.github.com> -Date: Mon, 4 Mar 2024 22:18:33 -0500 -Subject: [PATCH] Add BlockBreakProgressUpdateEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when the progress of a block break is updated. -+ */ -+@NullMarked -+public class BlockBreakProgressUpdateEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final float progress; -+ private final Entity entity; -+ -+ @ApiStatus.Internal -+ public BlockBreakProgressUpdateEvent(final Block block, final float progress, final Entity entity) { -+ super(block); -+ this.progress = progress; -+ this.entity = entity; -+ } -+ -+ /** -+ * The progress of the block break -+ *

-+ * The progress ranges from 0.0 - 1.0, where 0 is no damage and -+ * 1.0 is the most damaged -+ * -+ * @return The progress of the block break -+ */ -+ public float getProgress() { -+ return this.progress; -+ } -+ -+ /** -+ * The entity breaking the block. -+ * -+ * @return The entity breaking the block -+ */ -+ public Entity getEntity() { -+ return this.entity; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-BlockFailedDispenseEvent.patch b/patches/api/Add-BlockFailedDispenseEvent.patch deleted file mode 100644 index 1be59e949f..0000000000 --- a/patches/api/Add-BlockFailedDispenseEvent.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TheViperShow <29604693+TheViperShow@users.noreply.github.com> -Date: Wed, 22 Apr 2020 09:40:23 +0200 -Subject: [PATCH] Add BlockFailedDispenseEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a block tries to dispense an item, but its inventory is empty. -+ */ -+@NullMarked -+public class BlockFailedDispenseEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean shouldPlayEffect = true; -+ -+ @ApiStatus.Internal -+ public BlockFailedDispenseEvent(final Block theBlock) { -+ super(theBlock); -+ } -+ -+ /** -+ * @return if the effect should be played -+ */ -+ public boolean shouldPlayEffect() { -+ return this.shouldPlayEffect; -+ } -+ -+ /** -+ * Sets if the effect for empty dispensers should be played -+ * -+ * @param playEffect if the effect should be played -+ */ -+ public void shouldPlayEffect(final boolean playEffect) { -+ this.shouldPlayEffect = playEffect; -+ } -+ -+ /** -+ * @return {@link #shouldPlayEffect()} -+ */ -+ @Override -+ public boolean callEvent() { -+ super.callEvent(); -+ return this.shouldPlayEffect(); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-BlockLockCheckEvent.patch b/patches/api/Add-BlockLockCheckEvent.patch deleted file mode 100644 index 5c928a4ab7..0000000000 --- a/patches/api/Add-BlockLockCheckEvent.patch +++ /dev/null @@ -1,242 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 21 May 2022 20:59:56 -0700 -Subject: [PATCH] Add BlockLockCheckEvent - - -diff --git a/src/main/java/io/papermc/paper/block/LockableTileState.java b/src/main/java/io/papermc/paper/block/LockableTileState.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/LockableTileState.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.block; -+ -+import org.bukkit.Nameable; -+import org.bukkit.block.Lockable; -+import org.bukkit.block.TileState; -+ -+/** -+ * Interface for tile entities that are lockable. -+ */ -+public interface LockableTileState extends TileState, Lockable, Nameable { -+} -diff --git a/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import com.google.common.base.Preconditions; -+import io.papermc.paper.block.LockableTileState; -+import java.util.Objects; -+import net.kyori.adventure.sound.Sound; -+import net.kyori.adventure.text.Component; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockState; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when the server tries to check the lock on a lockable block entity. -+ *
-+ * See {@link #setResult(Result)} to change behavior -+ */ -+@NullMarked -+public class BlockLockCheckEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Player player; -+ private @Nullable Component lockedMessage; -+ private @Nullable Sound lockedSound; -+ private @Nullable ItemStack itemStack; -+ private Result result = Result.DEFAULT; -+ -+ @ApiStatus.Internal -+ public BlockLockCheckEvent(final Block block, final Player player, final Component lockedMessage, final Sound lockedSound) { -+ super(block); -+ this.player = player; -+ this.lockedMessage = lockedMessage; -+ this.lockedSound = lockedSound; -+ } -+ -+ /** -+ * Gets the snapshot {@link LockableTileState} of the block entity -+ * whose lock is being checked. -+ * -+ * @return the snapshot block state. -+ */ -+ public LockableTileState getBlockState() { -+ final BlockState blockState = this.getBlock().getState(); -+ Preconditions.checkState(blockState instanceof LockableTileState, "Block state of lock-checked block is no longer a lockable tile state!"); -+ return (LockableTileState) blockState; -+ } -+ -+ /** -+ * Get the player involved this lock check. -+ * -+ * @return the player -+ */ -+ public Player getPlayer() { -+ return this.player; -+ } -+ -+ /** -+ * Gets the itemstack that will be used as the key itemstack. Initially -+ * this will be the item in the player's main hand but an override can be set -+ * with {@link #setKeyItem(ItemStack)}. Use {@link #isUsingCustomKeyItemStack()} -+ * to check if a custom key stack has been set. -+ * -+ * @return the item being used as the key item -+ * @see #isUsingCustomKeyItemStack() -+ */ -+ public ItemStack getKeyItem() { -+ return Objects.requireNonNullElseGet(this.itemStack, this.player.getInventory()::getItemInMainHand); -+ } -+ -+ /** -+ * Sets the itemstack that will be used as the key item. -+ * -+ * @param stack the stack to use as a key -+ * @see #resetKeyItem() to clear a custom key item -+ */ -+ public void setKeyItem(final ItemStack stack) { -+ Preconditions.checkArgument(stack != null, "stack cannot be null"); -+ this.itemStack = stack; -+ } -+ -+ /** -+ * Reset the key stack to the default (the player's main hand). -+ */ -+ public void resetKeyItem() { -+ this.itemStack = null; -+ } -+ -+ /** -+ * Checks if a custom key stack has been set. -+ * -+ * @return {@code true} if a custom key itemstack has been set -+ */ -+ public boolean isUsingCustomKeyItemStack() { -+ return this.itemStack != null; -+ } -+ -+ /** -+ * Gets the result of this event. -+ * -+ * @return the result -+ * @see #setResult(Result) -+ */ -+ public Result getResult() { -+ return this.result; -+ } -+ -+ /** -+ * Gets the result of this event. {@link Result#DEFAULT} is the default -+ * allowing the vanilla logic to check the lock of this block. Set to {@link Result#ALLOW} -+ * or {@link Result#DENY} to override that behavior. -+ *

-+ * Setting this to {@link Result#ALLOW} bypasses the spectator check. -+ * -+ * @param result the result of this event -+ */ -+ public void setResult(final Result result) { -+ this.result = result; -+ } -+ -+ /** -+ * Shorthand method to set the {@link #getResult()} to {@link Result#DENY}, -+ * the locked message and locked sound. -+ * -+ * @param lockedMessage the message to show if locked (or {@code null} for none) -+ * @param lockedSound the sound to play if locked (or {@code null} for none) -+ */ -+ public void denyWithMessageAndSound(final @Nullable Component lockedMessage, final @Nullable Sound lockedSound) { -+ this.result = Result.DENY; -+ this.lockedMessage = lockedMessage; -+ this.lockedSound = lockedSound; -+ } -+ -+ /** -+ * Gets the locked message that will be sent if the -+ * player cannot open the block. -+ * -+ * @return the locked message (or {@code null} if none) -+ */ -+ public @Nullable Component getLockedMessage() { -+ return this.lockedMessage; -+ } -+ -+ /** -+ * Sets the locked message that will be sent if the -+ * player cannot open the block. -+ * -+ * @param lockedMessage the locked message (or {@code null} for none) -+ */ -+ public void setLockedMessage(final @Nullable Component lockedMessage) { -+ this.lockedMessage = lockedMessage; -+ } -+ -+ /** -+ * Gets the locked sound that will play if the -+ * player cannot open the block. -+ * -+ * @return the locked sound (or {@code null} if none) -+ */ -+ public @Nullable Sound getLockedSound() { -+ return this.lockedSound; -+ } -+ -+ /** -+ * Sets the locked sound that will play if the -+ * player cannot open the block. -+ * -+ * @param lockedSound the locked sound (or {@code null} for none) -+ */ -+ public void setLockedSound(final @Nullable Sound lockedSound) { -+ this.lockedSound = lockedSound; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/block/Beacon.java b/src/main/java/org/bukkit/block/Beacon.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Beacon.java -+++ b/src/main/java/org/bukkit/block/Beacon.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a captured state of a beacon. - */ --public interface Beacon extends TileState, Lockable, Nameable { -+public interface Beacon extends io.papermc.paper.block.LockableTileState { // Paper - - /** - * Returns the list of players within the beacon's range of effect. -diff --git a/src/main/java/org/bukkit/block/Container.java b/src/main/java/org/bukkit/block/Container.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Container.java -+++ b/src/main/java/org/bukkit/block/Container.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a captured state of a container block. - */ --public interface Container extends TileState, BlockInventoryHolder, Lockable, Nameable { -+public interface Container extends io.papermc.paper.block.LockableTileState, BlockInventoryHolder { // Paper - - /** - * Gets the inventory of the block represented by this block state. diff --git a/patches/api/Add-BlockPreDispenseEvent.patch b/patches/api/Add-BlockPreDispenseEvent.patch deleted file mode 100644 index cfef2a3585..0000000000 --- a/patches/api/Add-BlockPreDispenseEvent.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Madeline Miller -Date: Sun, 17 Jan 2021 13:15:54 +1000 -Subject: [PATCH] Add BlockPreDispenseEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+public class BlockPreDispenseEvent extends BlockEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack itemStack; -+ private final int slot; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public BlockPreDispenseEvent(final Block block, final ItemStack itemStack, final int slot) { -+ super(block); -+ this.itemStack = itemStack; -+ this.slot = slot; -+ } -+ -+ /** -+ * Gets the {@link ItemStack} to be dispensed. -+ * -+ * @return The item to be dispensed -+ */ -+ public ItemStack getItemStack() { -+ return this.itemStack; -+ } -+ -+ /** -+ * Gets the inventory slot of the dispenser to dispense from. -+ * -+ * @return The inventory slot -+ */ -+ public int getSlot() { -+ return this.slot; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-BlockSoundGroup-interface.patch b/patches/api/Add-BlockSoundGroup-interface.patch deleted file mode 100644 index b5a20d47cd..0000000000 --- a/patches/api/Add-BlockSoundGroup-interface.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: simpleauthority -Date: Tue, 28 May 2019 03:41:28 -0700 -Subject: [PATCH] Add BlockSoundGroup interface - -This PR adds the getSoundGroup() method in Block which returns a BlockSoundGroup - -diff --git a/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.block; -+ -+import org.bukkit.Sound; -+import org.bukkit.block.Block; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents the sounds that a {@link Block} makes in certain situations -+ *

-+ * The sound group includes break, step, place, hit, and fall sounds. -+ * @deprecated use {@link org.bukkit.SoundGroup} -+ */ -+@Deprecated(forRemoval = true, since = "1.18.2") -+public interface BlockSoundGroup { -+ /** -+ * Gets the sound that plays when breaking this block -+ * -+ * @return The break sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getBreakSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ Sound getBreakSound(); -+ -+ /** -+ * Gets the sound that plays when stepping on this block -+ * -+ * @return The step sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getStepSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ Sound getStepSound(); -+ -+ /** -+ * Gets the sound that plays when placing this block -+ * -+ * @return The place sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getPlaceSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ Sound getPlaceSound(); -+ -+ /** -+ * Gets the sound that plays when hitting this block -+ * -+ * @return The hit sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getHitSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ Sound getHitSound(); -+ -+ /** -+ * Gets the sound that plays when this block falls -+ * -+ * @return The fall sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getFallSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ Sound getFallSound(); -+} -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable { - * @return true if the block data can be placed here - */ - boolean canPlace(@NotNull BlockData data); -+ -+ // Paper start -+ /** -+ * Gets the {@link com.destroystokyo.paper.block.BlockSoundGroup} for this block. -+ *

-+ * This object contains the block, step, place, hit, and fall sounds. -+ * -+ * @return the sound group for this block -+ * @deprecated use {@link #getBlockSoundGroup()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup(); -+ -+ /** -+ * Gets the {@link org.bukkit.SoundGroup} for this block. -+ * -+ * @return the sound group for this block -+ */ -+ @NotNull org.bukkit.SoundGroup getBlockSoundGroup(); -+ // Paper end - } diff --git a/patches/api/Add-BlockStateMeta-clearBlockState.patch b/patches/api/Add-BlockStateMeta-clearBlockState.patch deleted file mode 100644 index f8ef3cc096..0000000000 --- a/patches/api/Add-BlockStateMeta-clearBlockState.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 11 Jan 2024 12:41:54 -0800 -Subject: [PATCH] Add BlockStateMeta#clearBlockState - - -diff --git a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java -@@ -0,0 +0,0 @@ public interface BlockStateMeta extends ItemMeta { - */ - boolean hasBlockState(); - -+ // Paper start - add method to clear block state -+ /** -+ * Clears the block state currently attached to this item. -+ */ -+ void clearBlockState(); -+ // Paper end - add method to clear block state -+ - /** - * Returns the currently attached block state for this - * item or creates a new one if one doesn't exist. diff --git a/patches/api/Add-CartographyItemEvent.patch b/patches/api/Add-CartographyItemEvent.patch deleted file mode 100644 index 50602a7d2c..0000000000 --- a/patches/api/Add-CartographyItemEvent.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Janet Blackquill -Date: Sun, 7 Apr 2024 16:51:04 -0400 -Subject: [PATCH] Add CartographyItemEvent - -Similar to SmithItemEvent, but for cartography tables. - -diff --git a/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.event.inventory.ClickType; -+import org.bukkit.event.inventory.InventoryAction; -+import org.bukkit.event.inventory.InventoryClickEvent; -+import org.bukkit.event.inventory.InventoryType; -+import org.bukkit.inventory.CartographyInventory; -+import org.bukkit.inventory.InventoryView; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when the recipe of an Item is completed inside a cartography table. -+ */ -+@NullMarked -+public class CartographyItemEvent extends InventoryClickEvent { -+ -+ @ApiStatus.Internal -+ public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action) { -+ super(view, type, slot, click, action); -+ } -+ -+ @ApiStatus.Internal -+ public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action, final int key) { -+ super(view, type, slot, click, action, key); -+ } -+ -+ @Override -+ public CartographyInventory getInventory() { -+ return (CartographyInventory) super.getInventory(); -+ } -+} diff --git a/patches/api/Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/api/Add-CompostItemEvent-and-EntityCompostItemEvent.patch deleted file mode 100644 index 912fbf2570..0000000000 --- a/patches/api/Add-CompostItemEvent-and-EntityCompostItemEvent.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Noah van der Aa -Date: Sat, 7 Aug 2021 15:11:27 +0200 -Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java b/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.bukkit.event.inventory.InventoryMoveItemEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when an item is about to be composted by a hopper. -+ * To prevent hoppers from moving items into composters, cancel the {@link InventoryMoveItemEvent}. -+ */ -+@NullMarked -+public class CompostItemEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack item; -+ private boolean willRaiseLevel; -+ -+ @ApiStatus.Internal -+ public CompostItemEvent(final Block composter, final ItemStack item, final boolean willRaiseLevel) { -+ super(composter); -+ this.item = item; -+ this.willRaiseLevel = willRaiseLevel; -+ } -+ -+ /** -+ * Gets the item that was used on the composter. -+ * -+ * @return the item -+ */ -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets whether the composter will rise a level. -+ * -+ * @return {@code true} if successful -+ */ -+ public boolean willRaiseLevel() { -+ return this.willRaiseLevel; -+ } -+ -+ /** -+ * Sets whether the composter will rise a level. -+ * -+ * @param willRaiseLevel {@code true} if the composter should rise a level -+ */ -+ public void setWillRaiseLevel(final boolean willRaiseLevel) { -+ this.willRaiseLevel = willRaiseLevel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+} -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import io.papermc.paper.event.block.CompostItemEvent; -+import org.bukkit.block.Block; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when an item is about to be composted by an entity. -+ */ -+@NullMarked -+public class EntityCompostItemEvent extends CompostItemEvent implements Cancellable { -+ -+ private final Entity entity; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityCompostItemEvent(final Entity entity, final Block composter, final ItemStack item, final boolean willRaiseLevel) { -+ super(composter, item, willRaiseLevel); -+ this.entity = entity; -+ } -+ -+ /** -+ * Gets the entity that interacted with the composter. -+ * -+ * @return the entity that composted an item. -+ */ -+ public Entity getEntity() { -+ return this.entity; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+} diff --git a/patches/api/Add-Destroy-Speed-API.patch b/patches/api/Add-Destroy-Speed-API.patch deleted file mode 100644 index add801eee5..0000000000 --- a/patches/api/Add-Destroy-Speed-API.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ineusia -Date: Mon, 26 Oct 2020 11:37:48 -0500 -Subject: [PATCH] Add Destroy Speed API - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - @Deprecated(forRemoval = true) - String getTranslationKey(); - // Paper end -+ -+ // Paper start - destroy speed API -+ /** -+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ *

-+ * Default value is 1.0 -+ * -+ * @param itemStack {@link ItemStack} used to mine this Block -+ * @return the speed that this Block will be mined by the given {@link ItemStack} -+ */ -+ default float getDestroySpeed(final @NotNull ItemStack itemStack) { -+ return this.getBlockData().getDestroySpeed(itemStack); -+ } -+ -+ /** -+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ *

-+ * Default value is 1.0 -+ * -+ * @param itemStack {@link ItemStack} used to mine this Block -+ * @param considerEnchants true to look at enchants on the itemstack -+ * @return the speed that this Block will be mined by the given {@link ItemStack} -+ */ -+ default float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants) { -+ return this.getBlockData().getDestroySpeed(itemStack, considerEnchants); -+ } -+ // Paper end - destroy speed API - } -diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/BlockData.java -+++ b/src/main/java/org/bukkit/block/data/BlockData.java -@@ -0,0 +0,0 @@ public interface BlockData extends Cloneable { - @NotNull - @ApiStatus.Experimental - BlockState createBlockState(); -+ -+ // Paper start - destroy speed API -+ /** -+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ *

-+ * Default value is 1.0 -+ * -+ * @param itemStack {@link ItemStack} used to mine this Block -+ * @return the speed that this Block will be mined by the given {@link ItemStack} -+ * @apiNote this method assumes default player state and hence, e.g., does not take into account changed -+ * player attributes or potion effects. -+ */ -+ default float getDestroySpeed(final @NotNull ItemStack itemStack) { -+ return this.getDestroySpeed(itemStack, false); -+ } -+ -+ /** -+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ *

-+ * Default value is 1.0 -+ * -+ * @param itemStack {@link ItemStack} used to mine this Block -+ * @param considerEnchants true to look at enchants on the itemstack -+ * @return the speed that this Block will be mined by the given {@link ItemStack} -+ * @apiNote this method assumes default player state and hence, e.g., does not take into account changed -+ * player attributes or potion effects. -+ */ -+ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants); -+ // Paper end - destroy speed API - } diff --git a/patches/api/Add-ElderGuardianAppearanceEvent.patch b/patches/api/Add-ElderGuardianAppearanceEvent.patch deleted file mode 100644 index 73c4b1f7c0..0000000000 --- a/patches/api/Add-ElderGuardianAppearanceEvent.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Fri, 19 Mar 2021 23:39:21 -0400 -Subject: [PATCH] Add ElderGuardianAppearanceEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.ElderGuardian; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Is called when an {@link ElderGuardian} appears in front of a {@link Player}. -+ */ -+@NullMarked -+public class ElderGuardianAppearanceEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Player affectedPlayer; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public ElderGuardianAppearanceEvent(final ElderGuardian guardian, final Player affectedPlayer) { -+ super(guardian); -+ this.affectedPlayer = affectedPlayer; -+ } -+ -+ /** -+ * Get the player affected by the guardian appearance. -+ * -+ * @return Player affected by the appearance -+ */ -+ public Player getAffectedPlayer() { -+ return this.affectedPlayer; -+ } -+ -+ /** -+ * The elder guardian playing the effect. -+ * -+ * @return The elder guardian -+ */ -+ @Override -+ public ElderGuardian getEntity() { -+ return (ElderGuardian) super.getEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-Entity-Body-Yaw-API.patch b/patches/api/Add-Entity-Body-Yaw-API.patch deleted file mode 100644 index b705aa316b..0000000000 --- a/patches/api/Add-Entity-Body-Yaw-API.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TheTuso -Date: Thu, 2 Feb 2023 16:40:11 +0100 -Subject: [PATCH] Add Entity Body Yaw API - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - * @return true if in powdered snow. - */ - boolean isInPowderedSnow(); -+ -+ /** -+ * Gets the x-coordinate of this entity -+ * -+ * @return x-coordinate -+ */ -+ double getX(); -+ -+ /** -+ * Gets the y-coordinate of this entity -+ * -+ * @return y-coordinate -+ */ -+ double getY(); -+ -+ /** -+ * Gets the z-coordinate of this entity -+ * -+ * @return z-coordinate -+ */ -+ double getZ(); -+ -+ /** -+ * Gets this entity's pitch -+ * -+ * @see Location#getPitch() -+ * @return the entity's pitch -+ */ -+ float getPitch(); -+ -+ /** -+ * Gets this entity's yaw -+ * -+ * @see Location#getYaw() -+ * @return the entity's yaw -+ */ -+ float getYaw(); - // Paper end - - // Paper start - Collision API -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); - // Paper end - ItemStack damage API -+ -+ // Paper start - body yaw API -+ /** -+ * Gets entity body yaw -+ * -+ * @return entity body yaw -+ * @see Location#getYaw() -+ */ -+ float getBodyYaw(); -+ -+ /** -+ * Sets entity body yaw -+ * -+ * @param bodyYaw new entity body yaw -+ * @see Location#setYaw(float) -+ */ -+ void setBodyYaw(float bodyYaw); -+ // Paper end - body yaw API - } diff --git a/patches/api/Add-EntityBlockStorage-clearEntities.patch b/patches/api/Add-EntityBlockStorage-clearEntities.patch deleted file mode 100644 index 89b53d6e3d..0000000000 --- a/patches/api/Add-EntityBlockStorage-clearEntities.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Mon, 5 Apr 2021 18:12:06 -0400 -Subject: [PATCH] Add EntityBlockStorage#clearEntities() - - -diff --git a/src/main/java/org/bukkit/block/EntityBlockStorage.java b/src/main/java/org/bukkit/block/EntityBlockStorage.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/EntityBlockStorage.java -+++ b/src/main/java/org/bukkit/block/EntityBlockStorage.java -@@ -0,0 +0,0 @@ public interface EntityBlockStorage extends TileState { - * @param entity Entity to add to the block - */ - void addEntity(@NotNull T entity); -+ -+ // Paper start - Add EntityBlockStorage clearEntities -+ /** -+ * Clear all currently stored entities in the block. -+ */ -+ void clearEntities(); -+ // Paper end - } diff --git a/patches/api/Add-EntityDyeEvent-and-CollarColorable-interface.patch b/patches/api/Add-EntityDyeEvent-and-CollarColorable-interface.patch deleted file mode 100644 index 5317e72e24..0000000000 --- a/patches/api/Add-EntityDyeEvent-and-CollarColorable-interface.patch +++ /dev/null @@ -1,270 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 18 Mar 2022 21:16:38 -0700 -Subject: [PATCH] Add EntityDyeEvent and CollarColorable interface - - -diff --git a/src/main/java/io/papermc/paper/entity/CollarColorable.java b/src/main/java/io/papermc/paper/entity/CollarColorable.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/CollarColorable.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.entity; -+ -+import org.bukkit.DyeColor; -+import org.bukkit.entity.LivingEntity; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Entities that can have their collars colored. -+ */ -+@NullMarked -+public interface CollarColorable extends LivingEntity { -+ -+ /** -+ * Get the collar color of this entity -+ * -+ * @return the color of the collar -+ */ -+ DyeColor getCollarColor(); -+ -+ /** -+ * Set the collar color of this entity -+ * -+ * @param color the color to apply -+ */ -+ void setCollarColor(DyeColor color); -+} -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.DyeColor; -+import org.bukkit.entity.Cat; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.entity.Sheep; -+import org.bukkit.entity.Wolf; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when an entity is dyed. Currently, this is called for {@link Sheep} -+ * being dyed, and {@link Wolf}/{@link Cat} collars being dyed. -+ */ -+@NullMarked -+public class EntityDyeEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final @Nullable Player player; -+ private DyeColor dyeColor; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityDyeEvent(final Entity entity, final DyeColor dyeColor, final @Nullable Player player) { -+ super(entity); -+ this.dyeColor = dyeColor; -+ this.player = player; -+ } -+ -+ /** -+ * Gets the DyeColor the entity is being dyed -+ * -+ * @return the DyeColor the entity is being dyed -+ */ -+ public DyeColor getColor() { -+ return this.dyeColor; -+ } -+ -+ /** -+ * Sets the DyeColor the entity is being dyed -+ * -+ * @param dyeColor the DyeColor the entity will be dyed -+ */ -+ public void setColor(final DyeColor dyeColor) { -+ this.dyeColor = dyeColor; -+ } -+ -+ /** -+ * Returns the player dyeing the entity, if available. -+ * -+ * @return player or {@code null} -+ */ -+ public @Nullable Player getPlayer() { -+ return this.player; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Cat.java -+++ b/src/main/java/org/bukkit/entity/Cat.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Meow. - */ --public interface Cat extends Tameable, Sittable { -+public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable - - /** - * Gets the current type of this cat. -@@ -0,0 +0,0 @@ public interface Cat extends Tameable, Sittable { - * @return the color of the collar - */ - @NotNull -+ @Override // Paper - public DyeColor getCollarColor(); - - /** -@@ -0,0 +0,0 @@ public interface Cat extends Tameable, Sittable { - * - * @param color the color to apply - */ -+ @Override // Paper - public void setCollarColor(@NotNull DyeColor color); - - /** -diff --git a/src/main/java/org/bukkit/entity/Wolf.java b/src/main/java/org/bukkit/entity/Wolf.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Wolf.java -+++ b/src/main/java/org/bukkit/entity/Wolf.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a Wolf - */ --public interface Wolf extends Tameable, Sittable { -+public interface Wolf extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable - - /** - * Checks if this wolf is angry -@@ -0,0 +0,0 @@ public interface Wolf extends Tameable, Sittable { - * @return the color of the collar - */ - @NotNull -+ @Override // Paper - public DyeColor getCollarColor(); - - /** -@@ -0,0 +0,0 @@ public interface Wolf extends Tameable, Sittable { - * - * @param color the color to apply - */ -+ @Override // Paper - public void setCollarColor(@NotNull DyeColor color); - - /** -diff --git a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java -+++ b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Called when a sheep's wool is dyed - */ --public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { -- private static final HandlerList handlers = new HandlerList(); -- private boolean cancel; -- private DyeColor color; -- private final Player player; -+public class SheepDyeWoolEvent extends io.papermc.paper.event.entity.EntityDyeEvent implements Cancellable { -+ // Paper - move everything to superclass - - @Deprecated(since = "1.17.1") - public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color) { -@@ -0,0 +0,0 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { - } - - public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color, @Nullable Player player) { -- super(sheep); -- this.cancel = false; -- this.color = color; -- this.player = player; -- } -- -- @Override -- public boolean isCancelled() { -- return cancel; -- } -- -- @Override -- public void setCancelled(boolean cancel) { -- this.cancel = cancel; -+ super(sheep, color, player); // Paper - } - - @NotNull -@@ -0,0 +0,0 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { - public Sheep getEntity() { - return (Sheep) entity; - } -- -- /** -- * Returns the player dyeing the sheep, if available. -- * -- * @return player or null -- */ -- @Nullable -- public Player getPlayer() { -- return player; -- } -- -- /** -- * Gets the DyeColor the sheep is being dyed -- * -- * @return the DyeColor the sheep is being dyed -- */ -- @NotNull -- public DyeColor getColor() { -- return color; -- } -- -- /** -- * Sets the DyeColor the sheep is being dyed -- * -- * @param color the DyeColor the sheep will be dyed -- */ -- public void setColor(@NotNull DyeColor color) { -- this.color = color; -- } -- -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -- - } diff --git a/patches/api/Add-EntityFertilizeEggEvent.patch b/patches/api/Add-EntityFertilizeEggEvent.patch deleted file mode 100644 index 6b1faa8b1a..0000000000 --- a/patches/api/Add-EntityFertilizeEggEvent.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> -Date: Fri, 24 Jun 2022 11:56:32 +0200 -Subject: [PATCH] Add EntityFertilizeEggEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.Material; -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityBreedEvent; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when two entities mate and the mating process results in a fertilization. -+ * Fertilization differs from normal breeding, as represented by the {@link EntityBreedEvent}, as -+ * it does not result in the immediate creation of the child entity in the world. -+ *

-+ * An example of this would be: -+ *

    -+ *
  • A frog being marked as "is_pregnant" and laying {@link Material#FROGSPAWN} later.
  • -+ *
  • Sniffers producing the {@link Material#SNIFFER_EGG} item, which needs to be placed before it can begin to hatch.
  • -+ *
  • A turtle being marked with "HasEgg" and laying a {@link Material#TURTLE_EGG} later.
  • -+ *
-+ *

-+ * The event hence only exposes the two parent entities in the fertilization process and cannot provide the child entity, as it will only exist at a later point in time. -+ */ -+@NullMarked -+public class EntityFertilizeEggEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final LivingEntity mother; -+ private final LivingEntity father; -+ private final @Nullable Player breeder; -+ private final @Nullable ItemStack bredWith; -+ private int experience; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityFertilizeEggEvent(final LivingEntity mother, final LivingEntity father, final @Nullable Player breeder, final @Nullable ItemStack bredWith, final int experience) { -+ super(mother); -+ this.mother = mother; -+ this.father = father; -+ this.breeder = breeder; -+ this.bredWith = bredWith; -+ this.experience = experience; -+ } -+ -+ @Override -+ public LivingEntity getEntity() { -+ return (LivingEntity) super.getEntity(); -+ } -+ -+ /** -+ * Provides the entity in the fertilization process that will eventually be responsible for "creating" offspring, -+ * may that be by setting a block that later hatches or dropping an egg that has to be placed. -+ * -+ * @return The "mother" entity. -+ */ -+ public LivingEntity getMother() { -+ return this.mother; -+ } -+ -+ /** -+ * Provides the "father" entity in the fertilization process that is not responsible for initiating the offspring -+ * creation. -+ * -+ * @return the other parent -+ */ -+ public LivingEntity getFather() { -+ return this.father; -+ } -+ -+ /** -+ * Gets the Entity responsible for fertilization. Breeder is {@code null} for spontaneous -+ * conception. -+ * -+ * @return The Entity who initiated fertilization. -+ */ -+ public @Nullable Player getBreeder() { -+ return this.breeder; -+ } -+ -+ /** -+ * The ItemStack that was used to initiate fertilization, if present. -+ * -+ * @return ItemStack used to initiate fertilization. -+ */ -+ public @Nullable ItemStack getBredWith() { -+ return this.bredWith; -+ } -+ -+ /** -+ * Get the amount of experience granted by fertilization. -+ * -+ * @return experience amount -+ */ -+ public int getExperience() { -+ return this.experience; -+ } -+ -+ /** -+ * Set the amount of experience granted by fertilization. -+ * If the amount is negative or zero, no experience will be dropped. -+ * -+ * @param experience experience amount -+ */ -+ public void setExperience(final int experience) { -+ this.experience = experience; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-EntityInsideBlockEvent.patch b/patches/api/Add-EntityInsideBlockEvent.patch deleted file mode 100644 index 68a77f1179..0000000000 --- a/patches/api/Add-EntityInsideBlockEvent.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 8 May 2021 18:02:06 -0700 -Subject: [PATCH] Add EntityInsideBlockEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when an entity enters the hitbox of a block. -+ * Only called for blocks that react when an entity is inside. -+ * If cancelled, any action that would have resulted from that entity -+ * being in the block will not happen (such as extinguishing an entity in a cauldron). -+ *

-+ * Blocks this is currently called for: -+ *

    -+ *
  • Big dripleaf
  • -+ *
  • Bubble column
  • -+ *
  • Buttons
  • -+ *
  • Cactus
  • -+ *
  • Campfire
  • -+ *
  • Cauldron
  • -+ *
  • Crops
  • -+ *
  • End Gateway
  • -+ *
  • Ender Portal
  • -+ *
  • Eye blossom
  • -+ *
  • Fires
  • -+ *
  • Frogspawn
  • -+ *
  • Honey
  • -+ *
  • Hopper
  • -+ *
  • Detector rails
  • -+ *
  • Nether portals
  • -+ *
  • Pitcher crop
  • -+ *
  • Powdered snow
  • -+ *
  • Pressure plates
  • -+ *
  • Sweet berry bush
  • -+ *
  • Tripwire
  • -+ *
  • Waterlily
  • -+ *
  • Web
  • -+ *
  • Wither rose
  • -+ *
-+ */ -+@NullMarked -+public class EntityInsideBlockEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block block; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityInsideBlockEvent(final Entity entity, final Block block) { -+ super(entity); -+ this.block = block; -+ } -+ -+ /** -+ * Gets the block. -+ * -+ * @return the block -+ */ -+ public Block getBlock() { -+ return this.block; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-EntityLoadCrossbowEvent.patch b/patches/api/Add-EntityLoadCrossbowEvent.patch deleted file mode 100644 index 6f7e607830..0000000000 --- a/patches/api/Add-EntityLoadCrossbowEvent.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Wed, 7 Oct 2020 12:04:17 -0400 -Subject: [PATCH] Add EntityLoadCrossbowEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.inventory.EquipmentSlot; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a LivingEntity loads a crossbow with a projectile. -+ */ -+@NullMarked -+public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack crossbow; -+ private final EquipmentSlot hand; -+ -+ private boolean consumeItem = true; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityLoadCrossbowEvent(final LivingEntity entity, final ItemStack crossbow, final EquipmentSlot hand) { -+ super(entity); -+ this.crossbow = crossbow; -+ this.hand = hand; -+ } -+ -+ @Override -+ public LivingEntity getEntity() { -+ return (LivingEntity) super.getEntity(); -+ } -+ -+ /** -+ * Gets the crossbow {@link ItemStack} being loaded. -+ * -+ * @return the crossbow involved in this event -+ */ -+ public ItemStack getCrossbow() { -+ return this.crossbow; -+ } -+ -+ /** -+ * Gets the hand from which the crossbow was loaded. -+ * -+ * @return the hand -+ */ -+ public EquipmentSlot getHand() { -+ return this.hand; -+ } -+ -+ /** -+ * @return should the itemstack be consumed -+ */ -+ public boolean shouldConsumeItem() { -+ return this.consumeItem; -+ } -+ -+ /** -+ * @param consume should the item be consumed -+ */ -+ public void setConsumeItem(final boolean consume) { -+ this.consumeItem = consume; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Set whether to cancel the crossbow being loaded. If canceled, the -+ * projectile that would be loaded into the crossbow will not be consumed. -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-EntityPortalReadyEvent.patch b/patches/api/Add-EntityPortalReadyEvent.patch deleted file mode 100644 index b3e363a1a6..0000000000 --- a/patches/api/Add-EntityPortalReadyEvent.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 12 May 2021 04:30:53 -0700 -Subject: [PATCH] Add EntityPortalReadyEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.PortalType; -+import org.bukkit.World; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.event.entity.EntityPortalEvent; -+import org.bukkit.event.player.PlayerPortalEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when an entity is ready to be teleported by a plugin. -+ * Currently, this is only called after the required -+ * ticks have passed for a Nether Portal. -+ *

-+ * Cancelling this event resets the entity's readiness -+ * regarding the current portal. -+ */ -+@NullMarked -+public class EntityPortalReadyEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final PortalType portalType; -+ private @Nullable World targetWorld; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityPortalReadyEvent(final Entity entity, final @Nullable World targetWorld, final PortalType portalType) { -+ super(entity); -+ this.targetWorld = targetWorld; -+ this.portalType = portalType; -+ } -+ -+ /** -+ * Gets the world this portal will teleport to. -+ * Can be {@code null} if "allow-nether" is false in server.properties -+ * or if there is another situation where there is no world to teleport to. -+ *

-+ * This world may be modified by later events such as {@link PlayerPortalEvent} -+ * or {@link EntityPortalEvent}. -+ * -+ * @return the world the portal will teleport the entity to. -+ */ -+ public @Nullable World getTargetWorld() { -+ return this.targetWorld; -+ } -+ -+ /** -+ * Sets the world this portal will teleport to. A {@code null} value -+ * will essentially cancel the teleport and prevent further events -+ * such as {@link PlayerPortalEvent} from firing. -+ *

-+ * This world may be modified by later events such as {@link PlayerPortalEvent} -+ * or {@link EntityPortalEvent}. -+ * -+ * @param targetWorld the world -+ */ -+ public void setTargetWorld(final @Nullable World targetWorld) { -+ this.targetWorld = targetWorld; -+ } -+ -+ /** -+ * Gets the portal type for this event. -+ * -+ * @return the portal type -+ */ -+ public PortalType getPortalType() { -+ return this.portalType; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-EntityTeleportEndGatewayEvent.patch b/patches/api/Add-EntityTeleportEndGatewayEvent.patch deleted file mode 100644 index 557ae6b07c..0000000000 --- a/patches/api/Add-EntityTeleportEndGatewayEvent.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sat, 9 Jun 2018 13:08:21 +0100 -Subject: [PATCH] Add EntityTeleportEndGatewayEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.block.EndGateway; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.entity.EntityTeleportEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired any time an entity attempts to teleport in an end gateway -+ */ -+@NullMarked -+public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent { -+ -+ private final EndGateway gateway; -+ -+ @ApiStatus.Internal -+ public EntityTeleportEndGatewayEvent(final Entity entity, final Location from, final Location to, final EndGateway gateway) { -+ super(entity, from, to); -+ this.gateway = gateway; -+ } -+ -+ /** -+ * The gateway triggering the teleport -+ * -+ * @return EndGateway used -+ */ -+ public EndGateway getGateway() { -+ return this.gateway; -+ } -+ -+} diff --git a/patches/api/Add-EntityZapEvent.patch b/patches/api/Add-EntityZapEvent.patch deleted file mode 100644 index 856680d690..0000000000 --- a/patches/api/Add-EntityZapEvent.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaBlend -Date: Sun, 16 Oct 2016 23:19:34 -0700 -Subject: [PATCH] Add EntityZapEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import java.util.Collections; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.LightningStrike; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityTransformEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired when lightning strikes an entity -+ */ -+@NullMarked -+public class EntityZapEvent extends EntityTransformEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final LightningStrike bolt; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityZapEvent(final Entity entity, final LightningStrike bolt, final Entity replacementEntity) { -+ super(entity, Collections.singletonList(replacementEntity), TransformReason.LIGHTNING); -+ this.bolt = bolt; -+ } -+ -+ /** -+ * Gets the lightning bolt that is striking the entity. -+ * -+ * @return The lightning bolt responsible for this event -+ */ -+ public LightningStrike getBolt() { -+ return this.bolt; -+ } -+ -+ /** -+ * Gets the entity that will replace the struck entity. -+ * -+ * @return The entity that will replace the struck entity -+ */ -+ public Entity getReplacementEntity() { -+ return super.getTransformedEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/entity/PigZapEvent.java b/src/main/java/org/bukkit/event/entity/PigZapEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/entity/PigZapEvent.java -+++ b/src/main/java/org/bukkit/event/entity/PigZapEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Stores data for pigs being zapped - */ --public class PigZapEvent extends EntityTransformEvent implements Cancellable { -- private static final HandlerList handlers = new HandlerList(); -+public class PigZapEvent extends com.destroystokyo.paper.event.entity.EntityZapEvent implements Cancellable { // Paper -+ // private static final HandlerList handlers = new HandlerList(); // Paper - moved in the super class - private boolean canceled; - private final PigZombie pigzombie; - private final LightningStrike bolt; - - public PigZapEvent(@NotNull final Pig pig, @NotNull final LightningStrike bolt, @NotNull final PigZombie pigzombie) { -- super(pig, Collections.singletonList((Entity) pigzombie), TransformReason.LIGHTNING); -+ super(pig, bolt, pigzombie); // Paper - this.bolt = bolt; - this.pigzombie = pigzombie; - } -@@ -0,0 +0,0 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable { - return pigzombie; - } - -+ // Paper start -+ /* - @NotNull - @Override - public HandlerList getHandlers() { -@@ -0,0 +0,0 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ */ -+ // Paper end - } diff --git a/patches/api/Add-EquipmentSlot-convenience-methods.patch b/patches/api/Add-EquipmentSlot-convenience-methods.patch deleted file mode 100644 index af4d2da510..0000000000 --- a/patches/api/Add-EquipmentSlot-convenience-methods.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Sun, 16 Oct 2022 15:28:49 +0300 -Subject: [PATCH] Add EquipmentSlot convenience methods - - -diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlot.java b/src/main/java/org/bukkit/inventory/EquipmentSlot.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java -+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java -@@ -0,0 +0,0 @@ public enum EquipmentSlot { - public EquipmentSlotGroup getGroup() { - return group.get(); - } -+ // Paper start -+ /** -+ * Checks whether this equipment slot is a hand: -+ * either {@link #HAND} or {@link #OFF_HAND} -+ * -+ * @return whether this is a hand slot -+ */ -+ public boolean isHand() { -+ return this == HAND || this == OFF_HAND; -+ } -+ -+ /** -+ * Gets the opposite hand -+ * -+ * @return the opposite hand -+ * @throws IllegalArgumentException if this equipment slot is not a hand -+ * @see #isHand() -+ */ -+ public @NotNull EquipmentSlot getOppositeHand() { -+ return switch (this) { -+ case HAND -> OFF_HAND; -+ case OFF_HAND -> HAND; -+ default -> throw new IllegalArgumentException("Unable to determine an opposite hand for equipment slot: " + name()); -+ }; -+ } -+ -+ /** -+ * Checks whether this equipment slot -+ * is one of the armor slots: -+ * {@link #HEAD}, {@link #CHEST}, -+ * {@link #LEGS}, {@link #FEET}, or {@link #BODY} -+ * -+ * @return whether this is an armor slot -+ */ -+ public boolean isArmor() { -+ return this == HEAD || this == CHEST || this == LEGS || this == FEET || this == BODY; -+ } -+ // Paper end - } diff --git a/patches/api/Add-FastUtil-to-Bukkit.patch b/patches/api/Add-FastUtil-to-Bukkit.patch deleted file mode 100644 index 6dbd4c5d95..0000000000 --- a/patches/api/Add-FastUtil-to-Bukkit.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 1 Apr 2016 00:02:47 -0400 -Subject: [PATCH] Add FastUtil to Bukkit - -Doesn't expose to plugins, just allows Paper-API to use it for optimization - -diff --git a/build.gradle.kts b/build.gradle.kts -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/build.gradle.kts -+++ b/build.gradle.kts -@@ -0,0 +0,0 @@ dependencies { - api("com.googlecode.json-simple:json-simple:1.1.1") { - isTransitive = false // includes junit - } -+ api("it.unimi.dsi:fastutil:8.5.15") - // Paper end - - compileOnly("org.apache.maven:maven-resolver-provider:3.9.6") diff --git a/patches/api/Add-FeatureFlag-API.patch b/patches/api/Add-FeatureFlag-API.patch deleted file mode 100644 index fc89b123fe..0000000000 --- a/patches/api/Add-FeatureFlag-API.patch +++ /dev/null @@ -1,376 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 9 Mar 2023 11:24:43 -0800 -Subject: [PATCH] Add FeatureFlag API - - -diff --git a/src/main/java/io/papermc/paper/world/flag/FeatureDependant.java b/src/main/java/io/papermc/paper/world/flag/FeatureDependant.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/world/flag/FeatureDependant.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.world.flag; -+ -+import java.util.Set; -+import org.bukkit.FeatureFlag; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Unmodifiable; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Implemented by types in built-in registries that are controlled by {@link FeatureFlag FeatureFlags}. -+ * Types in data-driven registries that are controlled by feature flags just will not exist in that registry. -+ * @apiNote When a type that currently implements this interface transitions to being data-drive, this -+ * interface will be removed from that type in the following major version. -+ */ -+@NullMarked -+@ApiStatus.NonExtendable -+public interface FeatureDependant { -+ -+ /** -+ * Gets the set of required feature flags for this -+ * to be enabled. -+ * -+ * @return the immutable set of feature flags -+ */ -+ default @Unmodifiable Set requiredFeatures() { -+ return FeatureFlagProvider.provider().requiredFeatures(this); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/world/flag/FeatureFlagProvider.java b/src/main/java/io/papermc/paper/world/flag/FeatureFlagProvider.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/world/flag/FeatureFlagProvider.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.world.flag; -+ -+import java.util.Optional; -+import java.util.ServiceLoader; -+import java.util.Set; -+import org.bukkit.FeatureFlag; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+@ApiStatus.Internal -+interface FeatureFlagProvider { -+ -+ Optional PROVIDER = ServiceLoader.load(FeatureFlagProvider.class).findFirst(); -+ -+ static FeatureFlagProvider provider() { -+ return PROVIDER.orElseThrow(); -+ } -+ -+ Set requiredFeatures(FeatureDependant dependant); -+} -diff --git a/src/main/java/io/papermc/paper/world/flag/FeatureFlagSetHolder.java b/src/main/java/io/papermc/paper/world/flag/FeatureFlagSetHolder.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/world/flag/FeatureFlagSetHolder.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.world.flag; -+ -+import java.util.Set; -+import org.bukkit.FeatureFlag; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Unmodifiable; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Implemented by types that hold {@link FeatureFlag FeatureFlags} like -+ * {@link org.bukkit.generator.WorldInfo} and {@link org.bukkit.RegionAccessor}. -+ */ -+@NullMarked -+@ApiStatus.NonExtendable -+public interface FeatureFlagSetHolder { -+ -+ /** -+ * Checks if this is enabled based on the loaded feature flags. -+ * -+ * @return true if enabled -+ */ -+ default boolean isEnabled(final FeatureDependant featureDependant) { -+ return this.getFeatureFlags().containsAll(featureDependant.requiredFeatures()); -+ } -+ -+ /** -+ * Get all {@link FeatureFlag FeatureFlags} enabled in this world. -+ * -+ * @return all enabled {@link FeatureFlag FeatureFlags} -+ */ -+ @Unmodifiable Set getFeatureFlags(); -+} -diff --git a/src/main/java/org/bukkit/FeatureFlag.java b/src/main/java/org/bukkit/FeatureFlag.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/FeatureFlag.java -+++ b/src/main/java/org/bukkit/FeatureFlag.java -@@ -0,0 +0,0 @@ - package org.bukkit; - -+// Paper start - overhaul FeatureFlag API -+import com.google.common.base.Preconditions; -+import java.util.List; -+import net.kyori.adventure.key.Key; -+import net.kyori.adventure.util.Index; -+import org.intellij.lang.annotations.Subst; -+// Paper end - overhaul FeatureFlag API - import org.jetbrains.annotations.ApiStatus; - - /** -- * This represents a Feature Flag for a World. -- *
-- * Flags which are unavailable in the current version will be null and/or -- * removed. -+ * This represents a Feature Flag for a {@link io.papermc.paper.world.flag.FeatureFlagSetHolder}. - */ --@ApiStatus.Experimental - public interface FeatureFlag extends Keyed { - -- public static final FeatureFlag VANILLA = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("vanilla")); -+ // Paper start - overhaul FeatureFlag API -+ /** -+ * The {@code vanilla} feature flag. -+ */ -+ FeatureFlag VANILLA = create("vanilla"); - - /** - * AVAILABLE BETWEEN VERSIONS: 1.19.3 - 1.21.1 -@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed { - * @deprecated not available since 1.21.2 - */ - @Deprecated(since = "1.21.2") -- public static final FeatureFlag BUNDLE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("bundle")); -+ FeatureFlag BUNDLE = deprecated("bundle"); - - /** - * AVAILABLE BETWEEN VERSIONS: 1.19 - 1.19.4 - * - * @deprecated not available since 1.20 -+ * The {@code trade_rebalance} feature flag. - */ -- @Deprecated(since = "1.20.2") -- public static final FeatureFlag UPDATE_1_20 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_20")); -+ @Deprecated(since = "1.20") -+ FeatureFlag UPDATE_1_20 = deprecated("update_1_20"); - - @ApiStatus.Experimental // Paper - add missing annotation -- public static final FeatureFlag TRADE_REBALANCE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("trade_rebalance")); -+ FeatureFlag TRADE_REBALANCE = create("trade_rebalance"); - - /** - * AVAILABLE BETWEEN VERSIONS: 1.20.5 - 1.20.6 -@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed { - * @deprecated not available since 1.21 - */ - @Deprecated(since = "1.21") -- public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21")); -+ FeatureFlag UPDATE_121 = deprecated("update_1_21"); - - /** - * AVAILABLE BETWEEN VERSIONS: 1.21.2 - 1.21.3 -@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed { - * @deprecated not available since 1.21.4 - */ - @Deprecated(since = "1.21.4") -- public static final FeatureFlag WINTER_DROP = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("winter_drop")); -+ FeatureFlag WINTER_DROP = deprecated("winter_drop"); - - @ApiStatus.Experimental // Paper - add missing annotation -- public static final FeatureFlag REDSTONE_EXPERIMENTS = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("redstone_experiments")); -+ FeatureFlag REDSTONE_EXPERIMENTS = create("redstone_experiments"); - - @ApiStatus.Experimental // Paper - add missing annotation -- public static final FeatureFlag MINECART_IMPROVEMENTS = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("minecart_improvements")); -+ FeatureFlag MINECART_IMPROVEMENTS = create("minecart_improvements"); -+ -+ /** -+ * An index of all feature flags. -+ */ -+ Index ALL_FLAGS = Index.create(FeatureFlag::key, List.copyOf(FeatureFlagImpl.ALL_FLAGS)); -+ -+ private static FeatureFlag create(@Subst("vanilla") final String name) { -+ final FeatureFlag flag = new FeatureFlagImpl(NamespacedKey.minecraft(name)); -+ Preconditions.checkState(FeatureFlagImpl.ALL_FLAGS.add(flag), "Tried to add duplicate feature flag: " + name); -+ return flag; -+ } -+ -+ private static FeatureFlag deprecated(@Subst("vanilla") final String name) { -+ return new FeatureFlagImpl.Deprecated(NamespacedKey.minecraft(name)); -+ } -+ // Paper end - overhaul FeatureFlag API - - } -diff --git a/src/main/java/org/bukkit/FeatureFlagImpl.java b/src/main/java/org/bukkit/FeatureFlagImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/bukkit/FeatureFlagImpl.java -@@ -0,0 +0,0 @@ -+package org.bukkit; -+ -+import java.util.HashSet; -+import java.util.Set; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@ApiStatus.Internal -+@NullMarked -+record FeatureFlagImpl(NamespacedKey key) implements FeatureFlag { -+ -+ static final Set ALL_FLAGS = new HashSet<>(); -+ -+ @Override -+ public NamespacedKey getKey() { -+ return this.key; -+ } -+ -+ @ApiStatus.Internal -+ record Deprecated(NamespacedKey key) implements FeatureFlag { -+ -+ @Override -+ public NamespacedKey getKey() { -+ return this.key; -+ } -+ } -+} -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * A RegionAccessor gives access to getting, modifying and spawning {@link Biome}, {@link BlockState} and {@link Entity}, - * as well as generating some basic structures. - */ --public interface RegionAccessor extends Keyed { // Paper -+public interface RegionAccessor extends Keyed, io.papermc.paper.world.flag.FeatureFlagSetHolder { // Paper - feature flag API - - /** - * Gets the {@link Biome} at the given {@link Location}. -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ public interface UnsafeValues { - @Deprecated(since = "1.21.3", forRemoval = true) - String getTranslationKey(Attribute attribute); - -- @Nullable -- FeatureFlag getFeatureFlag(@NotNull NamespacedKey key); -+ // Paper - replace with better system - - /** - * Do not use, method will get removed, and the plugin won't run -diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/BlockType.java -+++ b/src/main/java/org/bukkit/block/BlockType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * changes may occur. Do not use this API in plugins. - */ - @ApiStatus.Internal --public interface BlockType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add translatable -+public interface BlockType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - add translatable & feature flag API - - /** - * Typed represents a subtype of {@link BlockType}s that have a known block -@@ -0,0 +0,0 @@ public interface BlockType extends Keyed, Translatable, net.kyori.adventure.tran - * - * @param world the world to check - * @return true if this BlockType can be used in this World. -+ * @deprecated Use {@link io.papermc.paper.world.flag.FeatureFlagSetHolder#isEnabled(io.papermc.paper.world.flag.FeatureDependant)} - */ -+ @Deprecated(forRemoval = true, since = "1.21.1") // Paper - boolean isEnabledByFeature(@NotNull World world); - - /** -diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/EntityType.java -+++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Contract; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - --public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable -+public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - translatable - - // These strings MUST match the strings in nms.EntityTypes and are case sensitive. - /** -diff --git a/src/main/java/org/bukkit/generator/WorldInfo.java b/src/main/java/org/bukkit/generator/WorldInfo.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/generator/WorldInfo.java -+++ b/src/main/java/org/bukkit/generator/WorldInfo.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Holds various information of a World - */ --public interface WorldInfo { -+public interface WorldInfo extends io.papermc.paper.world.flag.FeatureFlagSetHolder { // Paper - feature flag API - - /** - * Gets the unique name of this world -diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemType.java -+++ b/src/main/java/org/bukkit/inventory/ItemType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * changes may occur. Do not use this API in plugins. - */ - @ApiStatus.Experimental // Paper - already required for registry builders --public interface ItemType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add Translatable -+public interface ItemType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - add Translatable & feature flag API - - /** - * Typed represents a subtype of {@link ItemType}s that have a known item meta type -@@ -0,0 +0,0 @@ public interface ItemType extends Keyed, Translatable, net.kyori.adventure.trans - * - * @param world the world to check - * @return true if this ItemType can be used in this World. -+ * @deprecated use {@link io.papermc.paper.world.flag.FeatureFlagSetHolder#isEnabled(io.papermc.paper.world.flag.FeatureDependant)} - */ -+ @Deprecated(forRemoval = true, since = "1.21.1") // Paper - boolean isEnabledByFeature(@NotNull World world); - - /** -diff --git a/src/main/java/org/bukkit/inventory/MenuType.java b/src/main/java/org/bukkit/inventory/MenuType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/MenuType.java -+++ b/src/main/java/org/bukkit/inventory/MenuType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - * created and viewed by the player. - */ - @ApiStatus.Experimental --public interface MenuType extends Keyed { -+public interface MenuType extends Keyed, io.papermc.paper.world.flag.FeatureDependant { // Paper - make FeatureDependant - - /** - * A MenuType which represents a chest with 1 row. -diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffectType.java -+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a type of potion and its effect on an entity. - */ --public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - implement Translatable -+public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - implement Translatable & feature flag API - private static final BiMap ID_MAP = HashBiMap.create(); - - /** -diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/potion/PotionType.java -+++ b/src/main/java/org/bukkit/potion/PotionType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * This enum reflects and matches each potion state that can be obtained from - * the Creative mode inventory - */ --public enum PotionType implements Keyed { -+public enum PotionType implements Keyed, io.papermc.paper.world.flag.FeatureDependant { // Paper - feature flag API - WATER("water"), - MUNDANE("mundane"), - THICK("thick"), diff --git a/patches/api/Add-FluidState-API.patch b/patches/api/Add-FluidState-API.patch deleted file mode 100644 index e7b096f77c..0000000000 --- a/patches/api/Add-FluidState-API.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: vicisacat -Date: Fri, 17 Nov 2023 20:21:47 +0100 -Subject: [PATCH] Add FluidState API - - -diff --git a/src/main/java/io/papermc/paper/block/fluid/FluidData.java b/src/main/java/io/papermc/paper/block/fluid/FluidData.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/fluid/FluidData.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.block.fluid; -+ -+import org.bukkit.Fluid; -+import org.bukkit.Location; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.Range; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A representation of a fluid in a specific state of data. -+ * This type is not linked to a specific location and hence mostly resembles a {@link org.bukkit.block.data.BlockData}. -+ */ -+@NullMarked -+public interface FluidData extends Cloneable { -+ -+ /** -+ * Gets the fluid type of this fluid data. -+ * -+ * @return the fluid type -+ */ -+ Fluid getFluidType(); -+ -+ /** -+ * Returns a copy of this FluidData. -+ * -+ * @return a copy of the fluid data -+ */ -+ FluidData clone(); -+ -+ /** -+ * Computes the direction of the flow of the liquid at the given location as a vector. -+ *

-+ * This method requires the passed location's chunk to be loaded. -+ * If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation -+ * which leads to a potentially slow sync chunk load. -+ * -+ * @param location - the location to check the liquid flow -+ * @return the flow direction vector at the given location -+ */ -+ Vector computeFlowDirection(Location location); -+ -+ /** -+ * Returns the level of liquid this fluid data holds. -+ * -+ * @return the amount as an integer, between 0 and 8 -+ */ -+ @Range(from = 0, to = 8) -+ int getLevel(); -+ -+ /** -+ * Computes the height of the fluid in the world. -+ *

-+ * This method requires the passed location's chunk to be loaded. -+ * If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation -+ * which leads to a potentially slow sync chunk load. -+ * -+ * @param location the location at which to check the high of this fluid data. -+ * @return the height as a float value -+ */ -+ @Range(from = 0, to = 1) -+ float computeHeight(Location location); -+ -+ /** -+ * Returns whether this fluid is a source block -+ * -+ * @return true if the fluid is a source block, false otherwise -+ */ -+ boolean isSource(); -+} -diff --git a/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java b/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.block.fluid.type; -+ -+import io.papermc.paper.block.fluid.FluidData; -+ -+/** -+ * A specific subtype of {@link FluidData} that is returned by the API for fluid data of potentially falling fluids. -+ */ -+public interface FallingFluidData extends FluidData { -+ -+ /** -+ * Get if this liquid is falling. -+ * -+ * @return true if falling -+ */ -+ boolean isFalling(); -+} -diff --git a/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java b/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.block.fluid.type; -+ -+import io.papermc.paper.block.fluid.FluidData; -+ -+/** -+ * A specific subtype of {@link FluidData} that is returned by the API for fluid data of potentially falling fluids. -+ */ -+public interface FlowingFluidData extends FallingFluidData { -+ -+} -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -0,0 +0,0 @@ public interface RegionAccessor extends Keyed { // Paper - @NotNull - BlockState getBlockState(int x, int y, int z); - -+ // Paper start - FluidState API -+ /** -+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the specified position. -+ * -+ * @param x The x-coordinate of the position -+ * @param y The y-coordinate of the position -+ * @param z The z-coordinate of the position -+ * @return The {@link io.papermc.paper.block.fluid.FluidData} at the specified position -+ */ -+ @NotNull -+ io.papermc.paper.block.fluid.FluidData getFluidData(int x, int y, int z); -+ -+ /** -+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the given position -+ * -+ * @param position The position of the fluid -+ * @return The fluid data at the given position -+ */ -+ @NotNull -+ default io.papermc.paper.block.fluid.FluidData getFluidData(@NotNull io.papermc.paper.math.Position position) { -+ return getFluidData(position.blockX(), position.blockY(), position.blockZ()); -+ } -+ -+ /** -+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the given position -+ * -+ * @param location The location of the fluid -+ * @return The fluid data at the given position -+ */ -+ @NotNull -+ default io.papermc.paper.block.fluid.FluidData getFluidData(@NotNull Location location) { -+ return getFluidData(location.blockX(), location.blockY(), location.blockZ()); -+ } -+ // Paper end -+ - /** - * Gets the {@link BlockData} at the given {@link Location}. - * diff --git a/patches/api/Add-GS4-Query-event.patch b/patches/api/Add-GS4-Query-event.patch deleted file mode 100644 index 62c78852a4..0000000000 --- a/patches/api/Add-GS4-Query-event.patch +++ /dev/null @@ -1,407 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Sun, 17 Mar 2019 21:46:27 +0200 -Subject: [PATCH] Add GS4 Query event - - -diff --git a/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.server; -+ -+import com.google.common.base.Preconditions; -+import com.google.common.collect.ImmutableList; -+import java.net.InetAddress; -+import java.util.ArrayList; -+import java.util.Arrays; -+import java.util.Collection; -+import java.util.List; -+import org.bukkit.Server; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.checkerframework.checker.nullness.qual.MonotonicNonNull; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * This event is fired if server is getting queried over GS4 Query protocol. -+ *
-+ * Adapted from Velocity's ProxyQueryEvent -+ * -+ * @author Mark Vainomaa -+ */ -+@NullMarked -+public final class GS4QueryEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final QueryType queryType; -+ private final InetAddress querierAddress; -+ private QueryResponse response; -+ -+ @ApiStatus.Internal -+ public GS4QueryEvent(final QueryType queryType, final InetAddress querierAddress, final QueryResponse response) { -+ super(true); // should always be called async -+ this.queryType = queryType; -+ this.querierAddress = querierAddress; -+ this.response = response; -+ } -+ -+ /** -+ * Get query type -+ * -+ * @return query type -+ */ -+ public QueryType getQueryType() { -+ return this.queryType; -+ } -+ -+ /** -+ * Get querier address -+ * -+ * @return querier address -+ */ -+ public InetAddress getQuerierAddress() { -+ return this.querierAddress; -+ } -+ -+ /** -+ * Get query response -+ * -+ * @return query response -+ */ -+ public QueryResponse getResponse() { -+ return this.response; -+ } -+ -+ /** -+ * Set query response -+ * -+ * @param response query response -+ */ -+ public void setResponse(final QueryResponse response) { -+ this.response = Preconditions.checkNotNull(response, "response"); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * The type of query -+ */ -+ public enum QueryType { -+ /** -+ * Basic query asks only a subset of information, such as motd, game type (hardcoded to

MINECRAFT
), map, -+ * current players, max players, server port and server motd -+ */ -+ BASIC, -+ -+ /** -+ * Full query asks pretty much everything present on this event (only hardcoded values cannot be modified here). -+ */ -+ FULL -+ } -+ -+ public static final class QueryResponse { -+ -+ private final String motd; -+ private final String gameVersion; -+ private final String map; -+ private final int currentPlayers; -+ private final int maxPlayers; -+ private final String hostname; -+ private final int port; -+ private final Collection players; -+ private final String serverVersion; -+ private final Collection plugins; -+ -+ private QueryResponse(final String motd, final String gameVersion, final String map, final int currentPlayers, final int maxPlayers, final String hostname, final int port, final Collection players, final String serverVersion, final Collection plugins) { -+ this.motd = motd; -+ this.gameVersion = gameVersion; -+ this.map = map; -+ this.currentPlayers = currentPlayers; -+ this.maxPlayers = maxPlayers; -+ this.hostname = hostname; -+ this.port = port; -+ this.players = players; -+ this.serverVersion = serverVersion; -+ this.plugins = plugins; -+ } -+ -+ /** -+ * Get motd which will be used to reply to the query. By default, it is {@link Server#getMotd()}. -+ * -+ * @return motd -+ */ -+ public String getMotd() { -+ return this.motd; -+ } -+ -+ /** -+ * Get game version which will be used to reply to the query. By default, supported Minecraft versions range is sent. -+ * -+ * @return game version -+ */ -+ public String getGameVersion() { -+ return this.gameVersion; -+ } -+ -+ /** -+ * Get map name which will be used to reply to the query. By default {@code world} is sent. -+ * -+ * @return map name -+ */ -+ public String getMap() { -+ return this.map; -+ } -+ -+ /** -+ * Get current online player count which will be used to reply to the query. -+ * -+ * @return online player count -+ */ -+ public int getCurrentPlayers() { -+ return this.currentPlayers; -+ } -+ -+ /** -+ * Get max player count which will be used to reply to the query. -+ * -+ * @return max player count -+ */ -+ public int getMaxPlayers() { -+ return this.maxPlayers; -+ } -+ -+ /** -+ * Get server (public facing) hostname. -+ * -+ * @return server hostname -+ */ -+ public String getHostname() { -+ return this.hostname; -+ } -+ -+ /** -+ * Get server (public facing) port. -+ * -+ * @return server port -+ */ -+ public int getPort() { -+ return this.port; -+ } -+ -+ /** -+ * Get collection of players which will be used to reply to the query. -+ * -+ * @return collection of players -+ */ -+ public Collection getPlayers() { -+ return this.players; -+ } -+ -+ /** -+ * Get server software (name and version) which will be used to reply to the query. -+ * -+ * @return server software -+ */ -+ public String getServerVersion() { -+ return this.serverVersion; -+ } -+ -+ /** -+ * Get list of plugins which will be used to reply to the query. -+ * -+ * @return collection of plugins -+ */ -+ public Collection getPlugins() { -+ return this.plugins; -+ } -+ -+ /** -+ * Creates a new {@link Builder} instance from data represented by this response. -+ * -+ * @return {@link QueryResponse} builder -+ */ -+ public Builder toBuilder() { -+ return QueryResponse.builder() -+ .motd(this.getMotd()) -+ .gameVersion(this.getGameVersion()) -+ .map(this.getMap()) -+ .currentPlayers(this.getCurrentPlayers()) -+ .maxPlayers(this.getMaxPlayers()) -+ .hostname(this.getHostname()) -+ .port(this.getPort()) -+ .players(this.getPlayers()) -+ .serverVersion(this.getServerVersion()) -+ .plugins(this.getPlugins()); -+ } -+ -+ /** -+ * Creates a new {@link Builder} instance. -+ * -+ * @return {@link QueryResponse} builder -+ */ -+ public static Builder builder() { -+ return new Builder(); -+ } -+ -+ /** -+ * A builder for {@link QueryResponse} objects. -+ */ -+ public static final class Builder { -+ -+ private @MonotonicNonNull String motd; -+ private @MonotonicNonNull String gameVersion; -+ private @MonotonicNonNull String map; -+ private @MonotonicNonNull String hostname; -+ private @MonotonicNonNull String serverVersion; -+ -+ private int currentPlayers; -+ private int maxPlayers; -+ private int port; -+ -+ private final List players = new ArrayList<>(); -+ private final List plugins = new ArrayList<>(); -+ -+ private Builder() { -+ } -+ -+ public Builder motd(final String motd) { -+ this.motd = Preconditions.checkNotNull(motd, "motd"); -+ return this; -+ } -+ -+ public Builder gameVersion(final String gameVersion) { -+ this.gameVersion = Preconditions.checkNotNull(gameVersion, "gameVersion"); -+ return this; -+ } -+ -+ public Builder map(final String map) { -+ this.map = Preconditions.checkNotNull(map, "map"); -+ return this; -+ } -+ -+ public Builder currentPlayers(final int currentPlayers) { -+ Preconditions.checkArgument(currentPlayers >= 0, "currentPlayers cannot be negative"); -+ this.currentPlayers = currentPlayers; -+ return this; -+ } -+ -+ public Builder maxPlayers(final int maxPlayers) { -+ Preconditions.checkArgument(maxPlayers >= 0, "maxPlayers cannot be negative"); -+ this.maxPlayers = maxPlayers; -+ return this; -+ } -+ -+ public Builder hostname(final String hostname) { -+ this.hostname = Preconditions.checkNotNull(hostname, "hostname"); -+ return this; -+ } -+ -+ public Builder port(final int port) { -+ Preconditions.checkArgument(port >= 1 && port <= 65535, "port must be between 1-65535"); -+ this.port = port; -+ return this; -+ } -+ -+ public Builder players(final Collection players) { -+ this.players.addAll(Preconditions.checkNotNull(players, "players")); -+ return this; -+ } -+ -+ public Builder players(final String... players) { -+ this.players.addAll(Arrays.asList(Preconditions.checkNotNull(players, "players"))); -+ return this; -+ } -+ -+ public Builder clearPlayers() { -+ this.players.clear(); -+ return this; -+ } -+ -+ public Builder serverVersion(final String serverVersion) { -+ this.serverVersion = Preconditions.checkNotNull(serverVersion, "serverVersion"); -+ return this; -+ } -+ -+ public Builder plugins(final Collection plugins) { -+ this.plugins.addAll(Preconditions.checkNotNull(plugins, "plugins")); -+ return this; -+ } -+ -+ public Builder plugins(final PluginInformation... plugins) { -+ this.plugins.addAll(Arrays.asList(Preconditions.checkNotNull(plugins, "plugins"))); -+ return this; -+ } -+ -+ public Builder clearPlugins() { -+ this.plugins.clear(); -+ return this; -+ } -+ -+ /** -+ * Builds new {@link QueryResponse} with supplied data. -+ * -+ * @return response -+ */ -+ public QueryResponse build() { -+ return new QueryResponse( -+ Preconditions.checkNotNull(this.motd, "motd"), -+ Preconditions.checkNotNull(this.gameVersion, "gameVersion"), -+ Preconditions.checkNotNull(this.map, "map"), -+ this.currentPlayers, -+ this.maxPlayers, -+ Preconditions.checkNotNull(this.hostname, "hostname"), -+ this.port, -+ ImmutableList.copyOf(this.players), -+ Preconditions.checkNotNull(this.serverVersion, "serverVersion"), -+ ImmutableList.copyOf(this.plugins) -+ ); -+ } -+ } -+ -+ /** -+ * Plugin information -+ */ -+ public static class PluginInformation { -+ -+ private String name; -+ private String version; -+ -+ public PluginInformation(final String name, final String version) { -+ this.name = Preconditions.checkNotNull(name, "name"); -+ this.version = Preconditions.checkNotNull(version, "version"); -+ } -+ -+ public String getName() { -+ return this.name; -+ } -+ -+ public void setName(final String name) { -+ this.name = name; -+ } -+ -+ public void setVersion(final String version) { -+ this.version = version; -+ } -+ -+ public String getVersion() { -+ return this.version; -+ } -+ -+ public static PluginInformation of(final String name, final String version) { -+ return new PluginInformation(name, version); -+ } -+ } -+ } -+} diff --git a/patches/api/Add-GameEvent-tags.patch b/patches/api/Add-GameEvent-tags.patch deleted file mode 100644 index afe36d39a9..0000000000 --- a/patches/api/Add-GameEvent-tags.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 18 Dec 2021 10:34:21 -0800 -Subject: [PATCH] Add GameEvent tags - - -diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Tag.java -+++ b/src/main/java/org/bukkit/Tag.java -@@ -0,0 +0,0 @@ public interface Tag extends Keyed { - */ - Tag ENTITY_TYPES_REDIRECTABLE_PROJECTILE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("redirectable_projectile"), EntityType.class); - -+ // Paper start -+ String REGISTRY_GAME_EVENTS = "game_events"; -+ -+ /** -+ * Tag for game events that trigger sculk sensors -+ */ -+ Tag GAME_EVENT_VIBRATIONS = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("vibrations"), GameEvent.class); -+ -+ /** -+ * Tag for game events that are ignored if the entity is sneaking -+ */ -+ Tag GAME_EVENT_IGNORE_VIBRATIONS_SNEAKING = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("ignore_vibrations_sneaking"), GameEvent.class); -+ -+ /** -+ * Tag for game events that an allay can listen to -+ */ -+ Tag GAME_EVENT_ALLAY_CAN_LISTEN = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("allay_can_listen"), GameEvent.class); -+ // Paper end -+ - /** - * Returns whether or not this tag has an entry for the specified item. - * diff --git a/patches/api/Add-GameMode-isInvulnerable.patch b/patches/api/Add-GameMode-isInvulnerable.patch deleted file mode 100644 index f585682601..0000000000 --- a/patches/api/Add-GameMode-isInvulnerable.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Wed, 1 May 2024 06:56:21 +0300 -Subject: [PATCH] Add GameMode#isInvulnerable - - -diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/GameMode.java -+++ b/src/main/java/org/bukkit/GameMode.java -@@ -0,0 +0,0 @@ public enum GameMode implements net.kyori.adventure.translation.Translatable { / - BY_ID.put(mode.getValue(), mode); - } - } -+ -+ // Paper start - Add GameMode#isInvulnerable -+ /** -+ * Checks whether this game mode is invulnerable -+ * (i.e. is either {@link #CREATIVE} or {@link #SPECTATOR}) -+ * -+ * @return whether this game mode is invulnerable -+ */ -+ public boolean isInvulnerable() { -+ return this == CREATIVE || this == SPECTATOR; -+ } -+ // Paper end - Add GameMode#isInvulnerable - } diff --git a/patches/api/Add-Heightmap-API.patch b/patches/api/Add-Heightmap-API.patch deleted file mode 100644 index add1d9adf9..0000000000 --- a/patches/api/Add-Heightmap-API.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sat, 1 Dec 2018 19:00:36 -0800 -Subject: [PATCH] Add Heightmap API - -Changed to use upstream's heightmap API - Machine_Maker - -diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Location.java -+++ b/src/main/java/org/bukkit/Location.java -@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - } - // Paper end - expand Location API - -+ // Paper start - Add heightmap api -+ /** -+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ()) -+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ()) -+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null} -+ */ -+ @NotNull -+ public Location toHighestLocation() { -+ return this.toHighestLocation(HeightMap.WORLD_SURFACE); -+ } -+ -+ /** -+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap) -+ * @param heightMap The heightmap to use for finding the highest y location. -+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap) -+ */ -+ @NotNull -+ public Location toHighestLocation(@NotNull final HeightMap heightMap) { -+ final Location ret = this.clone(); -+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightMap)); -+ return ret; -+ } -+ // Paper end - Add heightmap api -+ - // Paper start - Expand Explosions API - /** - * Creates explosion at this location with given power diff --git a/patches/api/Add-HiddenPotionEffect-API.patch b/patches/api/Add-HiddenPotionEffect-API.patch deleted file mode 100644 index 517bd4c815..0000000000 --- a/patches/api/Add-HiddenPotionEffect-API.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tamion <70228790+notTamion@users.noreply.github.com> -Date: Sun, 5 Nov 2023 09:50:48 +0100 -Subject: [PATCH] Add HiddenPotionEffect API - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - - /** - * Adds the given {@link PotionEffect} to the living entity. -+ *

-+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when -+ * adding the effect to the entity. - * - * @param effect PotionEffect to be added - * @return whether the effect could be added -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - /** - * Attempts to add all of the given {@link PotionEffect} to the living - * entity. -+ *

-+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when -+ * adding the effect to the entity. - * - * @param effects the effects to add - * @return whether all of the effects could be added -diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffect.java -+++ b/src/main/java/org/bukkit/potion/PotionEffect.java -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - */ - public static final int INFINITE_DURATION = -1; - -+ private static final String HIDDEN_EFFECT = "hidden_effect"; // Paper - private static final String AMPLIFIER = "amplifier"; - private static final String DURATION = "duration"; - private static final String TYPE = "effect"; -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - private final boolean ambient; - private final boolean particles; - private final boolean icon; -+ private final PotionEffect hiddenEffect; // Paper - - /** - * Creates a potion effect. -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - * @param ambient the ambient status, see {@link PotionEffect#isAmbient()} - * @param particles the particle status, see {@link PotionEffect#hasParticles()} - * @param icon the icon status, see {@link PotionEffect#hasIcon()} -+ * @param hiddenEffect the hidden PotionEffect -+ * @hidden Internal-- hidden effects are only shown internally - */ -- public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) { -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper -+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable PotionEffect hiddenEffect) { // Paper - Preconditions.checkArgument(type != null, "effect type cannot be null"); - this.type = type; - this.duration = duration; -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - this.ambient = ambient; - this.particles = particles; - this.icon = icon; -+ // Paper start -+ this.hiddenEffect = hiddenEffect; -+ } -+ -+ /** -+ * Creates a potion effect. -+ * @param type effect type -+ * @param duration measured in ticks, see {@link -+ * PotionEffect#getDuration()} -+ * @param amplifier the amplifier, see {@link PotionEffect#getAmplifier()} -+ * @param ambient the ambient status, see {@link PotionEffect#isAmbient()} -+ * @param particles the particle status, see {@link PotionEffect#hasParticles()} -+ * @param icon the icon status, see {@link PotionEffect#hasIcon()} -+ */ -+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) { -+ this(type, duration, amplifier, ambient, particles, icon, null); -+ // Paper end - } - - /** -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - * @param map the map to deserialize from - */ - public PotionEffect(@NotNull Map map) { -- this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true))); -+ this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), (PotionEffect) map.get(HIDDEN_EFFECT)); // Paper - } - - // Paper start -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - public PotionEffect withIcon(boolean icon) { - return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon); - } -+ -+ /** -+ * Returns the PotionEffect that will become active -+ * after the current PotionEffect has run out. -+ *

-+ * Note: This value is only applicable to type applied to living entities. -+ * -+ * @return The hidden PotionEffect. -+ */ -+ @Nullable -+ public PotionEffect getHiddenPotionEffect() { -+ return hiddenEffect; -+ } - // Paper end - - @NotNull -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - @Override - @NotNull - public Map serialize() { -- return ImmutableMap.builder() -+ ImmutableMap.Builder builder = ImmutableMap.builder() // Paper - .put(TYPE, type.getKey().toString()) - .put(DURATION, duration) - .put(AMPLIFIER, amplifier) - .put(AMBIENT, ambient) - .put(PARTICLES, particles) -- .put(ICON, icon) -- .build(); -+ .put(ICON, icon); -+ // Paper start -+ if (this.hiddenEffect != null) { -+ builder.put(HIDDEN_EFFECT, this.hiddenEffect); -+ } -+ return builder.build(); -+ // Paper end - } - - /** - * Attempts to add the effect represented by this object to the given - * {@link LivingEntity}. -+ *

-+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when -+ * adding the effect to the entity. - * - * @param entity The entity to add this effect to - * @return Whether the effect could be added -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - return false; - } - PotionEffect that = (PotionEffect) obj; -- return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon; -+ return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && java.util.Objects.equals(this.hiddenEffect, that.hiddenEffect); // Paper - } - - /** -@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable { - hash ^= 0x22222222 >> (ambient ? 1 : -1); - hash ^= 0x22222222 >> (particles ? 1 : -1); - hash ^= 0x22222222 >> (icon ? 1 : -1); -+ if (hiddenEffect != null) hash = hash * 31 + hiddenEffect.hashCode(); // Paper - return hash; - } - - @Override - public String toString() { -- return type.getName() + (ambient ? ":(" : ":") + duration + "t-x" + amplifier + (ambient ? ")" : ""); -+ return "PotionEffect{" + "amplifier=" + amplifier + ", duration=" + duration + ", type=" + type + ", ambient=" + ambient + ", particles=" + particles + ", icon=" + icon + ", hiddenEffect=" + hiddenEffect + '}'; // Paper - } - } diff --git a/patches/api/Add-ItemStack-Recipe-API-helper-methods.patch b/patches/api/Add-ItemStack-Recipe-API-helper-methods.patch deleted file mode 100644 index 521b3e099d..0000000000 --- a/patches/api/Add-ItemStack-Recipe-API-helper-methods.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 28 Jan 2014 19:13:57 -0500 -Subject: [PATCH] Add ItemStack Recipe API helper methods - -Allows using ExactChoice Recipes with easier methods - -Redirects some of upstream's APIs to these new methods to avoid -usage of magic values and the deprecated RecipeChoice#getItemStack - -diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/RecipeChoice.java -+++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java -@@ -0,0 +0,0 @@ public interface RecipeChoice extends Predicate, Cloneable { - /** - * Represents a choice that will be valid only if one of the stacks is - * exactly matched (aside from stack size). -- *
-- * Only valid for shaped recipes - */ - public static class ExactChoice implements RecipeChoice { - -diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java -+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java -@@ -0,0 +0,0 @@ public class ShapedRecipe extends CraftingRecipe { - return this; - } - -+ // Paper start -+ @NotNull -+ public ShapedRecipe setIngredient(char key, @NotNull ItemStack item) { -+ return setIngredient(key, new RecipeChoice.ExactChoice(item)); -+ } -+ // Paper end -+ - /** - * Get a copy of the ingredients map. - * -diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -@@ -0,0 +0,0 @@ public class ShapelessRecipe extends CraftingRecipe { - return this; - } - -+ // Paper start -+ @NotNull -+ public ShapelessRecipe addIngredient(@NotNull ItemStack item) { -+ return addIngredient(item.getAmount(), item); -+ } -+ -+ @NotNull -+ public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) { -+ Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients"); -+ while (count-- > 0) { -+ ingredients.add(new RecipeChoice.ExactChoice(item)); -+ } -+ return this; -+ } -+ -+ @NotNull -+ public ShapelessRecipe removeIngredient(@NotNull ItemStack item) { -+ return removeIngredient(1, item); -+ } -+ -+ @NotNull -+ public ShapelessRecipe removeIngredient(int count, @NotNull ItemStack item) { -+ Iterator iterator = ingredients.iterator(); -+ while (count > 0 && iterator.hasNext()) { -+ RecipeChoice choice = iterator.next(); -+ if (choice.test(item)) { -+ iterator.remove(); -+ count--; -+ } -+ } -+ return this; -+ } -+ // Paper end -+ - /** - * Removes an ingredient from the list. - * -@@ -0,0 +0,0 @@ public class ShapelessRecipe extends CraftingRecipe { - */ - @NotNull - public ShapelessRecipe removeIngredient(@NotNull Material ingredient) { -- return removeIngredient(ingredient, 0); -+ return removeIngredient(new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack) - } - - /** -@@ -0,0 +0,0 @@ public class ShapelessRecipe extends CraftingRecipe { - */ - @NotNull - public ShapelessRecipe removeIngredient(int count, @NotNull Material ingredient) { -- return removeIngredient(count, ingredient, 0); -+ return removeIngredient(count, new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack) - } - - /** diff --git a/patches/api/Add-Lifecycle-Event-system.patch b/patches/api/Add-Lifecycle-Event-system.patch deleted file mode 100644 index f5a27f571c..0000000000 --- a/patches/api/Add-Lifecycle-Event-system.patch +++ /dev/null @@ -1,646 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 18 Jul 2023 14:47:02 -0700 -Subject: [PATCH] Add Lifecycle Event system - -This event system is separate from Bukkit's event system and is -meant for managing resources across reloads and from points in the -PluginBootstrap. - -diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java -+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java -@@ -0,0 +0,0 @@ - package io.papermc.paper.plugin.bootstrap; - -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; - import org.jetbrains.annotations.ApiStatus; - import org.jspecify.annotations.NullMarked; - -@@ -0,0 +0,0 @@ import org.jspecify.annotations.NullMarked; - @ApiStatus.Experimental - @NullMarked - @ApiStatus.NonExtendable --public interface BootstrapContext extends PluginProviderContext { -+public interface BootstrapContext extends PluginProviderContext, LifecycleEventOwner { -+ -+ /** -+ * Get the lifecycle event manager for registering handlers -+ * for lifecycle events allowed on the {@link BootstrapContext}. -+ * -+ * @return the lifecycle event manager -+ */ -+ LifecycleEventManager getLifecycleManager(); - } -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event; -+ -+import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; -+import org.jetbrains.annotations.ApiStatus; -+ -+/** -+ * Base type for all Lifecycle Events. -+ *

-+ * Lifecycle events are generally fired when the older -+ * event system is not available, like during early -+ * server initialization. -+ * @see LifecycleEvents -+ */ -+@ApiStatus.Experimental -+@ApiStatus.NonExtendable -+public interface LifecycleEvent { -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event; -+ -+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; -+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.LifecycleEventHandlerConfiguration; -+import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEventType; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Manages a plugin's lifecycle events. Can be obtained -+ * from {@link org.bukkit.plugin.Plugin} or {@link io.papermc.paper.plugin.bootstrap.BootstrapContext}. -+ * -+ * @param the owning type, {@link org.bukkit.plugin.Plugin} or {@link io.papermc.paper.plugin.bootstrap.BootstrapContext} -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface LifecycleEventManager { -+ -+ /** -+ * Registers an event handler for a specific event type. -+ *

-+ * This is shorthand for creating a new {@link LifecycleEventHandlerConfiguration} and -+ * just passing in the {@link LifecycleEventHandler}. -+ *

{@code
-+     * LifecycleEventHandler> handler = new Handler();
-+     * manager.registerEventHandler(LifecycleEvents.COMMANDS, handler);
-+     * }
-+ * is equivalent to -+ *
{@code
-+     * LifecycleEventHandler> handler = new Handler();
-+     * manager.registerEventHandler(LifecycleEvents.COMMANDS.newHandler(handler));
-+     * }
-+ * -+ * @param eventType the event type to listen to -+ * @param eventHandler the handler for that event -+ * @param the type of the event object -+ */ -+ default void registerEventHandler(final LifecycleEventType eventType, final LifecycleEventHandler eventHandler) { -+ this.registerEventHandler(eventType.newHandler(eventHandler)); -+ } -+ -+ /** -+ * Registers an event handler configuration. -+ *

-+ * Configurations are created via {@link LifecycleEventType#newHandler(LifecycleEventHandler)}. -+ * Event types may have different configurations options available on the builder-like object -+ * returned by {@link LifecycleEventType#newHandler(LifecycleEventHandler)}. -+ * -+ * @param handlerConfiguration the handler configuration to register -+ */ -+ void registerEventHandler(LifecycleEventHandlerConfiguration handlerConfiguration); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event; -+ -+import io.papermc.paper.plugin.configuration.PluginMeta; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Implemented by types that are considered owners -+ * of registered handlers for lifecycle events. Generally -+ * the types that implement this interface also provide -+ * a {@link LifecycleEventManager} where you can register -+ * event handlers. -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface LifecycleEventOwner { -+ -+ /** -+ * Get the plugin meta for this plugin. -+ * -+ * @return the plugin meta -+ */ -+ PluginMeta getPluginMeta(); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A handler for a specific event. Can be implemented -+ * in a concrete class or as a lambda. -+ * -+ * @param the event -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@FunctionalInterface -+public interface LifecycleEventHandler { -+ -+ void run(E event); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler.configuration; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Base type for constructing configured event handlers for -+ * lifecycle events. Usually created via {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEventType#newHandler(LifecycleEventHandler)} -+ * from event types in {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents} -+ * -+ * @param -+ */ -+@SuppressWarnings("unused") -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface LifecycleEventHandlerConfiguration { -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler.configuration; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Handler configuration for event types that allow "monitor" handlers. -+ * -+ * @param the required owner type -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface MonitorLifecycleEventHandlerConfiguration extends LifecycleEventHandlerConfiguration { -+ -+ /** -+ * Sets this handler configuration to be considered a "monitor". -+ * These handlers will run last and should only be used by plugins -+ * to observe changes from previously run handlers. -+ * -+ * @return this configuration for chaining -+ */ -+ @Contract("-> this") -+ MonitorLifecycleEventHandlerConfiguration monitor(); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler.configuration; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Handler configuration that allows both "monitor" and prioritized handlers. -+ * The default priority is 0. -+ * -+ * @param the required owner type -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface PrioritizedLifecycleEventHandlerConfiguration extends LifecycleEventHandlerConfiguration { -+ -+ /** -+ * Sets the priority for this handler. Resets -+ * all previous calls to {@link #monitor()}. A -+ * lower numeric value correlates to the handler -+ * being run earlier. -+ * -+ * @param priority the numerical priority -+ * @return this configuration for chaining -+ */ -+ @Contract("_ -> this") -+ PrioritizedLifecycleEventHandlerConfiguration priority(int priority); -+ -+ /** -+ * Sets this handler configuration to be considered a "monitor". -+ * These handlers will run last and should only be used by plugins -+ * to observe any changes from previously ran handlers. -+ * -+ * @return this configuration for chaining -+ */ -+ @Contract("-> this") -+ PrioritizedLifecycleEventHandlerConfiguration monitor(); -+ -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.registrar; -+ -+import org.jetbrains.annotations.ApiStatus; -+ -+/** -+ * To be implemented by types that provide ways to register types -+ * either on server start or during a reload -+ */ -+@ApiStatus.Experimental -+@ApiStatus.NonExtendable -+public interface Registrar { -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.registrar; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A lifecycle event that exposes a {@link Registrar} of some kind -+ * to allow management of various things. Look at implementations of -+ * {@link Registrar} for an idea of what uses this event. -+ * -+ * @param registrar type -+ * @see ReloadableRegistrarEvent -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface RegistrarEvent extends LifecycleEvent { -+ -+ /** -+ * Get the registrar related to this event. -+ * -+ * @return the registrar -+ */ -+ @Contract(pure = true) -+ R registrar(); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.registrar; -+ -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A lifecycle event that exposes a {@link Registrar} that is -+ * reloadable. -+ * -+ * @param the registrar type -+ * @see RegistrarEvent -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface ReloadableRegistrarEvent extends RegistrarEvent { -+ -+ /** -+ * Get the cause of this reload. -+ * -+ * @return the cause -+ */ -+ @Contract(pure = true) -+ Cause cause(); -+ -+ @ApiStatus.Experimental -+ enum Cause { -+ /** -+ * The initial load of the server. -+ */ -+ INITIAL, -+ /** -+ * A reload, triggered via one of the various mechanisms like -+ * the bukkit or minecraft reload commands. -+ */ -+ RELOAD -+ } -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.types; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; -+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.LifecycleEventHandlerConfiguration; -+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.MonitorLifecycleEventHandlerConfiguration; -+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.PrioritizedLifecycleEventHandlerConfiguration; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Base type for all types of lifecycle events. Differs from -+ * {@link LifecycleEvent} which is the actual event object, whereas -+ * this is an object representing the type of the event. Used -+ * to construct subtypes of {@link LifecycleEventHandlerConfiguration} for -+ * use in {@link LifecycleEventManager} -+ * -+ * @param the required owner type -+ * @param the event object type -+ * @param the configuration type -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface LifecycleEventType> { -+ -+ /** -+ * Gets the name of the lifecycle event. -+ * -+ * @return the name -+ */ -+ @Contract(pure = true) -+ String name(); -+ -+ /** -+ * Create a configuration for this event with the specified -+ * handler. -+ * -+ * @param handler the event handler -+ * @return a new configuration -+ * @see LifecycleEventManager#registerEventHandler(LifecycleEventHandlerConfiguration) -+ */ -+ @Contract("_ -> new") -+ C newHandler(LifecycleEventHandler handler); -+ -+ /** -+ * Lifecycle event type that supports separate registration -+ * of handlers as "monitors" that are run last. Useful -+ * if a plugin wants to only observe the changes other handlers -+ * made. -+ * -+ * @param the required owner type -+ * @param the event object type -+ */ -+ @ApiStatus.Experimental -+ @ApiStatus.NonExtendable -+ interface Monitorable extends LifecycleEventType> { -+ } -+ -+ /** -+ * Lifecycle event type that supports both {@link Monitorable "monitors"} and -+ * specific numeric-based priorities. -+ * -+ * @param the required owner type -+ * @param the event object type -+ */ -+ @ApiStatus.Experimental -+ @ApiStatus.NonExtendable -+ interface Prioritizable extends LifecycleEventType> { -+ } -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.types; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import java.util.Optional; -+import java.util.ServiceLoader; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@ApiStatus.Internal -+@NullMarked -+interface LifecycleEventTypeProvider { -+ -+ Optional INSTANCE = ServiceLoader.load(LifecycleEventTypeProvider.class) -+ .findFirst(); -+ -+ static LifecycleEventTypeProvider provider() { -+ return INSTANCE.orElseThrow(); -+ } -+ -+ LifecycleEventType.Monitorable monitor(String name, Class ownerType); -+ -+ LifecycleEventType.Prioritizable prioritized(String name, Class ownerType); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.plugin.lifecycle.event.types; -+ -+import io.papermc.paper.plugin.bootstrap.BootstrapContext; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import org.bukkit.plugin.Plugin; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Holds various types of lifecycle events for -+ * use when creating event handler configurations -+ * in {@link LifecycleEventManager}. -+ */ -+@ApiStatus.Experimental -+@NullMarked -+public final class LifecycleEvents { -+ -+ // -+ @ApiStatus.Internal -+ static LifecycleEventType.Monitorable plugin(final String name) { -+ return monitor(name, Plugin.class); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Prioritizable pluginPrioritized(final String name) { -+ return prioritized(name, Plugin.class); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Monitorable bootstrap(final String name) { -+ return monitor(name, BootstrapContext.class); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Prioritizable bootstrapPrioritized(final String name) { -+ return prioritized(name, BootstrapContext.class); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Monitorable monitor(final String name, final Class ownerType) { -+ return LifecycleEventTypeProvider.provider().monitor(name, ownerType); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Prioritizable prioritized(final String name, final Class ownerType) { -+ return LifecycleEventTypeProvider.provider().prioritized(name, ownerType); -+ } -+ // -+ -+ private LifecycleEvents() { -+ } -+} -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ public interface UnsafeValues { - */ - @Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); - // Paper end - spawn egg color visibility -+ -+ // Paper start - lifecycle event API -+ /** -+ * @hidden -+ */ -+ @org.jetbrains.annotations.ApiStatus.Internal -+ io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck); -+ // Paper end - lifecycle event API - } -diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/Plugin.java -+++ b/src/main/java/org/bukkit/plugin/Plugin.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - *

- * The use of {@link PluginBase} is recommended for actual Implementation - */ --public interface Plugin extends TabExecutor { -+public interface Plugin extends TabExecutor, io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner { // Paper - /** - * Returns the folder that the plugin data files are located in. The - * folder may not yet exist. -@@ -0,0 +0,0 @@ public interface Plugin extends TabExecutor { - */ - @NotNull - public String getName(); -+ -+ // Paper start - lifecycle events -+ /** -+ * Get the lifecycle event manager for registering handlers -+ * for lifecycle events allowed on the {@link Plugin}. -+ * -+ * @return the lifecycle event manager -+ */ -+ io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager getLifecycleManager(); -+ // Paper end - lifecycle events - } -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase { - private FileConfiguration newConfig = null; - private File configFile = null; - private Logger logger = null; // Paper - PluginLogger -> Logger -+ // Paper start - lifecycle events -+ @SuppressWarnings("deprecation") -+ private final io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager lifecycleEventManager = org.bukkit.Bukkit.getUnsafe().createPluginLifecycleEventManager(this, () -> this.allowsLifecycleRegistration); -+ private boolean allowsLifecycleRegistration = true; -+ // Paper end - - public JavaPlugin() { - // Paper start -@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase { - isEnabled = enabled; - - if (isEnabled) { -+ try { // Paper - lifecycle events - onEnable(); -+ } finally { this.allowsLifecycleRegistration = false; } // Paper - lifecycle events - } else { - onDisable(); - } -@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase { - } - return plugin; - } -+ -+ // Paper start - lifecycle events -+ @Override -+ public final io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager getLifecycleManager() { -+ return this.lifecycleEventManager; -+ } -+ // Paper end - lifecycle events - } -diff --git a/src/test/java/org/bukkit/plugin/TestPlugin.java b/src/test/java/org/bukkit/plugin/TestPlugin.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/plugin/TestPlugin.java -+++ b/src/test/java/org/bukkit/plugin/TestPlugin.java -@@ -0,0 +0,0 @@ public class TestPlugin extends PluginBase { - public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { - throw new UnsupportedOperationException("Not supported."); - } -+ -+ // Paper start - lifecycle events -+ @Override -+ public io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager getLifecycleManager() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ // Paper end - lifecycle events - } diff --git a/patches/api/Add-Listing-API-for-Player.patch b/patches/api/Add-Listing-API-for-Player.patch deleted file mode 100644 index f604cfb000..0000000000 --- a/patches/api/Add-Listing-API-for-Player.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Corey Shupe -Date: Wed, 11 Jan 2023 16:40:31 -0500 -Subject: [PATCH] Add Listing API for Player - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ - public boolean canSee(@NotNull Entity entity); - -+ // Paper start -+ /** -+ * Returns whether the {@code other} player is listed for {@code this}. -+ * -+ * @param other The other {@link Player} to check for listing. -+ * @return True if the {@code other} player is listed for {@code this}. -+ */ -+ boolean isListed(@NotNull Player other); -+ -+ /** -+ * Unlists the {@code other} player from the tablist. -+ * -+ * @param other The other {@link Player} to de-list. -+ * @return True if the {@code other} player was listed. -+ */ -+ boolean unlistPlayer(@NotNull Player other); -+ -+ /** -+ * Lists the {@code other} player. -+ * -+ * @param other The other {@link Player} to list. -+ * @return True if the {@code other} player was not listed. -+ */ -+ boolean listPlayer(@NotNull Player other); -+ // Paper end -+ - /** - * Checks to see if this player is currently flying or not. - * diff --git a/patches/api/Add-LivingEntity-clearActiveItem.patch b/patches/api/Add-LivingEntity-clearActiveItem.patch deleted file mode 100644 index 8f14af4716..0000000000 --- a/patches/api/Add-LivingEntity-clearActiveItem.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anrza -Date: Wed, 15 Jul 2020 12:07:58 +0200 -Subject: [PATCH] Add LivingEntity#clearActiveItem - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - org.bukkit.inventory.@NotNull ItemStack getActiveItem(); - -+ /** -+ * Interrupts any ongoing active "usage" or consumption or an item. -+ */ -+ void clearActiveItem(); -+ - /** - * Gets the remaining number of ticks for {@link #getActiveItem()}'s usage. - * diff --git a/patches/api/Add-LivingEntity-getTargetEntity.patch b/patches/api/Add-LivingEntity-getTargetEntity.patch deleted file mode 100644 index 2adac4dc02..0000000000 --- a/patches/api/Add-LivingEntity-getTargetEntity.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sat, 22 Sep 2018 00:32:53 -0500 -Subject: [PATCH] Add LivingEntity#getTargetEntity - - -diff --git a/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents information about a targeted entity -+ * @deprecated use {@link org.bukkit.util.RayTraceResult} -+ */ -+@Deprecated(forRemoval = true, since = "1.19.3") -+public class TargetEntityInfo { -+ private final Entity entity; -+ private final Vector hitVec; -+ -+ public TargetEntityInfo(@NotNull Entity entity, @NotNull Vector hitVec) { -+ this.entity = entity; -+ this.hitVec = hitVec; -+ } -+ -+ /** -+ * Get the entity that is targeted -+ * -+ * @return Targeted entity -+ */ -+ @NotNull -+ public Entity getEntity() { -+ return entity; -+ } -+ -+ /** -+ * Get the position the entity is targeted at -+ * -+ * @return Targeted position -+ */ -+ @NotNull -+ public Vector getHitVector() { -+ return hitVec; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @Deprecated(forRemoval = true, since = "1.19.3") - @Nullable - public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return entity being targeted, or null if no entity is targeted -+ */ -+ @Nullable -+ public default Entity getTargetEntity(int maxDistance) { -+ return getTargetEntity(maxDistance, false); -+ } -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param ignoreBlocks true to scan through blocks -+ * @return entity being targeted, or null if no entity is targeted -+ */ -+ @Nullable -+ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks); -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return TargetEntityInfo about the entity being targeted, -+ * or null if no entity is targeted -+ * @deprecated use {@link #rayTraceEntities(int)} -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.3") -+ @Nullable -+ public default com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance) { -+ return getTargetEntityInfo(maxDistance, false); -+ } -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return RayTraceResult about the entity being targeted, -+ * or null if no entity is targeted -+ */ -+ @Nullable -+ default RayTraceResult rayTraceEntities(int maxDistance) { -+ return this.rayTraceEntities(maxDistance, false); -+ } -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param ignoreBlocks true to scan through blocks -+ * @return TargetEntityInfo about the entity being targeted, -+ * or null if no entity is targeted -+ * @deprecated use {@link #rayTraceEntities(int, boolean)} -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.3") -+ @Nullable -+ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks); -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param ignoreBlocks true to scan through blocks -+ * @return RayTraceResult about the entity being targeted, -+ * or null if no entity is targeted -+ */ -+ @Nullable -+ RayTraceResult rayTraceEntities(int maxDistance, boolean ignoreBlocks); - // Paper end - - /** diff --git a/patches/api/Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch b/patches/api/Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch deleted file mode 100644 index 26ff8c0a5c..0000000000 --- a/patches/api/Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Tue, 11 Oct 2022 22:35:56 +0300 -Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @Deprecated - void setHurtDirection(float hurtDirection); - // Paper end - hurt direction API -+ -+ // Paper start - swing hand API -+ /** -+ * Makes this entity swing their hand. -+ * -+ *

This method does nothing if this entity does not -+ * have an animation for swinging their hand. -+ * -+ * @param hand hand to be swung, either {@link org.bukkit.inventory.EquipmentSlot#HAND} or {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND} -+ * @throws IllegalArgumentException if invalid hand is passed -+ */ -+ default void swingHand(@NotNull org.bukkit.inventory.EquipmentSlot hand) { -+ com.google.common.base.Preconditions.checkArgument(hand != null && hand.isHand(), String.format("Expected a valid hand, got \"%s\" instead!", hand)); -+ if (hand == org.bukkit.inventory.EquipmentSlot.HAND) { -+ this.swingMainHand(); -+ } else { -+ this.swingOffHand(); -+ } -+ } -+ // Paper end - swing hand API - } diff --git a/patches/api/Add-Material-Tags.patch b/patches/api/Add-Material-Tags.patch deleted file mode 100644 index 0860e171ef..0000000000 --- a/patches/api/Add-Material-Tags.patch +++ /dev/null @@ -1,1255 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 17 Jul 2018 01:27:15 -0400 -Subject: [PATCH] Add Material Tags - -This adds a bunch of useful and missing Tags to be able to identify items that -are related to each other by a trait. - -Co-authored-by: Jake Potrebic -Co-authored-by: Lena Kolb -Co-authored-by: Layla Silbernberg -Co-authored-by: Newwind - -diff --git a/src/main/java/com/destroystokyo/paper/MaterialSetTag.java b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java -@@ -0,0 +0,0 @@ -+/* -+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License -+ */ -+ -+package com.destroystokyo.paper; -+ -+import com.google.common.collect.Lists; -+import io.papermc.paper.tag.BaseTag; -+import org.bukkit.Material; -+import org.bukkit.NamespacedKey; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockState; -+import org.bukkit.block.data.BlockData; -+import org.bukkit.inventory.ItemStack; -+ -+import java.util.Collection; -+import java.util.Set; -+import java.util.function.Predicate; -+import java.util.stream.Collectors; -+import java.util.stream.Stream; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+public class MaterialSetTag extends BaseTag { -+ -+ /** -+ * @deprecated Use NamespacedKey version of constructor -+ */ -+ @Deprecated -+ public MaterialSetTag(@NotNull Predicate filter) { -+ this(null, Stream.of(Material.values()).filter(filter).collect(Collectors.toList())); -+ } -+ -+ /** -+ * @deprecated Use NamespacedKey version of constructor -+ */ -+ @Deprecated -+ public MaterialSetTag(@NotNull Collection materials) { -+ this(null, materials); -+ } -+ -+ /** -+ * @deprecated Use NamespacedKey version of constructor -+ */ -+ @Deprecated -+ public MaterialSetTag(@NotNull Material... materials) { -+ this(null, materials); -+ } -+ -+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Predicate filter) { -+ this(key, Stream.of(Material.values()).filter(filter).collect(Collectors.toList())); -+ } -+ -+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Material... materials) { -+ this(key, Lists.newArrayList(materials)); -+ } -+ -+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Collection materials) { -+ this(key != null ? key : NamespacedKey.randomKey(), materials, ((Predicate) Material::isLegacy).negate()); -+ } -+ -+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Collection materials, @NotNull Predicate...globalPredicates) { -+ super(Material.class, key != null ? key : NamespacedKey.randomKey(), materials, globalPredicates); -+ } -+ -+ @NotNull -+ @Override -+ @ApiStatus.Internal -+ protected Set getAllPossibleValues() { -+ return Stream.of(Material.values()).collect(Collectors.toSet()); -+ } -+ -+ @Override -+ @NotNull -+ @ApiStatus.Internal -+ protected String getName(@NotNull Material value) { -+ return value.name(); -+ } -+ -+ public boolean isTagged(@NotNull BlockData block) { -+ return isTagged(block.getMaterial()); -+ } -+ -+ public boolean isTagged(@NotNull BlockState block) { -+ return isTagged(block.getType()); -+ } -+ -+ public boolean isTagged(@NotNull Block block) { -+ return isTagged(block.getType()); -+ } -+ -+ public boolean isTagged(@NotNull ItemStack item) { -+ return isTagged(item.getType()); -+ } -+ -+ public boolean isTagged(@NotNull Material material) { -+ return this.tagged.contains(material); -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java -@@ -0,0 +0,0 @@ -+/* -+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining -+ * a copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+package com.destroystokyo.paper; -+ -+import org.bukkit.Material; -+import org.bukkit.NamespacedKey; -+import org.bukkit.Tag; -+ -+/** -+ * Represents a collection tags to identify materials that share common properties. -+ * Will map to minecraft for missing tags, as well as custom ones that may be useful. -+ *

-+ * All tags in this class are unmodifiable, attempting to modify them will throw an -+ * {@link UnsupportedOperationException}. -+ */ -+@SuppressWarnings({"NonFinalUtilityClass", "unused", "WeakerAccess"}) -+public class MaterialTags { -+ -+ private static NamespacedKey keyFor(String key) { -+ //noinspection deprecation -+ return new NamespacedKey("paper", key + "_settag"); -+ } -+ public static final MaterialSetTag ARROWS = new MaterialSetTag(keyFor("arrows")) -+ .endsWith("ARROW") -+ .ensureSize("ARROWS", 3).lock(); -+ -+ /** -+ * Covers all colors of beds. -+ */ -+ public static final MaterialSetTag BEDS = new MaterialSetTag(keyFor("beds")) -+ .endsWith("_BED") -+ .ensureSize("BEDS", 16).lock(); -+ -+ /** -+ * Covers all bucket items. -+ */ -+ public static final MaterialSetTag BUCKETS = new MaterialSetTag(keyFor("buckets")) -+ .endsWith("BUCKET") -+ .ensureSize("BUCKETS", 11).lock(); -+ -+ /** -+ * Covers coal and charcoal. -+ */ -+ public static final MaterialSetTag COALS = new MaterialSetTag(keyFor("coals")) -+ .add(Material.COAL, Material.CHARCOAL).lock(); -+ -+ /** -+ * Covers both cobblestone wall variants. -+ */ -+ public static final MaterialSetTag COBBLESTONE_WALLS = new MaterialSetTag(keyFor("cobblestone_walls")) -+ .endsWith("COBBLESTONE_WALL") -+ .ensureSize("COBBLESTONE_WALLS", 2).lock(); -+ -+ /** -+ * Covers both cobblestone and mossy Cobblestone. -+ */ -+ public static final MaterialSetTag COBBLESTONES = new MaterialSetTag(keyFor("cobblestones")) -+ .add(Material.COBBLESTONE, Material.MOSSY_COBBLESTONE).lock(); -+ -+ /** -+ * Covers all colors of concrete. -+ */ -+ public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes")) -+ .endsWith("_CONCRETE") -+ .ensureSize("CONCRETES", 16).lock(); -+ -+ /** -+ * Covers all colors of concrete powder. -+ */ -+ public static final MaterialSetTag CONCRETE_POWDER = new MaterialSetTag(keyFor("concrete_powder")) -+ .endsWith("_CONCRETE_POWDER") -+ .ensureSize("CONCRETE_POWDER", 16).lock(); -+ -+ /** -+ * Covers the two types of cooked fish. -+ */ -+ public static final MaterialSetTag COOKED_FISH = new MaterialSetTag(keyFor("cooked_fish")) -+ .add(Material.COOKED_COD, Material.COOKED_SALMON).lock(); -+ -+ /** -+ * Covers all variants of doors. -+ */ -+ public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors")) -+ .endsWith("_DOOR") -+ .ensureSize("DOORS", 21).lock(); -+ -+ /** -+ * Covers all dyes. -+ */ -+ public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes")) -+ .endsWith("_DYE") -+ .ensureSize("DYES", 16).lock(); -+ -+ /** -+ * Covers all variants of gates. -+ */ -+ public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates")) -+ .endsWith("_GATE") -+ .ensureSize("FENCE_GATES", 12).lock(); -+ -+ /** -+ * Covers all variants of fences. -+ */ -+ public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences")) -+ .endsWith("_FENCE") -+ .ensureSize("FENCES", 13).lock(); -+ -+ /** -+ * Covers all variants of fish buckets. -+ */ -+ public static final MaterialSetTag FISH_BUCKETS = new MaterialSetTag(keyFor("fish_buckets")) -+ .add(Material.COD_BUCKET, Material.PUFFERFISH_BUCKET, Material.SALMON_BUCKET, Material.TROPICAL_FISH_BUCKET).lock(); -+ -+ /** -+ * Covers the non-colored glass and 16 stained glass (not panes). -+ */ -+ public static final MaterialSetTag GLASS = new MaterialSetTag(keyFor("glass")) -+ .endsWith("_GLASS") -+ .add(Material.GLASS) -+ .ensureSize("GLASS", 18).lock(); -+ -+ /** -+ * Covers the non-colored glass panes and stained glass panes (panes only). -+ */ -+ public static final MaterialSetTag GLASS_PANES = new MaterialSetTag(keyFor("glass_panes")) -+ .endsWith("GLASS_PANE") -+ .ensureSize("GLASS_PANES", 17).lock(); -+ -+ /** -+ * Covers all glazed terracotta blocks. -+ */ -+ public static final MaterialSetTag GLAZED_TERRACOTTA = new MaterialSetTag(keyFor("glazed_terracotta")) -+ .endsWith("GLAZED_TERRACOTTA") -+ .ensureSize("GLAZED_TERRACOTTA", 16).lock(); -+ -+ /** -+ * Covers the colors of stained terracotta. -+ */ -+ public static final MaterialSetTag STAINED_TERRACOTTA = new MaterialSetTag(keyFor("stained_terracotta")) -+ .endsWith("TERRACOTTA") -+ .not(Material.TERRACOTTA) -+ .notEndsWith("GLAZED_TERRACOTTA") -+ .ensureSize("STAINED_TERRACOTTA", 16).lock(); -+ -+ /** -+ * Covers terracotta along with the stained variants. -+ */ -+ public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta")) -+ .endsWith("TERRACOTTA") -+ .ensureSize("TERRACOTTA", 33).lock(); -+ -+ /** -+ * Covers both golden apples. -+ */ -+ public static final MaterialSetTag GOLDEN_APPLES = new MaterialSetTag(keyFor("golden_apples")) -+ .endsWith("GOLDEN_APPLE") -+ .ensureSize("GOLDEN_APPLES", 2).lock(); -+ -+ /** -+ * Covers the variants of horse armor. -+ */ -+ public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors")) -+ .endsWith("_HORSE_ARMOR") -+ .ensureSize("HORSE_ARMORS", 4).lock(); -+ -+ /** -+ * Covers the variants of infested blocks. -+ */ -+ public static final MaterialSetTag INFESTED_BLOCKS = new MaterialSetTag(keyFor("infested_blocks")) -+ .startsWith("INFESTED_") -+ .ensureSize("INFESTED_BLOCKS", 7).lock(); -+ -+ /** -+ * Covers the variants of mushroom blocks. -+ */ -+ public static final MaterialSetTag MUSHROOM_BLOCKS = new MaterialSetTag(keyFor("mushroom_blocks")) -+ .endsWith("MUSHROOM_BLOCK") -+ .add(Material.MUSHROOM_STEM) -+ .ensureSize("MUSHROOM_BLOCKS", 3).lock(); -+ -+ /** -+ * Covers all mushrooms. -+ */ -+ public static final MaterialSetTag MUSHROOMS = new MaterialSetTag(keyFor("mushrooms")) -+ .add(Material.BROWN_MUSHROOM, Material.RED_MUSHROOM).lock(); -+ -+ /** -+ * Covers all music disc items. -+ */ -+ public static final MaterialSetTag MUSIC_DISCS = new MaterialSetTag(keyFor("music_discs")) -+ .startsWith("MUSIC_DISC_").lock(); -+ -+ /** -+ * Covers all ores. -+ */ -+ public static final MaterialSetTag ORES = new MaterialSetTag(keyFor("ores")) -+ .add(Material.ANCIENT_DEBRIS) -+ .endsWith("_ORE") -+ .ensureSize("ORES", 19).lock(); -+ -+ /** -+ * Covers all piston typed items and blocks including the piston head and moving piston. -+ */ -+ public static final MaterialSetTag PISTONS = new MaterialSetTag(keyFor("pistons")) -+ .contains("PISTON") -+ .ensureSize("PISTONS", 4).lock(); -+ -+ /** -+ * Covers all potato items. -+ */ -+ public static final MaterialSetTag POTATOES = new MaterialSetTag(keyFor("potatoes")) -+ .endsWith("POTATO") -+ .ensureSize("POTATOES", 3).lock(); -+ -+ /** -+ * Covers all wooden pressure plates and the weighted pressure plates and the stone pressure plate. -+ */ -+ public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates")) -+ .endsWith("_PRESSURE_PLATE") -+ .ensureSize("PRESSURE_PLATES", 16).lock(); -+ -+ /** -+ * Covers the variants of prismarine blocks. -+ */ -+ public static final MaterialSetTag PRISMARINE = new MaterialSetTag(keyFor("prismarine")) -+ .add(Material.PRISMARINE, Material.PRISMARINE_BRICKS, Material.DARK_PRISMARINE).lock(); -+ -+ /** -+ * Covers the variants of prismarine slabs. -+ */ -+ public static final MaterialSetTag PRISMARINE_SLABS = new MaterialSetTag(keyFor("prismarine_slabs")) -+ .add(Material.PRISMARINE_SLAB, Material.PRISMARINE_BRICK_SLAB, Material.DARK_PRISMARINE_SLAB).lock(); -+ -+ /** -+ * Covers the variants of prismarine stairs. -+ */ -+ public static final MaterialSetTag PRISMARINE_STAIRS = new MaterialSetTag(keyFor("prismarine_stairs")) -+ .add(Material.PRISMARINE_STAIRS, Material.PRISMARINE_BRICK_STAIRS, Material.DARK_PRISMARINE_STAIRS).lock(); -+ -+ /** -+ * Covers the variants of pumpkins. -+ */ -+ public static final MaterialSetTag PUMPKINS = new MaterialSetTag(keyFor("pumpkins")) -+ .add(Material.CARVED_PUMPKIN, Material.JACK_O_LANTERN, Material.PUMPKIN).lock(); -+ -+ /** -+ * Covers the variants of quartz blocks. -+ */ -+ public static final MaterialSetTag QUARTZ_BLOCKS = new MaterialSetTag(keyFor("quartz_blocks")) -+ .add(Material.QUARTZ_BLOCK, Material.QUARTZ_PILLAR, Material.CHISELED_QUARTZ_BLOCK, Material.SMOOTH_QUARTZ).lock(); -+ -+ /** -+ * Covers all uncooked fish items. -+ */ -+ public static final MaterialSetTag RAW_FISH = new MaterialSetTag(keyFor("raw_fish")) -+ .add(Material.COD, Material.PUFFERFISH, Material.SALMON, Material.TROPICAL_FISH).lock(); -+ -+ /** -+ * Covers the variants of red sandstone blocks. -+ */ -+ public static final MaterialSetTag RED_SANDSTONES = new MaterialSetTag(keyFor("red_sandstones")) -+ .endsWith("RED_SANDSTONE") -+ .ensureSize("RED_SANDSTONES", 4).lock(); -+ -+ /** -+ * Covers the variants of sandstone blocks. -+ */ -+ public static final MaterialSetTag SANDSTONES = new MaterialSetTag(keyFor("sandstones")) -+ .add(Material.SANDSTONE, Material.CHISELED_SANDSTONE, Material.CUT_SANDSTONE, Material.SMOOTH_SANDSTONE).lock(); -+ -+ /** -+ * Covers sponge and wet sponge. -+ */ -+ public static final MaterialSetTag SPONGES = new MaterialSetTag(keyFor("sponges")) -+ .endsWith("SPONGE") -+ .ensureSize("SPONGES", 2).lock(); -+ -+ /** -+ * Covers the non-colored and colored shulker boxes. -+ */ -+ public static final MaterialSetTag SHULKER_BOXES = new MaterialSetTag(keyFor("shulker_boxes")) -+ .endsWith("SHULKER_BOX") -+ .ensureSize("SHULKER_BOXES", 17).lock(); -+ -+ /** -+ * Covers zombie, creeper, skeleton, dragon, and player heads. -+ */ -+ public static final MaterialSetTag SKULLS = new MaterialSetTag(keyFor("skulls")) -+ .endsWith("_HEAD") -+ .endsWith("_SKULL") -+ .not(Material.PISTON_HEAD) -+ .ensureSize("SKULLS", 14).lock(); -+ -+ /** -+ * Covers all spawn egg items. -+ */ -+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) -+ .endsWith("_SPAWN_EGG") -+ .ensureSize("SPAWN_EGGS", 81).lock(); -+ -+ /** -+ * Covers all colors of stained glass. -+ */ -+ public static final MaterialSetTag STAINED_GLASS = new MaterialSetTag(keyFor("stained_glass")) -+ .endsWith("_STAINED_GLASS") -+ .ensureSize("STAINED_GLASS", 16).lock(); -+ -+ /** -+ * Covers all colors of stained glass panes. -+ */ -+ public static final MaterialSetTag STAINED_GLASS_PANES = new MaterialSetTag(keyFor("stained_glass_panes")) -+ .endsWith("STAINED_GLASS_PANE") -+ .ensureSize("STAINED_GLASS_PANES", 16).lock(); -+ -+ /** -+ * Covers all variants of trapdoors. -+ */ -+ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors")) -+ .endsWith("_TRAPDOOR") -+ .ensureSize("TRAPDOORS", 21).lock(); -+ -+ /** -+ * Covers all wood variants of doors. -+ */ -+ public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors")) -+ .endsWith("_DOOR") -+ .not(Material.IRON_DOOR) -+ .notContains("COPPER") -+ .ensureSize("WOODEN_DOORS", 12).lock(); -+ -+ /** -+ * Covers all wood variants of fences. -+ */ -+ public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences")) -+ .endsWith("_FENCE") -+ .not(Material.NETHER_BRICK_FENCE) -+ .ensureSize("WOODEN_FENCES", 12).lock(); -+ -+ /** -+ * Covers all wood variants of trapdoors. -+ */ -+ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors")) -+ .endsWith("_TRAPDOOR") -+ .not(Material.IRON_TRAPDOOR) -+ .notContains("COPPER") -+ .ensureSize("WOODEN_TRAPDOORS", 12).lock(); -+ -+ /** -+ * Covers the wood variants of gates. -+ */ -+ public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates")) -+ .endsWith("_GATE") -+ .ensureSize("WOODEN_GATES", 12).lock(); -+ -+ /** -+ * Covers the variants of purpur. -+ */ -+ public static final MaterialSetTag PURPUR = new MaterialSetTag(keyFor("purpur")) -+ .startsWith("PURPUR_") -+ .ensureSize("PURPUR", 4).lock(); -+ -+ /** -+ * Covers the variants of signs. -+ */ -+ public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs")) -+ .endsWith("_SIGN") -+ .ensureSize("SIGNS", 48).lock(); -+ -+ /** -+ * Covers the variants of a regular torch. -+ */ -+ public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch")) -+ .add(Material.TORCH, Material.WALL_TORCH) -+ .ensureSize("TORCH", 2).lock(); -+ -+ /** -+ * Covers the variants of a redstone torch. -+ */ -+ public static final MaterialSetTag REDSTONE_TORCH = new MaterialSetTag(keyFor("redstone_torch")) -+ .add(Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH) -+ .ensureSize("REDSTONE_TORCH", 2).lock(); -+ -+ /** -+ * Covers the variants of a soul torch. -+ */ -+ public static final MaterialSetTag SOUL_TORCH = new MaterialSetTag(keyFor("soul_torch")) -+ .add(Material.SOUL_TORCH, Material.SOUL_WALL_TORCH) -+ .ensureSize("SOUL_TORCH", 2).lock(); -+ -+ /** -+ * Covers the variants of torches. -+ */ -+ public static final MaterialSetTag TORCHES = new MaterialSetTag(keyFor("torches")) -+ .add(TORCH, REDSTONE_TORCH, SOUL_TORCH) -+ .ensureSize("TORCHES", 6).lock(); -+ -+ /** -+ * Covers the variants of lanterns. -+ */ -+ public static final MaterialSetTag LANTERNS = new MaterialSetTag(keyFor("lanterns")) -+ .add(Material.LANTERN, Material.SOUL_LANTERN) -+ .ensureSize("LANTERNS", 2).lock(); -+ -+ /** -+ * Covers the variants of rails. -+ */ -+ public static final MaterialSetTag RAILS = new MaterialSetTag(keyFor("rails")) -+ .endsWith("RAIL") -+ .ensureSize("RAILS", 4).lock(); -+ -+ /** -+ * Covers the variants of swords. -+ */ -+ public static final MaterialSetTag SWORDS = new MaterialSetTag(keyFor("swords")) -+ .endsWith("_SWORD") -+ .ensureSize("SWORDS", 6).lock(); -+ -+ /** -+ * Covers the variants of shovels. -+ */ -+ public static final MaterialSetTag SHOVELS = new MaterialSetTag(keyFor("shovels")) -+ .endsWith("_SHOVEL") -+ .ensureSize("SHOVELS", 6).lock(); -+ -+ /** -+ * Covers the variants of pickaxes. -+ */ -+ public static final MaterialSetTag PICKAXES = new MaterialSetTag(keyFor("pickaxes")) -+ .endsWith("_PICKAXE") -+ .ensureSize("PICKAXES", 6).lock(); -+ -+ /** -+ * Covers the variants of axes. -+ */ -+ public static final MaterialSetTag AXES = new MaterialSetTag(keyFor("axes")) -+ .endsWith("_AXE") -+ .ensureSize("AXES", 6).lock(); -+ -+ /** -+ * Covers the variants of hoes. -+ */ -+ public static final MaterialSetTag HOES = new MaterialSetTag(keyFor("hoes")) -+ .endsWith("_HOE") -+ .ensureSize("HOES", 6).lock(); -+ -+ /** -+ * Covers the variants of helmets. -+ */ -+ public static final MaterialSetTag HELMETS = new MaterialSetTag(keyFor("helmets")) -+ .endsWith("_HELMET") -+ .ensureSize("HELMETS", 7).lock(); -+ -+ /** -+ * Covers the variants of items that can be equipped in the helmet slot. -+ */ -+ public static final MaterialSetTag HEAD_EQUIPPABLE = new MaterialSetTag(keyFor("head_equippable")) -+ .endsWith("_HELMET") -+ .add(SKULLS) -+ .add(Material.CARVED_PUMPKIN) -+ .ensureSize("HEAD_EQUIPPABLE", 22).lock(); -+ -+ /** -+ * Covers the variants of chestplate. -+ */ -+ public static final MaterialSetTag CHESTPLATES = new MaterialSetTag(keyFor("chestplates")) -+ .endsWith("_CHESTPLATE") -+ .ensureSize("CHESTPLATES", 6).lock(); -+ -+ /** -+ * Covers the variants of items that can be equipped in the chest slot. -+ */ -+ public static final MaterialSetTag CHEST_EQUIPPABLE = new MaterialSetTag(keyFor("chest_equippable")) -+ .endsWith("_CHESTPLATE") -+ .add(Material.ELYTRA) -+ .ensureSize("CHEST_EQUIPPABLE", 7).lock(); -+ -+ /** -+ * Covers the variants of leggings. -+ */ -+ public static final MaterialSetTag LEGGINGS = new MaterialSetTag(keyFor("leggings")) -+ .endsWith("_LEGGINGS") -+ .ensureSize("LEGGINGS", 6).lock(); -+ -+ /** -+ * Covers the variants of boots. -+ */ -+ public static final MaterialSetTag BOOTS = new MaterialSetTag(keyFor("boots")) -+ .endsWith("_BOOTS") -+ .ensureSize("BOOTS", 6).lock(); -+ -+ /** -+ * Covers all variants of armor. -+ */ -+ public static final MaterialSetTag ARMOR = new MaterialSetTag(keyFor("armor")).add(HELMETS, CHESTPLATES, LEGGINGS, BOOTS) -+ .ensureSize("ARMOR", 25).lock(); -+ -+ /** -+ * Covers the variants of bows. -+ */ -+ public static final MaterialSetTag BOWS = new MaterialSetTag(keyFor("bows")) -+ .add(Material.BOW) -+ .add(Material.CROSSBOW) -+ .ensureSize("BOWS", 2).lock(); -+ -+ /** -+ * Covers the variants of player-throwable projectiles (not requiring a bow or any other "assistance"). -+ */ -+ public static final MaterialSetTag THROWABLE_PROJECTILES = new MaterialSetTag(keyFor("throwable_projectiles")) -+ .add(Material.EGG, Material.SNOWBALL, Material.SPLASH_POTION, Material.TRIDENT, Material.ENDER_PEARL, Material.EXPERIENCE_BOTTLE, Material.FIREWORK_ROCKET).lock(); -+ -+ /** -+ * Covers materials that can be colored, such as wool, shulker boxes, stained glass etc. -+ */ -+ @SuppressWarnings("unchecked") -+ public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable")) -+ .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS).lock(); -+ //.ensureSize("COLORABLE", 81).lock(); unit test don't have the vanilla item tags, so counts don't line up for real -+ -+ /** -+ * Covers the variants of coral. -+ */ -+ public static final MaterialSetTag CORAL = new MaterialSetTag(keyFor("coral")) -+ .endsWith("_CORAL") -+ .ensureSize("CORAL", 10).lock(); -+ -+ /** -+ * Covers the variants of coral fans. -+ */ -+ public static final MaterialSetTag CORAL_FANS = new MaterialSetTag(keyFor("coral_fans")) -+ .endsWith("_CORAL_FAN") -+ .endsWith("_CORAL_WALL_FAN") -+ .ensureSize("CORAL_FANS", 20).lock(); -+ -+ /** -+ * Covers the variants of coral blocks. -+ */ -+ public static final MaterialSetTag CORAL_BLOCKS = new MaterialSetTag(keyFor("coral_blocks")) -+ .endsWith("_CORAL_BLOCK") -+ .ensureSize("CORAL_BLOCKS", 10).lock(); -+ -+ /** -+ * Covers all items that can be enchanted from the enchantment table or anvil. -+ */ -+ public static final MaterialSetTag ENCHANTABLE = new MaterialSetTag(keyFor("enchantable")) -+ .add(PICKAXES, SWORDS, SHOVELS, AXES, HOES, HELMETS, CHEST_EQUIPPABLE, LEGGINGS, BOOTS, BOWS) -+ .add(Material.TRIDENT, Material.SHIELD, Material.FISHING_ROD, Material.SHEARS, -+ Material.FLINT_AND_STEEL, Material.CARROT_ON_A_STICK, Material.WARPED_FUNGUS_ON_A_STICK, -+ Material.BRUSH, Material.CARVED_PUMPKIN, Material.COMPASS, Material.SKELETON_SKULL, -+ Material.WITHER_SKELETON_SKULL, Material.PLAYER_HEAD, Material.ZOMBIE_HEAD, -+ Material.CREEPER_HEAD, Material.DRAGON_HEAD, Material.PIGLIN_HEAD) -+ .ensureSize("ENCHANTABLE", 75).lock(); -+ -+ /** -+ * Covers the variants of raw ores. -+ */ -+ public static final MaterialSetTag RAW_ORES = new MaterialSetTag(keyFor("raw_ores")) -+ .add(Material.RAW_COPPER, Material.RAW_GOLD, Material.RAW_IRON).lock(); -+ -+ /** -+ * Covers all command block types. -+ */ -+ public static final MaterialSetTag COMMAND_BLOCKS = new MaterialSetTag(keyFor("command_blocks")) -+ .endsWith("COMMAND_BLOCK") -+ .ensureSize("COMMAND_BLOCKS", 3).lock(); -+ -+ /** -+ * Covers the variants of deepslate ores. -+ */ -+ public static final MaterialSetTag DEEPSLATE_ORES = new MaterialSetTag(keyFor("deepslate_ores")) -+ .add(material -> material.name().startsWith("DEEPSLATE_") && material.name().endsWith("_ORE")) -+ .ensureSize("DEEPSLATE_ORES", 8).lock(); -+ -+ /** -+ * Covers the variants of raw ore blocks. -+ */ -+ public static final MaterialSetTag RAW_ORE_BLOCKS = new MaterialSetTag(keyFor("raw_ore_blocks")) -+ .add(Material.RAW_COPPER_BLOCK, Material.RAW_GOLD_BLOCK, Material.RAW_IRON_BLOCK).lock(); -+ -+ /** -+ * Covers all oxidized copper blocks. -+ */ -+ public static final MaterialSetTag OXIDIZED_COPPER_BLOCKS = new MaterialSetTag(keyFor("oxidized_copper_blocks")) -+ .startsWith("OXIDIZED_").startsWith("WAXED_OXIDIZED_").ensureSize("OXIDIZED_COPPER_BLOCKS", 18).lock(); -+ -+ /** -+ * Covers all weathered copper blocks. -+ */ -+ public static final MaterialSetTag WEATHERED_COPPER_BLOCKS = new MaterialSetTag(keyFor("weathered_copper_blocks")) -+ .startsWith("WEATHERED_").startsWith("WAXED_WEATHERED_").ensureSize("WEATHERED_COPPER_BLOCKS", 18).lock(); -+ -+ /** -+ * Covers all exposed copper blocks. -+ */ -+ public static final MaterialSetTag EXPOSED_COPPER_BLOCKS = new MaterialSetTag(keyFor("exposed_copper_blocks")) -+ .startsWith("EXPOSED_").startsWith("WAXED_EXPOSED_").ensureSize("EXPOSED_COPPER_BLOCKS", 18).lock(); -+ -+ /** -+ * Covers all un-weathered copper blocks. -+ */ -+ public static final MaterialSetTag UNAFFECTED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unaffected_copper_blocks")) -+ .startsWith("CUT_COPPER").startsWith("WAXED_CUT_COPPER") -+ .startsWith("WAXED_COPPER_").startsWith("COPPER_") -+ .add(Material.CHISELED_COPPER, Material.WAXED_CHISELED_COPPER) -+ .not(Material.COPPER_INGOT, Material.COPPER_ORE) -+ .ensureSize("UNAFFECTED_COPPER_BLOCKS", 18).lock(); -+ -+ /** -+ * Covers all waxed copper blocks. -+ *

-+ * Combine with other copper-related tags to filter is-waxed or not. -+ */ -+ public static final MaterialSetTag WAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("waxed_copper_blocks")) -+ .add(m -> m.name().startsWith("WAXED_") && m.name().contains("COPPER")).ensureSize("WAXED_COPPER_BLOCKS", 36).lock(); -+ -+ /** -+ * Covers all un-waxed copper blocks. -+ *

-+ * Combine with other copper-related tags to filter is-un-waxed or not. -+ */ -+ public static final MaterialSetTag UNWAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unwaxed_copper_blocks")) -+ .startsWith("EXPOSED_").startsWith("WEATHERED_").startsWith("OXIDIZED_") -+ .startsWith("CUT_COPPER") -+ .add(Material.COPPER_BLOCK, Material.CHISELED_COPPER, Material.COPPER_DOOR, Material.COPPER_TRAPDOOR, Material.COPPER_GRATE, Material.COPPER_BULB) -+ .ensureSize("UNWAXED_COPPER_BLOCKS", 36).lock(); -+ -+ /** -+ * Covers all copper block variants. -+ */ -+ public static final MaterialSetTag COPPER_BLOCKS = new MaterialSetTag(keyFor("copper_blocks")) -+ .add(WAXED_COPPER_BLOCKS).add(UNWAXED_COPPER_BLOCKS).ensureSize("COPPER_BLOCKS", 72).lock(); -+ -+ /** -+ * Covers all weathering/waxed states of the plain copper block. -+ */ -+ public static final MaterialSetTag FULL_COPPER_BLOCKS = new MaterialSetTag(keyFor("full_copper_blocks")) -+ .endsWith("OXIDIZED_COPPER") -+ .endsWith("WEATHERED_COPPER") -+ .endsWith("EXPOSED_COPPER") -+ .endsWith("COPPER_BLOCK") -+ .not(Material.RAW_COPPER_BLOCK) -+ .ensureSize("FULL_COPPER_BLOCKS", 8).lock(); -+ -+ /** -+ * Covers all weathering/waxed states of the cut copper block. -+ */ -+ public static final MaterialSetTag CUT_COPPER_BLOCKS = new MaterialSetTag(keyFor("cut_copper_blocks")) -+ .endsWith("CUT_COPPER").ensureSize("CUT_COPPER_BLOCKS", 8).lock(); -+ -+ /** -+ * Covers all weathering/waxed states of the cut copper stairs. -+ */ -+ public static final MaterialSetTag CUT_COPPER_STAIRS = new MaterialSetTag(keyFor("cut_copper_stairs")) -+ .endsWith("CUT_COPPER_STAIRS").ensureSize("CUT_COPPER_STAIRS", 8).lock(); -+ -+ /** -+ * Covers all weathering/waxed states of the cut copper slab. -+ */ -+ public static final MaterialSetTag CUT_COPPER_SLABS = new MaterialSetTag(keyFor("cut_copper_slabs")) -+ .endsWith("CUT_COPPER_SLAB").ensureSize("CUT_COPPER_SLABS", 8).lock(); -+ -+ /** -+ * Covers all Wooden Tools. -+ */ -+ public static final MaterialSetTag WOODEN_TOOLS = new MaterialSetTag(keyFor("wooden_tools")) -+ .add(Material.WOODEN_AXE, Material.WOODEN_HOE, Material.WOODEN_PICKAXE, Material.WOODEN_SHOVEL, Material.WOODEN_SWORD) -+ .ensureSize("WOODEN_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Stone Tools. -+ */ -+ public static final MaterialSetTag STONE_TOOLS = new MaterialSetTag(keyFor("stone_tools")) -+ .add(Material.STONE_AXE, Material.STONE_HOE, Material.STONE_PICKAXE, Material.STONE_SHOVEL, Material.STONE_SWORD) -+ .ensureSize("STONE_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Iron Tools. -+ */ -+ public static final MaterialSetTag IRON_TOOLS = new MaterialSetTag(keyFor("iron_tools")) -+ .add(Material.IRON_AXE, Material.IRON_HOE, Material.IRON_PICKAXE, Material.IRON_SHOVEL, Material.IRON_SWORD) -+ .ensureSize("IRON_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Gold Tools. -+ */ -+ public static final MaterialSetTag GOLDEN_TOOLS = new MaterialSetTag(keyFor("golden_tools")) -+ .add(Material.GOLDEN_AXE, Material.GOLDEN_HOE, Material.GOLDEN_PICKAXE, Material.GOLDEN_SHOVEL, Material.GOLDEN_SWORD) -+ .ensureSize("GOLDEN_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Diamond Tools. -+ */ -+ public static final MaterialSetTag DIAMOND_TOOLS = new MaterialSetTag(keyFor("diamond_tools")) -+ .add(Material.DIAMOND_AXE, Material.DIAMOND_HOE, Material.DIAMOND_PICKAXE, Material.DIAMOND_SHOVEL, Material.DIAMOND_SWORD) -+ .ensureSize("DIAMOND_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Netherite Tools. -+ */ -+ public static final MaterialSetTag NETHERITE_TOOLS = new MaterialSetTag(keyFor("netherite_tools")) -+ .add(Material.NETHERITE_AXE, Material.NETHERITE_HOE, Material.NETHERITE_PICKAXE, Material.NETHERITE_SHOVEL, Material.NETHERITE_SWORD) -+ .ensureSize("NETHERITE_TOOLS", 5).lock(); -+ -+} -diff --git a/src/main/java/io/papermc/paper/tag/BaseTag.java b/src/main/java/io/papermc/paper/tag/BaseTag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/tag/BaseTag.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.tag; -+ -+import com.google.common.collect.Lists; -+import java.util.Collections; -+import org.bukkit.Keyed; -+import org.bukkit.NamespacedKey; -+import org.bukkit.Tag; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.Collection; -+import java.util.EnumSet; -+import java.util.HashSet; -+import java.util.List; -+import java.util.Set; -+import java.util.function.Predicate; -+import java.util.stream.Collectors; -+ -+public abstract class BaseTag> implements Tag { -+ -+ protected final NamespacedKey key; -+ protected final Set tagged; -+ private final List> globalPredicates; -+ private boolean locked = false; -+ -+ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Predicate filter) { -+ this(clazz, key); -+ add(filter); -+ } -+ -+ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull T...values) { -+ this(clazz, key, Lists.newArrayList(values)); -+ } -+ -+ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Collection values) { -+ this(clazz, key, values, o -> true); -+ } -+ -+ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Collection values, @NotNull Predicate... globalPredicates) { -+ this.key = key; -+ this.tagged = clazz.isEnum() ? createEnumSet(clazz) : new HashSet<>(); -+ this.tagged.addAll(values); -+ this.globalPredicates = Lists.newArrayList(globalPredicates); -+ } -+ -+ private Set createEnumSet(Class enumClass) { -+ assert enumClass.isEnum(); -+ return (Set) EnumSet.noneOf((Class) enumClass); -+ } -+ -+ public @NotNull C lock() { -+ this.locked = true; -+ return (C) this; -+ } -+ -+ public boolean isLocked() { -+ return this.locked; -+ } -+ -+ private void checkLock() { -+ if (this.locked) { -+ throw new UnsupportedOperationException("Tag (" + this.key + ") is locked"); -+ } -+ } -+ -+ @NotNull -+ @Override -+ public NamespacedKey getKey() { -+ return key; -+ } -+ -+ @NotNull -+ @Override -+ public Set getValues() { -+ return Collections.unmodifiableSet(tagged); -+ } -+ -+ @Override -+ public boolean isTagged(@NotNull T item) { -+ return tagged.contains(item); -+ } -+ -+ @NotNull -+ public C add(@NotNull Tag...tags) { -+ for (Tag tag : tags) { -+ add(tag.getValues()); -+ } -+ return (C) this; -+ } -+ -+ @NotNull -+ public C add(@NotNull T...values) { -+ this.checkLock(); -+ this.tagged.addAll(Lists.newArrayList(values)); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C add(@NotNull Collection collection) { -+ this.checkLock(); -+ this.tagged.addAll(collection); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C add(@NotNull Predicate filter) { -+ return add(getAllPossibleValues().stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).filter(filter).collect(Collectors.toSet())); -+ } -+ -+ @NotNull -+ public C contains(@NotNull String with) { -+ return add(value -> getName(value).contains(with)); -+ } -+ -+ @NotNull -+ public C endsWith(@NotNull String with) { -+ return add(value -> getName(value).endsWith(with)); -+ } -+ -+ @NotNull -+ public C startsWith(@NotNull String with) { -+ return add(value -> getName(value).startsWith(with)); -+ } -+ -+ @NotNull -+ public C not(@NotNull Tag...tags) { -+ for (Tag tag : tags) { -+ not(tag.getValues()); -+ } -+ return (C) this; -+ } -+ -+ @NotNull -+ public C not(@NotNull T...values) { -+ this.checkLock(); -+ this.tagged.removeAll(Lists.newArrayList(values)); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C not(@NotNull Collection values) { -+ this.checkLock(); -+ this.tagged.removeAll(values); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C not(@NotNull Predicate filter) { -+ not(getAllPossibleValues().stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).filter(filter).collect(Collectors.toSet())); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C notContains(@NotNull String with) { -+ return not(value -> getName(value).contains(with)); -+ } -+ -+ @NotNull -+ public C notEndsWith(@NotNull String with) { -+ return not(value -> getName(value).endsWith(with)); -+ } -+ -+ @NotNull -+ public C notStartsWith(@NotNull String with) { -+ return not(value -> getName(value).startsWith(with)); -+ } -+ -+ @NotNull -+ public C ensureSize(@NotNull String label, int size) { -+ long actual = this.tagged.stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).count(); -+ if (size != actual) { -+ throw new IllegalStateException(key.toString() + ": " + label + " - Expected " + size + " values, got " + actual); -+ } -+ return (C) this; -+ } -+ -+ @NotNull -+ @ApiStatus.Internal -+ protected abstract Set getAllPossibleValues(); -+ -+ @NotNull -+ @ApiStatus.Internal -+ protected abstract String getName(@NotNull T value); -+} -diff --git a/src/main/java/io/papermc/paper/tag/EntitySetTag.java b/src/main/java/io/papermc/paper/tag/EntitySetTag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/tag/EntitySetTag.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.tag; -+ -+import org.bukkit.NamespacedKey; -+import org.bukkit.entity.EntityType; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.Collection; -+import java.util.Set; -+import java.util.function.Predicate; -+import java.util.stream.Collectors; -+import java.util.stream.Stream; -+ -+public class EntitySetTag extends BaseTag { -+ -+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Predicate filter) { -+ super(EntityType.class, key, filter); -+ } -+ -+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull EntityType... values) { -+ super(EntityType.class, key, values); -+ } -+ -+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Collection values) { -+ super(EntityType.class, key, values); -+ } -+ -+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Collection values, @NotNull Predicate... globalPredicates) { -+ super(EntityType.class, key, values, globalPredicates); -+ } -+ -+ @NotNull -+ @Override -+ protected Set getAllPossibleValues() { -+ return Stream.of(EntityType.values()).collect(Collectors.toSet()); -+ } -+ -+ @NotNull -+ @Override -+ protected String getName(@NotNull EntityType value) { -+ return value.name(); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/tag/EntityTags.java b/src/main/java/io/papermc/paper/tag/EntityTags.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/tag/EntityTags.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.tag; -+ -+import org.bukkit.NamespacedKey; -+ -+import static org.bukkit.entity.EntityType.*; -+ -+/** -+ * All tags in this class are unmodifiable, attempting to modify them will throw an -+ * {@link UnsupportedOperationException}. -+ */ -+public class EntityTags { -+ -+ private static NamespacedKey keyFor(String key) { -+ //noinspection deprecation -+ return new NamespacedKey("paper", key + "_settag"); -+ } -+ -+ /** -+ * Covers undead mobs -+ * @see https://minecraft.wiki/wiki/Mob#Undead_mobs -+ */ -+ public static final EntitySetTag UNDEADS = new EntitySetTag(keyFor("undeads")) -+ .add(DROWNED, HUSK, PHANTOM, SKELETON, SKELETON_HORSE, STRAY, WITHER, WITHER_SKELETON, ZOGLIN, ZOMBIE, ZOMBIE_HORSE, ZOMBIE_VILLAGER, ZOMBIFIED_PIGLIN, BOGGED) -+ .ensureSize("UNDEADS", 14).lock(); -+ -+ /** -+ * Covers all horses -+ */ -+ public static final EntitySetTag HORSES = new EntitySetTag(keyFor("horses")) -+ .contains("HORSE") -+ .ensureSize("HORSES", 3).lock(); -+ -+ /** -+ * Covers all minecarts -+ */ -+ public static final EntitySetTag MINECARTS = new EntitySetTag(keyFor("minecarts")) -+ .contains("MINECART") -+ .ensureSize("MINECARTS", 7).lock(); -+ -+ /** -+ * Covers mobs that split into smaller mobs -+ */ -+ public static final EntitySetTag SPLITTING_MOBS = new EntitySetTag(keyFor("splitting_mobs")) -+ .add(SLIME, MAGMA_CUBE) -+ .ensureSize("SLIMES", 2).lock(); -+ -+ /** -+ * Covers all water based mobs -+ * @see https://minecraft.wiki/wiki/Mob#Aquatic_mobs -+ * @deprecated in favour of {@link org.bukkit.Tag#ENTITY_TYPES_AQUATIC} -+ */ -+ @Deprecated -+ public static final EntitySetTag WATER_BASED = new EntitySetTag(keyFor("water_based")) -+ .add(AXOLOTL, DOLPHIN, SQUID, GLOW_SQUID, GUARDIAN, ELDER_GUARDIAN, TURTLE, COD, SALMON, PUFFERFISH, TROPICAL_FISH, TADPOLE) -+ .ensureSize("WATER_BASED", 12).lock(); -+} -diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Tag.java -+++ b/src/main/java/org/bukkit/Tag.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - * Note that whilst all tags defined within this interface must be present in - * implementations, their existence is not guaranteed across future versions. - * -+ *

Custom tags defined by Paper are not present (as constants) in this class. -+ * To access them please refer to {@link com.destroystokyo.paper.MaterialTags} -+ * and {@link io.papermc.paper.tag.EntityTags}.

-+ * - * @param the type of things grouped by this tag - */ - public interface Tag extends Keyed { -diff --git a/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java -@@ -0,0 +0,0 @@ -+/* -+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License -+ */ -+ -+package com.destroystokyo.paper; -+ -+import io.papermc.paper.tag.BaseTag; -+import io.papermc.paper.tag.EntityTags; -+import java.lang.reflect.Field; -+import java.lang.reflect.Modifier; -+import java.util.HashSet; -+import java.util.Set; -+import java.util.logging.Level; -+import org.bukkit.Bukkit; -+import org.bukkit.support.AbstractTestingBase; -+import org.junit.jupiter.api.Test; -+ -+import static org.junit.jupiter.api.Assertions.assertTrue; -+ -+public class MaterialTagsTest extends AbstractTestingBase { -+ -+ @Test -+ public void testInitialize() { -+ try { -+ MaterialTags.SHULKER_BOXES.getValues(); -+ assert true; -+ } catch (Throwable e) { -+ Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); -+ assert false; -+ } -+ } -+ -+ @Test -+ public void testLocked() { -+ testLocked(MaterialTags.class); -+ testLocked(EntityTags.class); -+ } -+ -+ private static void testLocked(Class clazz) { -+ for (BaseTag tag : collectTags(clazz)) { -+ assertTrue(tag.isLocked(), "Tag " + tag.key() + " is not locked"); -+ } -+ } -+ -+ private static Set> collectTags(Class clazz) { -+ Set> tags = new HashSet<>(); -+ try { -+ for (Field field : clazz.getDeclaredFields()) { -+ if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && BaseTag.class.isAssignableFrom(field.getType())) { -+ tags.add((BaseTag) field.get(null)); -+ } -+ } -+ } catch (IllegalAccessException e) { -+ e.printStackTrace(); -+ } -+ return tags; -+ } -+} -diff --git a/src/test/java/io/papermc/paper/EntityTagsTest.java b/src/test/java/io/papermc/paper/EntityTagsTest.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/test/java/io/papermc/paper/EntityTagsTest.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper; -+ -+import io.papermc.paper.tag.EntityTags; -+import java.util.logging.Level; -+import org.bukkit.Bukkit; -+import org.bukkit.support.AbstractTestingBase; -+import org.junit.jupiter.api.Test; -+ -+public class EntityTagsTest extends AbstractTestingBase { -+ -+ @Test -+ public void testInitialize() { -+ try { -+ EntityTags.HORSES.getValues(); -+ assert true; -+ } catch (Throwable e) { -+ Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); -+ assert false; -+ } -+ } -+} diff --git a/patches/api/Add-MetadataStoreBase.removeAll-Plugin.patch b/patches/api/Add-MetadataStoreBase.removeAll-Plugin.patch deleted file mode 100644 index e6d7abc340..0000000000 --- a/patches/api/Add-MetadataStoreBase.removeAll-Plugin.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 16 Jul 2013 21:26:50 -0400 -Subject: [PATCH] Add MetadataStoreBase.removeAll(Plugin) - -So that on reload, metadata will be cleared - -diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java -+++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java -@@ -0,0 +0,0 @@ import java.util.ArrayList; - import java.util.Collection; - import java.util.Collections; - import java.util.HashMap; -+import java.util.Iterator; // Paper - import java.util.List; - import java.util.Map; - import java.util.WeakHashMap; -@@ -0,0 +0,0 @@ public abstract class MetadataStoreBase { - } - } - -+ /** -+ * Removes all metadata in the metadata store that originates from the -+ * given plugin. -+ * -+ * @param owningPlugin the plugin requesting the invalidation. -+ * @throws IllegalArgumentException If plugin is null -+ */ -+ public void removeAll(@NotNull Plugin owningPlugin) { -+ Preconditions.checkNotNull(owningPlugin, "Plugin cannot be null"); -+ for (Iterator> iterator = metadataMap.values().iterator(); iterator.hasNext(); ) { -+ Map values = iterator.next(); -+ if (values.containsKey(owningPlugin)) { -+ values.remove(owningPlugin); -+ } -+ if (values.isEmpty()) { -+ iterator.remove(); -+ } -+ } -+ } -+ - /** - * Creates a unique name for the object receiving metadata by combining - * unique data from the subject with a metadataKey. diff --git a/patches/api/Add-Mob-Experience-reward-API.patch b/patches/api/Add-Mob-Experience-reward-API.patch deleted file mode 100644 index ee4c73e085..0000000000 --- a/patches/api/Add-Mob-Experience-reward-API.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: GodOfPro <1387ilia@gmail.com> -Date: Tue, 11 Apr 2023 16:30:58 +0430 -Subject: [PATCH] Add Mob Experience reward API - - -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -0,0 +0,0 @@ public interface Mob extends LivingEntity, Lootable { - */ - public void setLeftHanded(boolean leftHanded); - // Paper end - left-handed API -+ -+ // Paper start - mob xp reward API -+ /** -+ * Gets the amount of experience the mob will possibly drop. This value is randomized and it can give different results -+ * -+ * @return the amount of experience the mob will possibly drop -+ */ -+ public int getPossibleExperienceReward(); -+ // Paper end - mob xp reward API - } diff --git a/patches/api/Add-Mob-Goal-API.patch b/patches/api/Add-Mob-Goal-API.patch deleted file mode 100644 index c0e8a59612..0000000000 --- a/patches/api/Add-Mob-Goal-API.patch +++ /dev/null @@ -1,250 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MiniDigger | Martin -Date: Fri, 3 Jan 2020 16:24:46 +0100 -Subject: [PATCH] Add Mob Goal API - - -diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java b/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.entity.ai; -+ -+import java.util.EnumSet; -+import org.bukkit.entity.Mob; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Represents an AI goal of an entity -+ */ -+@NullMarked -+public interface Goal { -+ -+ /** -+ * Checks if this goal should be activated -+ * -+ * @return if this goal should be activated -+ */ -+ boolean shouldActivate(); -+ -+ /** -+ * Checks if this goal should stay active, defaults to {@link Goal#shouldActivate()} -+ * -+ * @return if this goal should stay active -+ */ -+ default boolean shouldStayActive() { -+ return this.shouldActivate(); -+ } -+ -+ /** -+ * Called when this goal gets activated -+ */ -+ default void start() { -+ } -+ -+ /** -+ * Called when this goal gets stopped -+ */ -+ default void stop() { -+ } -+ -+ /** -+ * Called each tick the goal is activated -+ */ -+ default void tick() { -+ } -+ -+ /** -+ * A unique key that identifies this type of goal. Plugins should use their own namespace, not the minecraft -+ * namespace. Additionally, this key also specifies to what mobs this goal can be applied to -+ * -+ * @return the goal key -+ */ -+ GoalKey getKey(); -+ -+ /** -+ * Returns a list of all applicable flags for this goal.
-+ *

-+ * This method is only called on construction. -+ * -+ * @return the subtypes. -+ */ -+ EnumSet getTypes(); -+} -diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java b/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.entity.ai; -+ -+import com.google.common.base.Objects; -+import java.util.StringJoiner; -+import org.bukkit.NamespacedKey; -+import org.bukkit.entity.Mob; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Used to identify a Goal. Consists of a {@link NamespacedKey} and the type of mob the goal can be applied to -+ * -+ * @param the type of mob the goal can be applied to -+ */ -+@NullMarked -+public final class GoalKey { -+ -+ private final Class entityClass; -+ private final NamespacedKey namespacedKey; -+ -+ private GoalKey(Class entityClass, NamespacedKey namespacedKey) { -+ this.entityClass = entityClass; -+ this.namespacedKey = namespacedKey; -+ } -+ -+ public Class getEntityClass() { -+ return this.entityClass; -+ } -+ -+ public NamespacedKey getNamespacedKey() { -+ return this.namespacedKey; -+ } -+ -+ @Override -+ public boolean equals(@Nullable Object o) { -+ if (this == o) return true; -+ if (o == null || this.getClass() != o.getClass()) return false; -+ GoalKey goalKey = (GoalKey) o; -+ return Objects.equal(this.entityClass, goalKey.entityClass) && -+ Objects.equal(this.namespacedKey, goalKey.namespacedKey); -+ } -+ -+ @Override -+ public int hashCode() { -+ return Objects.hashCode(this.entityClass, this.namespacedKey); -+ } -+ -+ @Override -+ public String toString() { -+ return new StringJoiner(", ", GoalKey.class.getSimpleName() + "[", "]") -+ .add("entityClass=" + this.entityClass) -+ .add("namespacedKey=" + this.namespacedKey) -+ .toString(); -+ } -+ -+ public static GoalKey of(Class entityClass, NamespacedKey namespacedKey) { -+ return new GoalKey<>(entityClass, namespacedKey); -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java b/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.entity.ai; -+ -+/** -+ * Represents the subtype of a goal. Used by minecraft to disable certain types of goals if needed. -+ */ -+public enum GoalType { -+ -+ MOVE, -+ LOOK, -+ JUMP, -+ TARGET, -+ /** -+ * Used to map vanilla goals, that are a behavior goal but don't have a type set... -+ */ -+ UNKNOWN_BEHAVIOR, -+ -+} -diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.entity.ai; -+ -+ -+import java.util.Collection; -+import org.bukkit.entity.Mob; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Represents a part of the "brain" of a mob. It tracks all tasks (running or not), allows adding and removing goals -+ */ -+@NullMarked -+public interface MobGoals { -+ -+ void addGoal(T mob, int priority, Goal goal); -+ -+ void removeGoal(T mob, Goal goal); -+ -+ void removeAllGoals(T mob); -+ -+ void removeAllGoals(T mob, GoalType type); -+ -+ void removeGoal(T mob, GoalKey key); -+ -+ boolean hasGoal(T mob, GoalKey key); -+ -+ @Nullable Goal getGoal(T mob, GoalKey key); -+ -+ Collection> getGoals(T mob, GoalKey key); -+ -+ Collection> getAllGoals(T mob); -+ -+ Collection> getAllGoals(T mob, GoalType type); -+ -+ Collection> getAllGoalsWithout(T mob, GoalType type); -+ -+ Collection> getRunningGoals(T mob); -+ -+ Collection> getRunningGoals(T mob, GoalType type); -+ -+ Collection> getRunningGoalsWithout(T mob, GoalType type); -+} -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - public static boolean isStopping() { - return server.isStopping(); - } -+ -+ /** -+ * Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager -+ * -+ * @return the mob goals manager -+ */ -+ @NotNull -+ public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { -+ return server.getMobGoals(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * @return true if server is in the process of being shutdown - */ - boolean isStopping(); -+ -+ /** -+ * Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager -+ * -+ * @return the mob goals manager -+ */ -+ @NotNull -+ com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); - // Paper end - } diff --git a/patches/api/Add-Mob-lookAt-API.patch b/patches/api/Add-Mob-lookAt-API.patch deleted file mode 100644 index ba87ab0181..0000000000 --- a/patches/api/Add-Mob-lookAt-API.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 14 May 2021 13:42:06 -0500 -Subject: [PATCH] Add Mob#lookAt API - - -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -0,0 +0,0 @@ public interface Mob extends LivingEntity, Lootable { - * @return True if mob is exposed to daylight - */ - boolean isInDaylight(); -+ -+ /** -+ * Instruct this Mob to look at a specific Location -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param location location to look at -+ */ -+ void lookAt(@NotNull org.bukkit.Location location); -+ -+ /** -+ * Instruct this Mob to look at a specific Location -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param location location to look at -+ * @param headRotationSpeed head rotation speed -+ * @param maxHeadPitch max head pitch rotation -+ */ -+ void lookAt(@NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch); -+ -+ /** -+ * Instruct this Mob to look at a specific Entity -+ *

-+ * If a LivingEntity, look at eye location -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param entity entity to look at -+ */ -+ void lookAt(@NotNull Entity entity); -+ -+ /** -+ * Instruct this Mob to look at a specific Entity -+ *

-+ * If a LivingEntity, look at eye location -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param entity entity to look at -+ * @param headRotationSpeed head rotation speed -+ * @param maxHeadPitch max head pitch rotation -+ */ -+ void lookAt(@NotNull Entity entity, float headRotationSpeed, float maxHeadPitch); -+ -+ /** -+ * Instruct this Mob to look at a specific position -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param x x coordinate -+ * @param y y coordinate -+ * @param z z coordinate -+ */ -+ void lookAt(double x, double y, double z); -+ -+ /** -+ * Instruct this Mob to look at a specific position -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param x x coordinate -+ * @param y y coordinate -+ * @param z z coordinate -+ * @param headRotationSpeed head rotation speed -+ * @param maxHeadPitch max head pitch rotation -+ */ -+ void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch); -+ -+ /** -+ * Gets the head rotation speed -+ * -+ * @return the head rotation speed -+ */ -+ int getHeadRotationSpeed(); -+ -+ /** -+ * Gets the max head pitch rotation -+ * -+ * @return the max head pitch rotation -+ */ -+ int getMaxHeadPitch(); - // Paper end - /** - * Instructs this Mob to set the specified LivingEntity as its target. diff --git a/patches/api/Add-More-Creeper-API.patch b/patches/api/Add-More-Creeper-API.patch deleted file mode 100644 index fef0692fb9..0000000000 --- a/patches/api/Add-More-Creeper-API.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 24 Aug 2018 11:50:16 -0500 -Subject: [PATCH] Add More Creeper API - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.Creeper; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a Creeper is ignited either by a -+ * flint and steel, {@link Creeper#ignite()} or -+ * {@link Creeper#setIgnited(boolean)}. -+ */ -+@NullMarked -+public class CreeperIgniteEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean ignited; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public CreeperIgniteEvent(final Creeper creeper, final boolean ignited) { -+ super(creeper); -+ this.ignited = ignited; -+ } -+ -+ @Override -+ public Creeper getEntity() { -+ return (Creeper) super.getEntity(); -+ } -+ -+ public boolean isIgnited() { -+ return this.ignited; -+ } -+ -+ public void setIgnited(final boolean ignited) { -+ this.ignited = ignited; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Creeper.java -+++ b/src/main/java/org/bukkit/entity/Creeper.java -@@ -0,0 +0,0 @@ public interface Creeper extends Monster { - */ - @Nullable - public Entity getIgniter(); -+ // Paper start -+ -+ /** -+ * Set whether creeper is ignited or not (armed to explode) -+ * -+ * @param ignited New ignited state -+ */ -+ public void setIgnited(boolean ignited); -+ -+ /** -+ * Check if creeper is ignited or not (armed to explode) -+ * -+ * @return Ignited state -+ */ -+ public boolean isIgnited(); -+ // Paper end - } diff --git a/patches/api/Add-Moving-Piston-API.patch b/patches/api/Add-Moving-Piston-API.patch deleted file mode 100644 index a60304ac9b..0000000000 --- a/patches/api/Add-Moving-Piston-API.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sat, 4 Dec 2021 13:29:45 -0500 -Subject: [PATCH] Add Moving Piston API - - -diff --git a/src/main/java/io/papermc/paper/block/MovingPiston.java b/src/main/java/io/papermc/paper/block/MovingPiston.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/MovingPiston.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.block; -+ -+import org.bukkit.block.BlockFace; -+import org.bukkit.block.TileState; -+import org.bukkit.block.data.BlockData; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+public interface MovingPiston extends TileState { -+ -+ /** -+ * Gets the block that is being pushed -+ * -+ * @return the pushed block -+ */ -+ BlockData getMovingBlock(); -+ -+ /** -+ * The direction that the current moving piston -+ * is pushing/pulling a block in. -+ * -+ * @return the direction -+ */ -+ BlockFace getDirection(); -+ -+ /** -+ * Gets if the piston is extending or not. -+ * Returns false if the piston is retracting. -+ * -+ * @return is extending or not -+ */ -+ boolean isExtending(); -+ -+ /** -+ * Returns if this moving piston represents the main piston head -+ * from the original piston. -+ * -+ * @return is the piston head or not -+ */ -+ boolean isPistonHead(); -+ -+} diff --git a/patches/api/Add-NamespacedKey-biome-methods.patch b/patches/api/Add-NamespacedKey-biome-methods.patch deleted file mode 100644 index 988dde154f..0000000000 --- a/patches/api/Add-NamespacedKey-biome-methods.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Sun, 14 Aug 2022 12:22:54 -0400 -Subject: [PATCH] Add NamespacedKey biome methods - -Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ public interface UnsafeValues { - */ - @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); - // Paper end -+ -+ // Paper start - namespaced key biome methods -+ /** -+ * Gets the {@link NamespacedKey} for the biome at the given location. -+ * -+ * @param accessor The {@link RegionAccessor} of the provided coordinates -+ * @param x X-coordinate of the block -+ * @param y Y-coordinate of the block -+ * @param z Z-coordinate of the block -+ * @deprecated custom biomes are properly supported in API now -+ * @return the biome's {@link NamespacedKey} -+ */ -+ @org.jetbrains.annotations.NotNull -+ @Deprecated(since = "1.21.3", forRemoval = true) -+ NamespacedKey getBiomeKey(RegionAccessor accessor, int x, int y, int z); -+ -+ /** -+ * Sets the biome at the given location to a biome registered -+ * to the given {@link NamespacedKey}. If no biome by the given -+ * {@link NamespacedKey} exists, an {@link IllegalStateException} -+ * will be thrown. -+ * -+ * @param accessor The {@link RegionAccessor} of the provided coordinates -+ * @param x X-coordinate of the block -+ * @param y Y-coordinate of the block -+ * @param z Z-coordinate of the block -+ * @param biomeKey Biome key -+ * @deprecated custom biomes are properly supported in API now -+ * @throws IllegalStateException if no biome by the given key is registered. -+ */ -+ @Deprecated(since = "1.21.3", forRemoval = true) -+ void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey); -+ // Paper end - namespaced key biome methods - } diff --git a/patches/api/Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/api/Add-OBSTRUCTED-reason-to-BedEnterResult.patch deleted file mode 100644 index 7d32a06443..0000000000 --- a/patches/api/Add-OBSTRUCTED-reason-to-BedEnterResult.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 24 Dec 2020 12:43:30 -0800 -Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java b/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java -@@ -0,0 +0,0 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable { - * Entering the bed is prevented due to the player being too far away. - */ - TOO_FAR_AWAY, -+ // Paper start -+ /** -+ * Bed was obstructed. -+ */ -+ OBSTRUCTED, -+ // Paper end - /** - * Entering the bed is prevented due to there being monsters nearby. - */ diff --git a/patches/api/Add-Offline-PDC-API.patch b/patches/api/Add-Offline-PDC-API.patch deleted file mode 100644 index 3c9c2fb25c..0000000000 --- a/patches/api/Add-Offline-PDC-API.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> -Date: Sat, 9 Jul 2022 17:17:04 +0200 -Subject: [PATCH] Add Offline PDC API - - -diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/OfflinePlayer.java -+++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * player that is stored on the disk and can, thus, be retrieved without the - * player needing to be online. - */ --public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable { -+public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, io.papermc.paper.persistence.PersistentDataViewHolder { // Paper - Add Offline PDC API - - /** - * Checks if this player is currently online -@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - */ - @Nullable - public Location getLocation(); -+ // Paper start - add pdc to offline player -+ /** -+ * Yields a view of the persistent data container for this offline player. -+ * In case this {@link OfflinePlayer} instance was created for an offline player, the returned view will wrap the persistent -+ * data on disk. -+ *

-+ * As such, this method as well as queries to the {@link io.papermc.paper.persistence.PersistentDataContainerView} -+ * may produce blocking IO requests to read the requested data from disk. -+ * Caution in its usage is hence advised. -+ * -+ * @return the persistent data container view -+ * @see io.papermc.paper.persistence.PersistentDataViewHolder#getPersistentDataContainer() -+ */ -+ @Override -+ io.papermc.paper.persistence.@NotNull PersistentDataContainerView getPersistentDataContainer(); -+ // Paper end - add pdc to offline player - } diff --git a/patches/api/Add-OfflinePlayer-isConnected.patch b/patches/api/Add-OfflinePlayer-isConnected.patch deleted file mode 100644 index 3d284ca66b..0000000000 --- a/patches/api/Add-OfflinePlayer-isConnected.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aeltumn -Date: Thu, 24 Aug 2023 13:05:07 +0200 -Subject: [PATCH] Add OfflinePlayer#isConnected - -This adds an alternative to OfflinePlayer#isOnline that returns true only if the same instance of the player is still online. This is generally more useful than isOnline as it allows you to determine if you have an instance of a Player that still exists. If a player relogs an old Player instance becomes unlinked leading to e.g. messages sent to the old player no longer arriving despite isOnline returning true. Checking against isConnected is more useful there to discard invalid instances. - -diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/OfflinePlayer.java -+++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - /** - * Checks if this player is currently online - * -+ * It should be noted that this will return true if any instance of this player is -+ * online! This instance may have disconnected. If you wish to check if this specific -+ * instance of the player is still online, see {@link OfflinePlayer#isConnected()}. -+ * - * @return true if they are online - */ - public boolean isOnline(); - -+ // Paper start -+ /** -+ * Checks whether the connection to this player is still valid. This will return -+ * true as long as this specific instance of the player is still connected. This -+ * will return false after this instance has disconnected, even if the same player -+ * has reconnected since. -+ * -+ * @return true if this player instance is connected -+ */ -+ public boolean isConnected(); -+ // Paper end -+ - /** - * Returns the name of this player - *

diff --git a/patches/api/Add-PhantomPreSpawnEvent.patch b/patches/api/Add-PhantomPreSpawnEvent.patch deleted file mode 100644 index 053618ad6f..0000000000 --- a/patches/api/Add-PhantomPreSpawnEvent.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sat, 25 Aug 2018 19:56:42 -0500 -Subject: [PATCH] Add PhantomPreSpawnEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.EntityType; -+import org.bukkit.event.entity.CreatureSpawnEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a phantom is spawned for an exhausted player -+ */ -+@NullMarked -+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent { -+ -+ private final Entity entity; -+ -+ @ApiStatus.Internal -+ public PhantomPreSpawnEvent(final Location location, final Entity entity, final CreatureSpawnEvent.SpawnReason reason) { -+ super(location, EntityType.PHANTOM, reason); -+ this.entity = entity; -+ } -+ -+ /** -+ * Get the entity this phantom is spawning for -+ * -+ * @return the Entity -+ */ -+ public Entity getSpawningEntity() { -+ return this.entity; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Phantom.java -+++ b/src/main/java/org/bukkit/entity/Phantom.java -@@ -0,0 +0,0 @@ - package org.bukkit.entity; - -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ - /** - * Represents a phantom. - */ -@@ -0,0 +0,0 @@ public interface Phantom extends Flying, Enemy { - * @param sz The new size of the phantom. - */ - public void setSize(int sz); -+ -+ // Paper start -+ /** -+ * Get the UUID of the entity that caused this phantom to spawn -+ * -+ * @return UUID -+ */ -+ @Nullable -+ public java.util.UUID getSpawningEntity(); -+ // Paper end - } diff --git a/patches/api/Add-Player-Client-Options-API.patch b/patches/api/Add-Player-Client-Options-API.patch deleted file mode 100644 index f7d3de95c7..0000000000 --- a/patches/api/Add-Player-Client-Options-API.patch +++ /dev/null @@ -1,280 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MiniDigger | Martin -Date: Mon, 20 Jan 2020 21:38:34 +0100 -Subject: [PATCH] Add Player Client Options API - - -diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/ClientOption.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper; -+ -+import net.kyori.adventure.translation.Translatable; -+import net.kyori.adventure.util.Index; -+import org.bukkit.inventory.MainHand; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+public final class ClientOption { -+ -+ public static final ClientOption SKIN_PARTS = new ClientOption<>(SkinParts.class); -+ public static final ClientOption CHAT_COLORS_ENABLED = new ClientOption<>(Boolean.class); -+ public static final ClientOption CHAT_VISIBILITY = new ClientOption<>(ChatVisibility.class); -+ public static final ClientOption LOCALE = new ClientOption<>(String.class); -+ public static final ClientOption MAIN_HAND = new ClientOption<>(MainHand.class); -+ public static final ClientOption VIEW_DISTANCE = new ClientOption<>(Integer.class); -+ public static final ClientOption TEXT_FILTERING_ENABLED = new ClientOption<>(Boolean.class); -+ public static final ClientOption ALLOW_SERVER_LISTINGS = new ClientOption<>(Boolean.class); -+ public static final ClientOption PARTICLE_VISIBILITY = new ClientOption<>(ParticleVisibility.class); -+ -+ private final Class type; -+ -+ private ClientOption(final Class type) { -+ this.type = type; -+ } -+ -+ public Class getType() { -+ return this.type; -+ } -+ -+ public enum ChatVisibility implements Translatable { -+ FULL("full"), -+ SYSTEM("system"), -+ HIDDEN("hidden"), -+ /** -+ * @deprecated no longer used anymore since 1.15.2, the value fallback -+ * to the default value of the setting when unknown on the server. -+ * In this case {@link #FULL} will be returned. -+ */ -+ @Deprecated(since = "1.15.2", forRemoval = true) -+ UNKNOWN("unknown"); -+ -+ public static final Index NAMES = Index.create(ChatVisibility.class, chatVisibility -> chatVisibility.name); -+ private final String name; -+ -+ ChatVisibility(final String name) { -+ this.name = name; -+ } -+ -+ @Override -+ public String translationKey() { -+ if (this == UNKNOWN) { -+ throw new UnsupportedOperationException(this.name + " doesn't have a translation key"); -+ } -+ return "options.chat.visibility." + this.name; -+ } -+ } -+ -+ public enum ParticleVisibility implements Translatable { -+ ALL("all"), -+ DECREASED("decreased"), -+ MINIMAL("minimal"); -+ -+ public static final Index NAMES = Index.create(ParticleVisibility.class, particleVisibility -> particleVisibility.name); -+ private final String name; -+ -+ ParticleVisibility(final String name) { -+ this.name = name; -+ } -+ -+ @Override -+ public String translationKey() { -+ return "options.particles." + this.name; -+ } -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/SkinParts.java b/src/main/java/com/destroystokyo/paper/SkinParts.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/SkinParts.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper; -+ -+public interface SkinParts { -+ -+ boolean hasCapeEnabled(); -+ -+ boolean hasJacketEnabled(); -+ -+ boolean hasLeftSleeveEnabled(); -+ -+ boolean hasRightSleeveEnabled(); -+ -+ boolean hasLeftPantsEnabled(); -+ -+ boolean hasRightPantsEnabled(); -+ -+ boolean hasHatsEnabled(); -+ -+ int getRaw(); -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import com.destroystokyo.paper.ClientOption; -+import com.destroystokyo.paper.ClientOption.ChatVisibility; -+import com.destroystokyo.paper.ClientOption.ParticleVisibility; -+import com.destroystokyo.paper.SkinParts; -+import java.util.Map; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.MainHand; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when the player changes their client settings -+ */ -+@NullMarked -+public class PlayerClientOptionsChangeEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final String locale; -+ private final int viewDistance; -+ private final ChatVisibility chatVisibility; -+ private final boolean chatColors; -+ private final SkinParts skinparts; -+ private final MainHand mainHand; -+ private final boolean allowsServerListings; -+ private final boolean textFilteringEnabled; -+ private final ParticleVisibility particleVisibility; -+ -+ @Deprecated -+ public PlayerClientOptionsChangeEvent(final Player player, final String locale, final int viewDistance, final ChatVisibility chatVisibility, final boolean chatColors, final SkinParts skinParts, final MainHand mainHand) { -+ super(player); -+ this.locale = locale; -+ this.viewDistance = viewDistance; -+ this.chatVisibility = chatVisibility; -+ this.chatColors = chatColors; -+ this.skinparts = skinParts; -+ this.mainHand = mainHand; -+ this.allowsServerListings = false; -+ this.textFilteringEnabled = false; -+ this.particleVisibility = ParticleVisibility.ALL; -+ } -+ -+ @ApiStatus.Internal -+ public PlayerClientOptionsChangeEvent(final Player player, final Map, ?> options) { -+ super(player); -+ -+ this.locale = (String) options.get(ClientOption.LOCALE); -+ this.viewDistance = (int) options.get(ClientOption.VIEW_DISTANCE); -+ this.chatVisibility = (ChatVisibility) options.get(ClientOption.CHAT_VISIBILITY); -+ this.chatColors = (boolean) options.get(ClientOption.CHAT_COLORS_ENABLED); -+ this.skinparts = (SkinParts) options.get(ClientOption.SKIN_PARTS); -+ this.mainHand = (MainHand) options.get(ClientOption.MAIN_HAND); -+ this.allowsServerListings = (boolean) options.get(ClientOption.ALLOW_SERVER_LISTINGS); -+ this.textFilteringEnabled = (boolean) options.get(ClientOption.TEXT_FILTERING_ENABLED); -+ this.particleVisibility = (ParticleVisibility) options.get(ClientOption.PARTICLE_VISIBILITY); -+ } -+ -+ public String getLocale() { -+ return this.locale; -+ } -+ -+ public boolean hasLocaleChanged() { -+ return !this.locale.equals(this.player.getClientOption(ClientOption.LOCALE)); -+ } -+ -+ public int getViewDistance() { -+ return this.viewDistance; -+ } -+ -+ public boolean hasViewDistanceChanged() { -+ return this.viewDistance != this.player.getClientOption(ClientOption.VIEW_DISTANCE); -+ } -+ -+ public ChatVisibility getChatVisibility() { -+ return this.chatVisibility; -+ } -+ -+ public boolean hasChatVisibilityChanged() { -+ return this.chatVisibility != this.player.getClientOption(ClientOption.CHAT_VISIBILITY); -+ } -+ -+ public boolean hasChatColorsEnabled() { -+ return this.chatColors; -+ } -+ -+ public boolean hasChatColorsEnabledChanged() { -+ return this.chatColors != this.player.getClientOption(ClientOption.CHAT_COLORS_ENABLED); -+ } -+ -+ public SkinParts getSkinParts() { -+ return this.skinparts; -+ } -+ -+ public boolean hasSkinPartsChanged() { -+ return this.skinparts.getRaw() != this.player.getClientOption(ClientOption.SKIN_PARTS).getRaw(); -+ } -+ -+ public MainHand getMainHand() { -+ return this.mainHand; -+ } -+ -+ public boolean hasMainHandChanged() { -+ return this.mainHand != this.player.getClientOption(ClientOption.MAIN_HAND); -+ } -+ -+ public boolean hasTextFilteringEnabled() { -+ return this.textFilteringEnabled; -+ } -+ -+ public boolean hasTextFilteringChanged() { -+ return this.textFilteringEnabled != this.player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED); -+ } -+ -+ public boolean allowsServerListings() { -+ return this.allowsServerListings; -+ } -+ -+ public boolean hasAllowServerListingsChanged() { -+ return this.allowsServerListings != this.player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS); -+ } -+ -+ public ParticleVisibility getParticleVisibility() { -+ return this.particleVisibility; -+ } -+ -+ public boolean hasParticleVisibilityChanged() { -+ return this.particleVisibility != this.player.getClientOption(ClientOption.PARTICLE_VISIBILITY); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void resetCooldown(); - // Paper end - attack cooldown API - -+ // Paper start - client option API -+ /** -+ * @return the client option value of the player -+ */ -+ @NotNull T getClientOption(com.destroystokyo.paper.@NotNull ClientOption option); -+ // Paper end - client option API -+ - // Spigot start - public class Spigot extends Entity.Spigot { - diff --git a/patches/api/Add-Player-Warden-Warning-API.patch b/patches/api/Add-Player-Warden-Warning-API.patch deleted file mode 100644 index 6f40a41a92..0000000000 --- a/patches/api/Add-Player-Warden-Warning-API.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dawon -Date: Sat, 15 Oct 2022 00:46:32 +0200 -Subject: [PATCH] Add Player Warden Warning API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @param silent whether sound should be silenced - */ - void showElderGuardian(boolean silent); -+ -+ /** -+ * Returns the player's cooldown in ticks until the next Warden warning can occur. -+ * -+ * @return ticks until next Warden warning can occur. 0 means there is no cooldown left. -+ */ -+ int getWardenWarningCooldown(); -+ -+ /** -+ * Sets the player's cooldown in ticks until next Warden warning can occur. -+ * -+ * @param cooldown ticks until next Warden warning can occur. 0 means there is no cooldown left. Values less than 0 are set to 0. -+ */ -+ void setWardenWarningCooldown(int cooldown); -+ -+ /** -+ * Returns time since last Warden warning in ticks. -+ * -+ * @return ticks since last Warden warning -+ */ -+ int getWardenTimeSinceLastWarning(); -+ -+ /** -+ * Sets time since last Warden warning in ticks. -+ * -+ * @param time ticks since last Warden warning -+ */ -+ void setWardenTimeSinceLastWarning(int time); -+ -+ /** -+ * Returns the player's current Warden warning level. -+ * -+ * @return current Warden warning level -+ */ -+ int getWardenWarningLevel(); -+ -+ /** -+ * Sets the player's Warden warning level. -+ *

-+ * Note: This will not actually spawn the Warden. -+ * Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden. -+ * -+ * @param warningLevel player's Warden warning level. The warning level is internally limited to valid values. -+ */ -+ void setWardenWarningLevel(int warningLevel); -+ -+ /** -+ * Increases the player's Warden warning level if possible and not on cooldown. -+ *

-+ * Note: This will not actually spawn the Warden. -+ * Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden. -+ */ -+ void increaseWardenWarningLevel(); - // Paper end - - @NotNull diff --git a/patches/api/Add-Player-getFishHook.patch b/patches/api/Add-Player-getFishHook.patch deleted file mode 100644 index e42b7cbd99..0000000000 --- a/patches/api/Add-Player-getFishHook.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: u9g -Date: Tue, 14 Jun 2022 19:35:21 -0400 -Subject: [PATCH] Add Player#getFishHook - - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - @Nullable - public Location getPotentialBedLocation(); - // Paper end -+ // Paper start -+ /** -+ * @return the player's fishing hook if they are fishing -+ */ -+ @Nullable -+ FishHook getFishHook(); -+ // Paper end - - /** - * Attempts to make the entity sleep at the given location. diff --git a/patches/api/Add-PlayerAdvancementCriterionGrantEvent.patch b/patches/api/Add-PlayerAdvancementCriterionGrantEvent.patch deleted file mode 100644 index f0bf2c05d1..0000000000 --- a/patches/api/Add-PlayerAdvancementCriterionGrantEvent.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 19 Jan 2018 08:15:14 -0600 -Subject: [PATCH] Add PlayerAdvancementCriterionGrantEvent - -Co-authored-by: The456gamer - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.advancement.Advancement; -+import org.bukkit.advancement.AdvancementProgress; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called after a player is granted a criteria in an advancement. -+ * If cancelled the criteria will be revoked. -+ */ -+@NullMarked -+public class PlayerAdvancementCriterionGrantEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Advancement advancement; -+ private final String criterion; -+ private final AdvancementProgress advancementProgress; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerAdvancementCriterionGrantEvent(final Player player, final Advancement advancement, final String criterion) { -+ super(player); -+ this.advancement = advancement; -+ this.criterion = criterion; -+ this.advancementProgress = player.getAdvancementProgress(advancement); -+ } -+ -+ /** -+ * Get the advancement which has been affected. -+ * -+ * @return affected advancement -+ */ -+ public Advancement getAdvancement() { -+ return this.advancement; -+ } -+ -+ /** -+ * Get the criterion which has been granted. -+ * -+ * @return granted criterion -+ */ -+ public String getCriterion() { -+ return this.criterion; -+ } -+ -+ /** -+ * Gets the current AdvancementProgress. -+ * -+ * @return advancement progress -+ */ -+ public AdvancementProgress getAdvancementProgress() { -+ return this.advancementProgress; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerArmorChangeEvent.patch b/patches/api/Add-PlayerArmorChangeEvent.patch deleted file mode 100644 index 75e296b6e5..0000000000 --- a/patches/api/Add-PlayerArmorChangeEvent.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: pkt77 -Date: Fri, 10 Nov 2017 23:45:59 -0500 -Subject: [PATCH] Add PlayerArmorChangeEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import java.util.Set; -+import org.bukkit.Material; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+import static org.bukkit.Material.*; -+ -+/** -+ * Called when the player themselves change their armor items -+ *

-+ * Not currently called for environmental factors though it MAY BE IN THE FUTURE -+ */ -+@NullMarked -+public class PlayerArmorChangeEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final SlotType slotType; -+ private final ItemStack oldItem; -+ private final ItemStack newItem; -+ -+ @ApiStatus.Internal -+ public PlayerArmorChangeEvent(final Player player, final SlotType slotType, final ItemStack oldItem, final ItemStack newItem) { -+ super(player); -+ this.slotType = slotType; -+ this.oldItem = oldItem; -+ this.newItem = newItem; -+ } -+ -+ /** -+ * Gets the type of slot being altered. -+ * -+ * @return type of slot being altered -+ */ -+ public SlotType getSlotType() { -+ return this.slotType; -+ } -+ -+ /** -+ * Gets the existing item that's being replaced -+ * -+ * @return old item -+ */ -+ public ItemStack getOldItem() { -+ return this.oldItem; -+ } -+ -+ /** -+ * Gets the new item that's replacing the old -+ * -+ * @return new item -+ */ -+ public ItemStack getNewItem() { -+ return this.newItem; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum SlotType { -+ HEAD(NETHERITE_HELMET, DIAMOND_HELMET, GOLDEN_HELMET, IRON_HELMET, CHAINMAIL_HELMET, LEATHER_HELMET, CARVED_PUMPKIN, PLAYER_HEAD, SKELETON_SKULL, ZOMBIE_HEAD, CREEPER_HEAD, WITHER_SKELETON_SKULL, TURTLE_HELMET, DRAGON_HEAD, PIGLIN_HEAD), -+ CHEST(NETHERITE_CHESTPLATE, DIAMOND_CHESTPLATE, GOLDEN_CHESTPLATE, IRON_CHESTPLATE, CHAINMAIL_CHESTPLATE, LEATHER_CHESTPLATE, ELYTRA), -+ LEGS(NETHERITE_LEGGINGS, DIAMOND_LEGGINGS, GOLDEN_LEGGINGS, IRON_LEGGINGS, CHAINMAIL_LEGGINGS, LEATHER_LEGGINGS), -+ FEET(NETHERITE_BOOTS, DIAMOND_BOOTS, GOLDEN_BOOTS, IRON_BOOTS, CHAINMAIL_BOOTS, LEATHER_BOOTS); -+ -+ private final Set types; -+ -+ SlotType(final Material... types) { -+ this.types = Set.of(types); -+ } -+ -+ /** -+ * Gets an immutable set of all allowed material types that can be placed in an -+ * armor slot. -+ * -+ * @return immutable set of material types -+ */ -+ public Set getTypes() { -+ return this.types; -+ } -+ -+ /** -+ * Gets the type of slot via the specified material -+ * -+ * @param material material to get slot by -+ * @return slot type the material will go in, or {@code null} if it won't -+ */ -+ public static @Nullable SlotType getByMaterial(final Material material) { -+ for (final SlotType slotType : values()) { -+ if (slotType.getTypes().contains(material)) { -+ return slotType; -+ } -+ } -+ return null; -+ } -+ -+ /** -+ * Gets whether this material can be equipped to a slot -+ * -+ * @param material material to check -+ * @return whether this material can be equipped -+ */ -+ public static boolean isEquipable(final Material material) { -+ return getByMaterial(material) != null; -+ } -+ } -+} diff --git a/patches/api/Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/api/Add-PlayerAttackEntityCooldownResetEvent.patch deleted file mode 100644 index 1e5e83b635..0000000000 --- a/patches/api/Add-PlayerAttackEntityCooldownResetEvent.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: nossr50 -Date: Thu, 26 Mar 2020 19:30:58 -0700 -Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when processing a player's attack on an entity when the player's attack strength cooldown is reset -+ */ -+@NullMarked -+public class PlayerAttackEntityCooldownResetEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity attackedEntity; -+ private final float cooledAttackStrength; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerAttackEntityCooldownResetEvent(final Player player, final Entity attackedEntity, final float cooledAttackStrength) { -+ super(player); -+ this.attackedEntity = attackedEntity; -+ this.cooledAttackStrength = cooledAttackStrength; -+ } -+ -+ /** -+ * Get the value of the players cooldown attack strength when they initiated the attack -+ * -+ * @return returns the original player cooldown value -+ */ -+ public float getCooledAttackStrength() { -+ return this.cooledAttackStrength; -+ } -+ -+ /** -+ * Returns the entity attacked by the player -+ * -+ * @return the entity attacked by the player -+ */ -+ public Entity getAttackedEntity() { -+ return this.attackedEntity; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * If an attack cooldown event is cancelled, the players attack strength will remain at the same value instead of being reset. -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * Cancelling this event will prevent the target player from having their cooldown reset from attacking this entity -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerConnectionCloseEvent.patch b/patches/api/Add-PlayerConnectionCloseEvent.patch deleted file mode 100644 index b0b784a258..0000000000 --- a/patches/api/Add-PlayerConnectionCloseEvent.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sun, 7 Oct 2018 12:05:06 -0700 -Subject: [PATCH] Add PlayerConnectionCloseEvent - -This event is invoked when a player has disconnected. It is guaranteed that, -if the server is in online-mode, that the provided uuid and username have been -validated. - -The event is invoked for players who have not yet logged into the world, whereas -PlayerQuitEvent is only invoked on players who have logged into the world. - -The event is invoked for players who have already logged into the world, -although whether or not the player exists in the world at the time of -firing is undefined. (That is, whether the plugin can retrieve a Player object -using the event parameters is undefined). However, it is guaranteed that this -event is invoked AFTER PlayerQuitEvent, if the player has already logged into -the world. - -This event is guaranteed to never fire unless AsyncPlayerPreLoginEvent has -been called beforehand, and this event may not be called in parallel with -AsyncPlayerPreLoginEvent for the same connection. - -Cancelling the AsyncPlayerPreLoginEvent guarantees the corresponding -PlayerConnectionCloseEvent is never called. - -The event may be invoked asynchronously or synchronously. As it stands, -it is never invoked asynchronously. However, plugins should check -Event#isAsynchronous to be future-proof. - -On purpose, the deprecated PlayerPreLoginEvent event is left out of the -API spec for this event. Plugins should not be using that event, and -how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent -is undefined. - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import java.net.InetAddress; -+import java.util.UUID; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.AsyncPlayerPreLoginEvent; -+import org.bukkit.event.player.PlayerQuitEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ *

-+ * This event is invoked when a player has disconnected. It is guaranteed that, -+ * if the server is in online-mode, that the provided uuid and username have been -+ * validated. -+ *

-+ * The event is invoked for players who have not yet logged into the world, whereas -+ * {@link PlayerQuitEvent} is only invoked on players who have logged into the world. -+ *

-+ * The event is invoked for players who have already logged into the world, -+ * although whether or not the player exists in the world at the time of -+ * firing is undefined. (That is, whether the plugin can retrieve a Player object -+ * using the event parameters is undefined). However, it is guaranteed that this -+ * event is invoked AFTER {@link PlayerQuitEvent}, if the player has already logged into the world. -+ *

-+ * This event is guaranteed to never fire unless {@link AsyncPlayerPreLoginEvent} has -+ * been fired beforehand, and this event may not be called in parallel with -+ * {@link AsyncPlayerPreLoginEvent} for the same connection. -+ *

-+ * Cancelling the {@link AsyncPlayerPreLoginEvent} guarantees the corresponding -+ * {@code PlayerConnectionCloseEvent} is never called. -+ *

-+ * The event may be invoked asynchronously or synchronously. Plugins should check -+ * {@link Event#isAsynchronous()} and handle accordingly. -+ */ -+@NullMarked -+public class PlayerConnectionCloseEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final UUID playerUniqueId; -+ private final String playerName; -+ private final InetAddress ipAddress; -+ -+ @ApiStatus.Internal -+ public PlayerConnectionCloseEvent(final UUID playerUniqueId, final String playerName, final InetAddress ipAddress, final boolean async) { -+ super(async); -+ this.playerUniqueId = playerUniqueId; -+ this.playerName = playerName; -+ this.ipAddress = ipAddress; -+ } -+ -+ /** -+ * Returns the {@code UUID} of the player disconnecting. -+ */ -+ public UUID getPlayerUniqueId() { -+ return this.playerUniqueId; -+ } -+ -+ /** -+ * Returns the name of the player disconnecting. -+ */ -+ public String getPlayerName() { -+ return this.playerName; -+ } -+ -+ /** -+ * Returns the player's IP address. -+ */ -+ public InetAddress getIpAddress() { -+ return this.ipAddress; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerFailMoveEvent.patch b/patches/api/Add-PlayerFailMoveEvent.patch deleted file mode 100644 index edf8d0183b..0000000000 --- a/patches/api/Add-PlayerFailMoveEvent.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Moulberry -Date: Wed, 26 Jul 2023 20:57:11 +0800 -Subject: [PATCH] Add PlayerFailMoveEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Runs when a player attempts to move, but is prevented from doing so by the server -+ */ -+@NullMarked -+public class PlayerFailMoveEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final FailReason failReason; -+ private final Location from; -+ private final Location to; -+ private boolean allowed; -+ private boolean logWarning; -+ -+ @ApiStatus.Internal -+ public PlayerFailMoveEvent(final Player player, final FailReason failReason, final boolean allowed, final boolean logWarning, final Location from, final Location to) { -+ super(player); -+ this.failReason = failReason; -+ this.allowed = allowed; -+ this.logWarning = logWarning; -+ this.from = from; -+ this.to = to; -+ } -+ -+ /** -+ * Gets the reason this movement was prevented by the server -+ * -+ * @return The reason the movement was prevented -+ */ -+ public FailReason getFailReason() { -+ return this.failReason; -+ } -+ -+ /** -+ * Gets the location this player moved from -+ * -+ * @return Location the player moved from -+ */ -+ public Location getFrom() { -+ return this.from.clone(); -+ } -+ -+ /** -+ * Gets the location this player tried to move to -+ * -+ * @return Location the player tried to move to -+ */ -+ public Location getTo() { -+ return this.to.clone(); -+ } -+ -+ /** -+ * Gets if the check should be bypassed, allowing the movement -+ * -+ * @return whether to bypass the check -+ */ -+ public boolean isAllowed() { -+ return this.allowed; -+ } -+ -+ /** -+ * Set if the check should be bypassed and the movement should be allowed -+ * -+ * @param allowed whether to bypass the check -+ */ -+ public void setAllowed(final boolean allowed) { -+ this.allowed = allowed; -+ } -+ -+ /** -+ * Gets if warnings will be printed to console. e.g. "Player123 moved too quickly!" -+ * -+ * @return whether to log warnings -+ */ -+ public boolean getLogWarning() { -+ return this.logWarning; -+ } -+ -+ /** -+ * Set if a warning is printed to console. e.g. "Player123 moved too quickly!" -+ * -+ * @param logWarning whether to log warnings -+ */ -+ public void setLogWarning(final boolean logWarning) { -+ this.logWarning = logWarning; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum FailReason { -+ MOVED_INTO_UNLOADED_CHUNK, // Only fired if the world setting prevent-moving-into-unloaded-chunks is true -+ MOVED_TOO_QUICKLY, -+ MOVED_WRONGLY, -+ CLIPPED_INTO_BLOCK -+ } -+ -+} diff --git a/patches/api/Add-PlayerFlowerPotManipulateEvent.patch b/patches/api/Add-PlayerFlowerPotManipulateEvent.patch deleted file mode 100644 index e9e07b4394..0000000000 --- a/patches/api/Add-PlayerFlowerPotManipulateEvent.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MisterVector -Date: Tue, 13 Aug 2019 19:44:19 -0700 -Subject: [PATCH] Add PlayerFlowerPotManipulateEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a player places an item in or takes an item out of a flowerpot. -+ */ -+@NullMarked -+public class PlayerFlowerPotManipulateEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block flowerpot; -+ private final ItemStack item; -+ private final boolean placing; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerFlowerPotManipulateEvent(final Player player, final Block flowerpot, final ItemStack item, final boolean placing) { -+ super(player); -+ this.flowerpot = flowerpot; -+ this.item = item; -+ this.placing = placing; -+ } -+ -+ /** -+ * Gets the flowerpot that is involved in this event. -+ * -+ * @return the flowerpot that is involved with this event -+ */ -+ public Block getFlowerpot() { -+ return this.flowerpot; -+ } -+ -+ /** -+ * Gets the item being placed, or taken from, the flower pot. -+ * Check if placing with {@link #isPlacing()}. -+ * -+ * @return the item placed, or taken from, the flowerpot -+ */ -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets if the item is being placed into the flowerpot. -+ * -+ * @return if the item is being placed into the flowerpot -+ */ -+ public boolean isPlacing() { -+ return this.placing; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerInsertLecternBookEvent.patch b/patches/api/Add-PlayerInsertLecternBookEvent.patch deleted file mode 100644 index 6891e15a39..0000000000 --- a/patches/api/Add-PlayerInsertLecternBookEvent.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Sat, 29 Aug 2020 21:55:41 +0200 -Subject: [PATCH] Add PlayerInsertLecternBookEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInsertLecternBookEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInsertLecternBookEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerInsertLecternBookEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockState; -+import org.bukkit.block.Lectern; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * This event is called when a player clicks on a lectern to insert a book. -+ * If this event is cancelled the player will keep the book and the lectern will remain empty. -+ */ -+@NullMarked -+public class PlayerInsertLecternBookEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ private boolean cancelled = false; -+ private final Block block; -+ private ItemStack book; -+ -+ @ApiStatus.Internal -+ public PlayerInsertLecternBookEvent(final Player player, final Block block, final ItemStack book) { -+ super(player); -+ this.block = block; -+ this.book = book; -+ } -+ -+ /** -+ * Gets the block of the lectern involved in this event. -+ * -+ * @return the block of the lectern -+ */ -+ public Block getBlock() { -+ return this.block; -+ } -+ -+ /** -+ * Fetches the lectern block state that was part of this event. -+ * This method constructs a new snapshot {@link org.bukkit.block.BlockState}. -+ * -+ * @return a new lectern state snapshot of the involved lectern -+ * @throws IllegalStateException if the block at {@link #getBlock()} is no longer a lectern -+ */ -+ public Lectern getLectern() { -+ final BlockState state = this.getBlock().getState(); -+ Preconditions.checkState(state instanceof Lectern, "Block state of lectern block is no longer a lectern tile state!"); -+ return (Lectern) state; -+ } -+ -+ /** -+ * Returns the itemstack the player tried to insert. This is a copy of the item, -+ * changes made to this itemstack will not affect the book that is being placed in the lectern. -+ * If you want to mutate the item stack that ends up in the lectern, use {@link #setBook(ItemStack)}. -+ * -+ * @return the book that is being placed -+ */ -+ public ItemStack getBook() { -+ return this.book.clone(); -+ } -+ -+ /** -+ * Sets the itemstack to insert into the lectern. -+ * -+ * @param book the book to insert (non book items will leave the lectern in a locked -+ * state as the menu cannot be opened, preventing item extraction) -+ */ -+ public void setBook(final ItemStack book) { -+ Preconditions.checkArgument(book != null, "Cannot set book to null"); -+ this.book = book.clone(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerInventorySlotChangeEvent.patch b/patches/api/Add-PlayerInventorySlotChangeEvent.patch deleted file mode 100644 index 2de6840225..0000000000 --- a/patches/api/Add-PlayerInventorySlotChangeEvent.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jakub Zacek -Date: Sun, 24 Apr 2022 22:56:31 +0200 -Subject: [PATCH] Add PlayerInventorySlotChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.Inventory; -+import org.bukkit.inventory.ItemStack; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a slot contents change in a player's inventory. -+ */ -+@NullMarked -+public class PlayerInventorySlotChangeEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final int rawSlot; -+ private final int slot; -+ private final ItemStack oldItemStack; -+ private final ItemStack newItemStack; -+ private boolean triggerAdvancements = true; -+ -+ public PlayerInventorySlotChangeEvent(final Player player, final int rawSlot, final ItemStack oldItemStack, final ItemStack newItemStack) { -+ super(player); -+ this.rawSlot = rawSlot; -+ this.slot = player.getOpenInventory().convertSlot(rawSlot); -+ this.oldItemStack = oldItemStack; -+ this.newItemStack = newItemStack; -+ } -+ -+ /** -+ * The raw slot number that was changed. -+ * -+ * @return The raw slot number. -+ */ -+ public int getRawSlot() { -+ return this.rawSlot; -+ } -+ -+ /** -+ * The slot number that was changed, ready for passing to -+ * {@link Inventory#getItem(int)}. Note that there may be two slots with -+ * the same slot number, since a view links two different inventories. -+ *

-+ * If no inventory is opened, internal crafting view is used for conversion. -+ * -+ * @return The slot number. -+ */ -+ public int getSlot() { -+ return this.slot; -+ } -+ -+ /** -+ * Clone of ItemStack that was in the slot before the change. -+ * -+ * @return The old ItemStack in the slot. -+ */ -+ public ItemStack getOldItemStack() { -+ return this.oldItemStack; -+ } -+ -+ /** -+ * Clone of ItemStack that is in the slot after the change. -+ * -+ * @return The new ItemStack in the slot. -+ */ -+ public ItemStack getNewItemStack() { -+ return this.newItemStack; -+ } -+ -+ /** -+ * Gets whether the slot change advancements will be triggered. -+ * -+ * @return Whether the slot change advancements will be triggered. -+ */ -+ public boolean shouldTriggerAdvancements() { -+ return this.triggerAdvancements; -+ } -+ -+ /** -+ * Sets whether the slot change advancements will be triggered. -+ * -+ * @param triggerAdvancements Whether the slot change advancements will be triggered. -+ */ -+ public void setShouldTriggerAdvancements(final boolean triggerAdvancements) { -+ this.triggerAdvancements = triggerAdvancements; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerItemCooldownEvent.patch b/patches/api/Add-PlayerItemCooldownEvent.patch deleted file mode 100644 index a79ef99de5..0000000000 --- a/patches/api/Add-PlayerItemCooldownEvent.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Tue, 25 Aug 2020 13:45:15 +0200 -Subject: [PATCH] Add PlayerItemCooldownEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.Material; -+import org.bukkit.NamespacedKey; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired when a player receives an item cooldown when using an item. -+ * -+ * @see PlayerItemGroupCooldownEvent for a more general event when applied to a group of items -+ */ -+@NullMarked -+public class PlayerItemCooldownEvent extends PlayerItemGroupCooldownEvent { -+ -+ private final Material type; -+ -+ @ApiStatus.Internal -+ public PlayerItemCooldownEvent(final Player player, final Material type, final NamespacedKey cooldownGroup, final int cooldown) { -+ super(player, cooldownGroup, cooldown); -+ this.type = type; -+ } -+ -+ /** -+ * Get the material of the item affected by the cooldown. -+ * -+ * @return material affected by the cooldown -+ */ -+ public Material getType() { -+ return this.type; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.NamespacedKey; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired when a player receives an item cooldown. -+ * -+ * @see PlayerItemCooldownEvent for a more specific event when applied to a specific item. -+ */ -+@NullMarked -+public class PlayerItemGroupCooldownEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final NamespacedKey cooldownGroup; -+ private int cooldown; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerItemGroupCooldownEvent(final Player player, final NamespacedKey cooldownGroup, final int cooldown) { -+ super(player); -+ this.cooldownGroup = cooldownGroup; -+ this.cooldown = cooldown; -+ } -+ -+ /** -+ * Get the cooldown group as defined by an item's {@link org.bukkit.inventory.meta.components.UseCooldownComponent}. -+ * -+ * @return cooldown group -+ */ -+ public NamespacedKey getCooldownGroup() { -+ return this.cooldownGroup; -+ } -+ -+ /** -+ * Gets the cooldown in ticks. -+ * -+ * @return cooldown in ticks -+ */ -+ public int getCooldown() { -+ return this.cooldown; -+ } -+ -+ /** -+ * Sets the cooldown of the material in ticks. -+ * Setting the cooldown to 0 results in removing an already existing cooldown for the material. -+ * -+ * @param cooldown cooldown in ticks, has to be a positive number -+ */ -+ public void setCooldown(final int cooldown) { -+ Preconditions.checkArgument(cooldown >= 0, "The cooldown has to be equal to or greater than 0!"); -+ this.cooldown = cooldown; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerItemFrameChangeEvent.patch b/patches/api/Add-PlayerItemFrameChangeEvent.patch deleted file mode 100644 index a4cf59e59a..0000000000 --- a/patches/api/Add-PlayerItemFrameChangeEvent.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SamB440 -Date: Mon, 15 Nov 2021 18:09:46 +0000 -Subject: [PATCH] Add PlayerItemFrameChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.ItemFrame; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when an {@link ItemFrame} is having an item rotated, added, or removed from it. -+ */ -+@NullMarked -+public class PlayerItemFrameChangeEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemFrame itemFrame; -+ private final ItemFrameChangeAction action; -+ private ItemStack itemStack; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerItemFrameChangeEvent(final Player player, final ItemFrame itemFrame, final ItemStack itemStack, final ItemFrameChangeAction action) { -+ super(player); -+ this.itemFrame = itemFrame; -+ this.itemStack = itemStack; -+ this.action = action; -+ } -+ -+ /** -+ * Gets the {@link ItemFrame} involved in this event. -+ * -+ * @return the {@link ItemFrame} -+ */ -+ public ItemFrame getItemFrame() { -+ return this.itemFrame; -+ } -+ -+ /** -+ * Gets the {@link ItemStack} involved in this event. -+ * This is the item being added, rotated, or removed from the {@link ItemFrame}. -+ *

-+ * If this method returns air, then the resulting item in the ItemFrame will be empty. -+ * -+ * @return the {@link ItemStack} being added, rotated, or removed -+ */ -+ public ItemStack getItemStack() { -+ return this.itemStack; -+ } -+ -+ /** -+ * Sets the {@link ItemStack} that this {@link ItemFrame} holds. -+ * If {@code null} is provided, the ItemStack will become air and the result in the ItemFrame will be empty. -+ * -+ * @param itemStack {@link ItemFrame} item -+ */ -+ public void setItemStack(final @Nullable ItemStack itemStack) { -+ this.itemStack = itemStack == null ? ItemStack.empty() : itemStack; -+ } -+ -+ /** -+ * Gets the action that was performed on this {@link ItemFrame}. -+ * -+ * @return action performed on the item frame in this event -+ */ -+ public ItemFrameChangeAction getAction() { -+ return this.action; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum ItemFrameChangeAction { -+ PLACE, -+ REMOVE, -+ ROTATE -+ } -+} diff --git a/patches/api/Add-PlayerJumpEvent.patch b/patches/api/Add-PlayerJumpEvent.patch deleted file mode 100644 index c75cb54c59..0000000000 --- a/patches/api/Add-PlayerJumpEvent.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Thu, 28 Sep 2017 17:21:32 -0400 -Subject: [PATCH] Add PlayerJumpEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.Location; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.event.player.PlayerMoveEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when the server detects the player is jumping. -+ *

-+ * Added to avoid the overhead and special case logic that many plugins use -+ * when checking for jumps via {@link PlayerMoveEvent}, this event is fired whenever -+ * the server detects that the player is jumping. -+ */ -+@NullMarked -+public class PlayerJumpEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Location to; -+ private Location from; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerJumpEvent(final Player player, final Location from, final Location to) { -+ super(player); -+ this.from = from; -+ this.to = to; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * If a jump event is cancelled, the player will be moved or -+ * teleported back to the Location as defined by {@link #getFrom()}. This will not -+ * fire an event -+ * -+ * @return {@code true} if this event is cancelled -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * If a jump event is cancelled, the player will be moved or -+ * teleported back to the Location as defined by {@link #getFrom()}. This will not -+ * fire an event -+ * -+ * @param cancel {@code true} if you wish to cancel this event -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ /** -+ * Gets the location this player jumped from -+ * -+ * @return Location the player jumped from -+ */ -+ public Location getFrom() { -+ return this.from; -+ } -+ -+ /** -+ * Sets the location to mark as where the player jumped from -+ * -+ * @param from New location to mark as the players previous location -+ */ -+ public void setFrom(final Location from) { -+ Preconditions.checkArgument(from != null, "Cannot use null from location!"); -+ Preconditions.checkArgument(from.getWorld() != null, "Cannot use from location with null world!"); -+ this.from = from; -+ } -+ -+ /** -+ * Gets the location this player jumped to -+ *

-+ * This information is based on what the client sends, it typically -+ * has little relation to the arc of the jump at any given point. -+ * -+ * @return Location the player jumped to -+ */ -+ public Location getTo() { -+ return this.to.clone(); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerKickEvent-causes.patch b/patches/api/Add-PlayerKickEvent-causes.patch deleted file mode 100644 index 4c9a874ac6..0000000000 --- a/patches/api/Add-PlayerKickEvent-causes.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 15 May 2021 20:30:34 -0700 -Subject: [PATCH] Add PlayerKickEvent causes - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @param message kick message - */ - void kick(final net.kyori.adventure.text.@Nullable Component message); -+ -+ /** -+ * Kicks player with custom kick message and cause. -+ * -+ * @param message kick message -+ * @param cause kick cause -+ */ -+ void kick(final net.kyori.adventure.text.@Nullable Component message, org.bukkit.event.player.PlayerKickEvent.@NotNull Cause cause); - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -@@ -0,0 +0,0 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private net.kyori.adventure.text.Component leaveMessage; // Paper - private net.kyori.adventure.text.Component kickReason; // Paper -+ private final Cause cause; // Paper - private boolean cancel; - - @Deprecated // Paper -@@ -0,0 +0,0 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { - super(playerKicked); - this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper - this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper -+ this.cause = Cause.UNKNOWN; // Paper - this.cancel = false; - } - // Paper start -+ @Deprecated - public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage) { - super(playerKicked); - this.kickReason = kickReason; - this.leaveMessage = leaveMessage; - this.cancel = false; -+ this.cause = Cause.UNKNOWN; -+ } -+ -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage, @NotNull final Cause cause) { -+ super(playerKicked); -+ this.kickReason = kickReason; -+ this.leaveMessage = leaveMessage; -+ this.cancel = false; -+ this.cause = cause; - } - - /** -@@ -0,0 +0,0 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start -+ /** -+ * Gets the cause of this kick -+ * -+ * @return -+ */ -+ @NotNull -+ public org.bukkit.event.player.PlayerKickEvent.Cause getCause() { -+ return cause; -+ } -+ -+ public enum Cause { -+ -+ PLUGIN, -+ -+ WHITELIST, -+ -+ BANNED, -+ -+ IP_BANNED, -+ -+ KICK_COMMAND, -+ -+ FLYING_PLAYER, -+ -+ FLYING_VEHICLE, -+ -+ TIMEOUT, -+ -+ IDLING, -+ -+ INVALID_VEHICLE_MOVEMENT, -+ -+ INVALID_PLAYER_MOVEMENT, -+ -+ INVALID_ENTITY_ATTACKED, -+ -+ INVALID_PAYLOAD, -+ -+ INVALID_COOKIE, -+ -+ SPAM, -+ -+ ILLEGAL_ACTION, -+ -+ ILLEGAL_CHARACTERS, -+ -+ OUT_OF_ORDER_CHAT, -+ -+ UNSIGNED_CHAT, -+ -+ CHAT_VALIDATION_FAILED, -+ -+ EXPIRED_PROFILE_PUBLIC_KEY, -+ -+ INVALID_PUBLIC_KEY_SIGNATURE, -+ -+ TOO_MANY_PENDING_CHATS, -+ -+ SELF_INTERACTION, -+ -+ DUPLICATE_LOGIN, -+ -+ RESOURCE_PACK_REJECTION, -+ -+ /** -+ * Spigot's restart command -+ */ -+ RESTART_COMMAND, -+ /** -+ * Fallback cause -+ */ -+ UNKNOWN, -+ } -+ // Paper end - } diff --git a/patches/api/Add-PlayerPickItemEvent.patch b/patches/api/Add-PlayerPickItemEvent.patch deleted file mode 100644 index 960eee7db5..0000000000 --- a/patches/api/Add-PlayerPickItemEvent.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: RodneyMKay <36546810+RodneyMKay@users.noreply.github.com> -Date: Wed, 8 Sep 2021 22:15:43 +0200 -Subject: [PATCH] Add PlayerPickItemEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Range; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Event that is fired when a player uses the pick item functionality (middle-clicking a block or entity to get the -+ * appropriate item). After the handling of this event, the contents of the source and the target slot will be swapped -+ * and the currently selected hotbar slot of the player will be set to the target slot. -+ */ -+@NullMarked -+public class PlayerPickItemEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private int targetSlot; -+ private int sourceSlot; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerPickItemEvent(final Player player, final int targetSlot, final int sourceSlot) { -+ super(player); -+ this.targetSlot = targetSlot; -+ this.sourceSlot = sourceSlot; -+ } -+ -+ /** -+ * Returns the slot the item that is being picked goes into. -+ * -+ * @return hotbar slot (0-8 inclusive) -+ */ -+ public @Range(from = 0, to = 8) int getTargetSlot() { -+ return this.targetSlot; -+ } -+ -+ /** -+ * Changes the slot the item that is being picked goes into. -+ * -+ * @param targetSlot hotbar slot (0-8 inclusive) -+ */ -+ public void setTargetSlot(final @Range(from = 0, to = 8) int targetSlot) { -+ Preconditions.checkArgument(targetSlot >= 0 && targetSlot <= 8, "Target slot must be in range 0 - 8 (inclusive)"); -+ this.targetSlot = targetSlot; -+ } -+ -+ /** -+ * Returns the slot in which the item that will be put into the players hotbar is located. -+ *

-+ * Returns {@code -1} if the item is not in the player's inventory. -+ * If this is the case and the player is in creative mode, the item will be spawned in. -+ * -+ * @return player inventory slot (0-35 inclusive, or {@code -1} if not in the player inventory) -+ */ -+ public @Range(from = -1, to = 35) int getSourceSlot() { -+ return this.sourceSlot; -+ } -+ -+ /** -+ * Change the source slot from which the item that will be put in the players hotbar will be taken. -+ *

-+ * If set to {@code -1} and the player is in creative mode, the item will be spawned in. -+ * -+ * @param sourceSlot player inventory slot (0-35 inclusive, or {@code -1} if not in the player inventory) -+ */ -+ public void setSourceSlot(final @Range(from = -1, to = 35) int sourceSlot) { -+ Preconditions.checkArgument(sourceSlot >= -1 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot, or -1"); -+ this.sourceSlot = sourceSlot; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerPostRespawnEvent.patch b/patches/api/Add-PlayerPostRespawnEvent.patch deleted file mode 100644 index f601e87c6d..0000000000 --- a/patches/api/Add-PlayerPostRespawnEvent.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MisterVector -Date: Fri, 26 Oct 2018 21:33:13 -0700 -Subject: [PATCH] Add PlayerPostRespawnEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired after a player has respawned -+ */ -+@NullMarked -+public class PlayerPostRespawnEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Location respawnedLocation; -+ private final boolean isBedSpawn; -+ -+ @ApiStatus.Internal -+ public PlayerPostRespawnEvent(final Player respawnPlayer, final Location respawnedLocation, final boolean isBedSpawn) { -+ super(respawnPlayer); -+ this.respawnedLocation = respawnedLocation; -+ this.isBedSpawn = isBedSpawn; -+ } -+ -+ /** -+ * Returns the location of the respawned player -+ * -+ * @return location of the respawned player -+ */ -+ public Location getRespawnedLocation() { -+ return this.respawnedLocation.clone(); -+ } -+ -+ /** -+ * Checks if the player respawned to their bed -+ * -+ * @return whether the player respawned to their bed -+ */ -+ public boolean isBedSpawn() { -+ return this.isBedSpawn; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - - /** - * Called when a player respawns. -+ *

-+ * If changing player state, see {@link com.destroystokyo.paper.event.player.PlayerPostRespawnEvent} -+ * because the player is "reset" between this event and that event and some changes won't persist. - */ - public class PlayerRespawnEvent extends PlayerEvent { - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/Add-PlayerSetSpawnEvent.patch b/patches/api/Add-PlayerSetSpawnEvent.patch deleted file mode 100644 index 8c6dfe4238..0000000000 --- a/patches/api/Add-PlayerSetSpawnEvent.patch +++ /dev/null @@ -1,201 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 19 May 2021 18:58:24 -0700 -Subject: [PATCH] Add PlayerSetSpawnEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.Location; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when a player's spawn is set, either by themselves or otherwise. -+ *
-+ * Cancelling this event will prevent the spawn from being set. -+ */ -+@NullMarked -+public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Cause cause; -+ private @Nullable Location location; -+ private boolean forced; -+ private boolean notifyPlayer; -+ private @Nullable Component notification; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerSetSpawnEvent(final Player player, final Cause cause, final @Nullable Location location, final boolean forced, final boolean notifyPlayer, final @Nullable Component notification) { -+ super(player); -+ this.cause = cause; -+ this.location = location; -+ this.forced = forced; -+ this.notifyPlayer = notifyPlayer; -+ this.notification = notification; -+ } -+ -+ /** -+ * Gets the cause of this event. -+ * -+ * @return the cause -+ */ -+ public Cause getCause() { -+ return this.cause; -+ } -+ -+ /** -+ * Gets the location that the spawn is set to. The yaw -+ * of this location is the spawn angle. Mutating this location -+ * will change the resulting spawn point of the player. Use -+ * {@link Location#clone()} to get a copy of this location. -+ * -+ * @return the spawn location, or {@code null} if removing the location -+ */ -+ public @Nullable Location getLocation() { -+ return this.location; -+ } -+ -+ /** -+ * Sets the location to be set as the spawn location. The yaw -+ * of this location is the spawn angle. -+ * -+ * @param location the spawn location, or {@code null} to remove the spawn location -+ */ -+ public void setLocation(final @Nullable Location location) { -+ this.location = location; -+ } -+ -+ /** -+ * Gets if this is a force spawn location -+ * -+ * @return {@code true} if forced -+ */ -+ public boolean isForced() { -+ return this.forced; -+ } -+ -+ /** -+ * Sets if this is a forced spawn location -+ * -+ * @param forced {@code true} to force -+ */ -+ public void setForced(final boolean forced) { -+ this.forced = forced; -+ } -+ -+ /** -+ * Gets if this action will notify the player their spawn -+ * has been set. -+ * -+ * @return {@code true} to notify -+ */ -+ public boolean willNotifyPlayer() { -+ return this.notifyPlayer; -+ } -+ -+ /** -+ * Sets if this action will notify the player that their spawn -+ * has been set. -+ * -+ * @param notifyPlayer {@code true} to notify -+ */ -+ public void setNotifyPlayer(final boolean notifyPlayer) { -+ this.notifyPlayer = notifyPlayer; -+ } -+ -+ /** -+ * Gets the notification message that will be sent to the player -+ * if {@link #willNotifyPlayer()} returns true. -+ * -+ * @return {@code null} if no notification -+ */ -+ public @Nullable Component getNotification() { -+ return this.notification; -+ } -+ -+ /** -+ * Sets the notification message that will be sent to the player. -+ * -+ * @param notification {@code null} to send no message -+ */ -+ public void setNotification(final @Nullable Component notification) { -+ this.notification = notification; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum Cause { -+ /** -+ * When a player interacts successfully with a bed. -+ */ -+ BED, -+ /** -+ * When a player interacts successfully with a respawn anchor. -+ */ -+ RESPAWN_ANCHOR, -+ /** -+ * When a player respawns. -+ */ -+ PLAYER_RESPAWN, -+ /** -+ * When the {@code /spawnpoint} command is used on a player. -+ */ -+ COMMAND, -+ /** -+ * When a plugin uses {@link Player#setRespawnLocation(Location)} or -+ * {@link Player#setRespawnLocation(Location, boolean)}. -+ */ -+ PLUGIN, -+ /** -+ * Fallback cause. -+ */ -+ UNKNOWN, -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - - /** - * This event is fired when the spawn point of the player is changed. -+ * @deprecated use {@link com.destroystokyo.paper.event.player.PlayerSetSpawnEvent} - */ -+@Deprecated(forRemoval = true) // Paper - public class PlayerSpawnChangeEvent extends PlayerEvent implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/Add-PlayerShearBlockEvent.patch b/patches/api/Add-PlayerShearBlockEvent.patch deleted file mode 100644 index 7e0edab036..0000000000 --- a/patches/api/Add-PlayerShearBlockEvent.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Thu, 27 Aug 2020 12:32:35 -0400 -Subject: [PATCH] Add PlayerShearBlockEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import java.util.List; -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.EquipmentSlot; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a player uses sheers on a block. -+ *

-+ * This event is not called when breaking blocks with shears but instead only when a -+ * player uses the sheer item on a block to garner drops from said block and/or change its state. -+ *

-+ * Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb. -+ */ -+@NullMarked -+public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block block; -+ private final ItemStack item; -+ private final EquipmentSlot hand; -+ private final List drops; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerShearBlockEvent(final Player player, final Block block, final ItemStack item, final EquipmentSlot hand, final List drops) { -+ super(player); -+ this.block = block; -+ this.item = item; -+ this.hand = hand; -+ this.drops = drops; -+ } -+ -+ /** -+ * Gets the block being sheared in this event. -+ * -+ * @return The {@link Block} which block is being sheared in this event. -+ */ -+ public Block getBlock() { -+ return this.block; -+ } -+ -+ /** -+ * Gets the item used to shear the block. -+ * -+ * @return The {@link ItemStack} of the shears. -+ */ -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets the hand used to shear the block. -+ * -+ * @return Either {@link EquipmentSlot#HAND} OR {@link EquipmentSlot#OFF_HAND}. -+ */ -+ public EquipmentSlot getHand() { -+ return this.hand; -+ } -+ -+ /** -+ * Gets the resulting drops of this event. -+ * -+ * @return A mutable {@link List list} of {@link ItemStack items} that will be dropped as result of this event. -+ */ -+ public List getDrops() { -+ return this.drops; -+ } -+ -+ /** -+ * Gets whether the shearing of the block should be cancelled or not. -+ * -+ * @return Whether the shearing of the block should be cancelled or not. -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Sets whether the shearing of the block should be cancelled or not. -+ * -+ * @param cancel whether the shearing of the block should be cancelled or not. -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerShieldDisableEvent.patch b/patches/api/Add-PlayerShieldDisableEvent.patch deleted file mode 100644 index 858450e5c7..0000000000 --- a/patches/api/Add-PlayerShieldDisableEvent.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cryptite -Date: Mon, 1 May 2023 16:22:43 -0500 -Subject: [PATCH] Add PlayerShieldDisableEvent - -Called whenever a players shield is disabled. This is mainly caused by -attacking players or monsters that carry axes. - -The event, while similar to the PlayerItemCooldownEvent, offers other -behaviour and can hence not be implemented as a childtype of said event. -Specifically, cancelling the event prevents the game events from being -sent to the player. - -Plugins listening to just the PlayerItemCooldownEvent may not want said -sideeffects, meaning the disable event cannot share a handlerlist with -the cooldown event. - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called whenever a players shield is disabled due to an attack from another entity that was capable of disabling the -+ * shield. This, most commonly, may be another player attacking with an axe. -+ *

-+ * Notably, this even is distinct from a {@link PlayerItemCooldownEvent} and will fire prior to the item going on -+ * cooldown. -+ * It follows that, if this event is cancelled, no {@link PlayerItemCooldownEvent} is called as the shield is never -+ * disabled in the first place. -+ */ -+@NullMarked -+public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity damager; -+ private int cooldown; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerShieldDisableEvent(final Player player, final Entity damager, final int cooldown) { -+ super(player); -+ this.damager = damager; -+ this.cooldown = cooldown; -+ } -+ -+ /** -+ * Provides the damager that disabled the shield. -+ * -+ * @return the entity instance that damaged the player in a way that caused the shield to be disabled. -+ */ -+ public Entity getDamager() { -+ return this.damager; -+ } -+ -+ /** -+ * Gets the cooldown the disabled shield will be disabled for in ticks. -+ *

-+ * Notably, this value is not final as it might be changed by a {@link PlayerItemCooldownEvent} down the line, -+ * as said event is called if this event is not cancelled. -+ * -+ * @return cooldown in ticks -+ */ -+ public int getCooldown() { -+ return this.cooldown; -+ } -+ -+ /** -+ * Sets the cooldown of the shield in ticks. -+ *

-+ * Notably, this value is not final as it might be changed by a {@link PlayerItemCooldownEvent} down the line, -+ * as said event is called if this event is not cancelled. -+ * -+ * @param cooldown cooldown in ticks, has to be a positive number -+ */ -+ public void setCooldown(final int cooldown) { -+ Preconditions.checkArgument(cooldown >= 0, "The cooldown has to be equal to or greater than 0!"); -+ this.cooldown = cooldown; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerSignCommandPreprocessEvent.patch b/patches/api/Add-PlayerSignCommandPreprocessEvent.patch deleted file mode 100644 index da95f5dc4a..0000000000 --- a/patches/api/Add-PlayerSignCommandPreprocessEvent.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 9 Jul 2021 17:44:33 -0700 -Subject: [PATCH] Add PlayerSignCommandPreprocessEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import java.util.Set; -+import org.bukkit.block.Sign; -+import org.bukkit.block.sign.Side; -+import org.bukkit.entity.Player; -+import org.bukkit.event.player.PlayerCommandPreprocessEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a {@link Player} clicks a side on a sign that causes a command to run. -+ *

-+ * This command is run with elevated permissions which allows players to access commands on signs they wouldn't -+ * normally be able to run. -+ */ -+@NullMarked -+public class PlayerSignCommandPreprocessEvent extends PlayerCommandPreprocessEvent { -+ -+ private final Sign sign; -+ private final Side side; -+ -+ @ApiStatus.Internal -+ public PlayerSignCommandPreprocessEvent(final Player player, final String message, final Set recipients, final Sign sign, final Side side) { -+ super(player, message, recipients); -+ this.sign = sign; -+ this.side = side; -+ } -+ -+ /** -+ * Gets the sign that the command originated from. -+ * -+ * @return the sign -+ */ -+ public Sign getSign() { -+ return this.sign; -+ } -+ -+ /** -+ * Gets the side of the sign that the command originated from. -+ * -+ * @return the sign side -+ */ -+ public Side getSide() { -+ return this.side; -+ } -+} diff --git a/patches/api/Add-PlayerStopUsingItemEvent.patch b/patches/api/Add-PlayerStopUsingItemEvent.patch deleted file mode 100644 index 329f6cb16b..0000000000 --- a/patches/api/Add-PlayerStopUsingItemEvent.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: u9g -Date: Tue, 3 May 2022 20:41:30 -0400 -Subject: [PATCH] Add PlayerStopUsingItemEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when the server detects a player stopping using an item. -+ * Examples of this are letting go of the interact button when holding a bow, an edible item, or a spyglass. -+ */ -+@NullMarked -+public class PlayerStopUsingItemEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack item; -+ private final int ticksHeldFor; -+ -+ public PlayerStopUsingItemEvent(final Player player, final ItemStack item, final int ticksHeldFor) { -+ super(player); -+ this.item = item; -+ this.ticksHeldFor = ticksHeldFor; -+ } -+ -+ /** -+ * Gets the exact item the player is releasing -+ * -+ * @return ItemStack the exact item the player released -+ */ -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets the number of ticks the item was held for -+ * -+ * @return int the number of ticks the item was held for -+ */ -+ public int getTicksHeldFor() { -+ return this.ticksHeldFor; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PlayerUseUnknownEntityEvent.patch b/patches/api/Add-PlayerUseUnknownEntityEvent.patch deleted file mode 100644 index d399c2999e..0000000000 --- a/patches/api/Add-PlayerUseUnknownEntityEvent.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jedediah Smith -Date: Sat, 2 Apr 2016 05:08:36 -0400 -Subject: [PATCH] Add PlayerUseUnknownEntityEvent - -Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with -virtual entities/entities that are not actually known to the server. - -Co-authored-by: Nassim Jahnke - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.event.player.PlayerInteractAtEntityEvent; -+import org.bukkit.inventory.EquipmentSlot; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Represents an event that is called when a player right-clicks an unknown entity. -+ * Useful for plugins dealing with virtual entities (entities that aren't actually spawned on the server). -+ *
-+ * This event may be called multiple times per interaction with different interaction hands -+ * and with or without the clicked position. -+ */ -+@NullMarked -+public class PlayerUseUnknownEntityEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final int entityId; -+ private final boolean attack; -+ private final EquipmentSlot hand; -+ private final @Nullable Vector clickedPosition; -+ -+ @ApiStatus.Internal -+ public PlayerUseUnknownEntityEvent(final Player player, final int entityId, final boolean attack, final EquipmentSlot hand, final @Nullable Vector clickedPosition) { -+ super(player); -+ this.entityId = entityId; -+ this.attack = attack; -+ this.hand = hand; -+ this.clickedPosition = clickedPosition; -+ } -+ -+ /** -+ * Returns the entity id of the unknown entity that was interacted with. -+ * -+ * @return the entity id of the entity that was interacted with -+ */ -+ public int getEntityId() { -+ return this.entityId; -+ } -+ -+ /** -+ * Returns whether the interaction was an attack. -+ * -+ * @return {@code true} if the player is attacking the entity, {@code false} if the player is interacting with the entity -+ */ -+ public boolean isAttack() { -+ return this.attack; -+ } -+ -+ /** -+ * Returns the hand used to perform this interaction. -+ * -+ * @return the hand used to interact -+ */ -+ public EquipmentSlot getHand() { -+ return this.hand; -+ } -+ -+ /** -+ * Returns the position relative to the entity that was clicked, or {@code null} if not available. -+ * See {@link PlayerInteractAtEntityEvent} for more details. -+ * -+ * @return the position relative to the entity that was clicked, or {@code null} if not available -+ * @see PlayerInteractAtEntityEvent -+ */ -+ public @Nullable Vector getClickedRelativePosition() { -+ return this.clickedPosition != null ? this.clickedPosition.clone() : null; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-Position.patch b/patches/api/Add-Position.patch deleted file mode 100644 index 38facc6f82..0000000000 --- a/patches/api/Add-Position.patch +++ /dev/null @@ -1,438 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 20 Mar 2022 10:42:28 -0700 -Subject: [PATCH] Add Position - - -diff --git a/src/main/java/io/papermc/paper/math/BlockPosition.java b/src/main/java/io/papermc/paper/math/BlockPosition.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/math/BlockPosition.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.math; -+ -+import org.bukkit.Axis; -+import org.bukkit.block.BlockFace; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A position represented with integers. -+ *

-+ * May see breaking changes until Experimental annotation is removed. -+ * -+ * @see FinePosition -+ */ -+@ApiStatus.Experimental -+@NullMarked -+public interface BlockPosition extends Position { -+ -+ @Override -+ default double x() { -+ return this.blockX(); -+ } -+ -+ @Override -+ default double y() { -+ return this.blockY(); -+ } -+ -+ @Override -+ default double z() { -+ return this.blockZ(); -+ } -+ -+ @Override -+ default boolean isBlock() { -+ return true; -+ } -+ -+ @Override -+ default boolean isFine() { -+ return false; -+ } -+ -+ @Override -+ default BlockPosition toBlock() { -+ return this; -+ } -+ -+ @Override -+ default BlockPosition offset(final int x, final int y, final int z) { -+ return x == 0 && y == 0 && z == 0 ? this : new BlockPositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z); -+ } -+ -+ @Override -+ default FinePosition offset(final double x, final double y, final double z) { -+ return new FinePositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z); -+ } -+ -+ /** -+ * Returns a block position offset by 1 in the direction specified. -+ * -+ * @param blockFace the block face to offset towards -+ * @return the offset block position -+ */ -+ @Contract(value = "_ -> new", pure = true) -+ default BlockPosition offset(final BlockFace blockFace) { -+ return this.offset(blockFace, 1); -+ } -+ -+ /** -+ * Returns a block position offset in the direction specified -+ * multiplied by the amount. -+ * -+ * @param blockFace the block face to offset towards -+ * @param amount the number of times to move in that direction -+ * @return the offset block position -+ */ -+ @Contract(pure = true) -+ default BlockPosition offset(final BlockFace blockFace, final int amount) { -+ return amount == 0 ? this : new BlockPositionImpl(this.blockX() + (blockFace.getModX() * amount), this.blockY() + (blockFace.getModY() * amount), this.blockZ() + (blockFace.getModZ() * amount)); -+ } -+ -+ /** -+ * Returns a block position offset by the amount along -+ * the specified axis. -+ * -+ * @param axis the axis to offset along -+ * @param amount the amount to offset along that axis -+ * @return the offset block position -+ */ -+ @Contract(pure = true) -+ default BlockPosition offset(final Axis axis, final int amount) { -+ return amount == 0 ? this : switch (axis) { -+ case X -> new BlockPositionImpl(this.blockX() + amount, this.blockY(), this.blockZ()); -+ case Y -> new BlockPositionImpl(this.blockX(), this.blockY() + amount, this.blockZ()); -+ case Z -> new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ() + amount); -+ }; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/math/BlockPositionImpl.java b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.math; -+ -+record BlockPositionImpl(int blockX, int blockY, int blockZ) implements BlockPosition { -+} -diff --git a/src/main/java/io/papermc/paper/math/FinePosition.java b/src/main/java/io/papermc/paper/math/FinePosition.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/math/FinePosition.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.math; -+ -+import org.bukkit.util.NumberConversions; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A position represented with doubles. -+ *

-+ * May see breaking changes until Experimental annotation is removed. -+ * -+ * @see BlockPosition -+ */ -+@ApiStatus.Experimental -+@NullMarked -+public interface FinePosition extends Position { -+ -+ @Override -+ default int blockX() { -+ return NumberConversions.floor(this.x()); -+ } -+ -+ @Override -+ default int blockY() { -+ return NumberConversions.floor(this.y()); -+ } -+ -+ @Override -+ default int blockZ() { -+ return NumberConversions.floor(this.z()); -+ } -+ -+ @Override -+ default boolean isBlock() { -+ return false; -+ } -+ -+ @Override -+ default boolean isFine() { -+ return true; -+ } -+ -+ @Override -+ default BlockPosition toBlock() { -+ return new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ()); -+ } -+ -+ @Override -+ default FinePosition offset(final int x, final int y, final int z) { -+ return this.offset((double) x, y, z); -+ } -+ -+ @Override -+ default FinePosition offset(final double x, final double y, final double z) { -+ return x == 0.0 && y == 0.0 && z == 0.0 ? this : new FinePositionImpl(this.x() + x, this.y() + y, this.z() + z); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/math/FinePositionImpl.java b/src/main/java/io/papermc/paper/math/FinePositionImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/math/FinePositionImpl.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.math; -+ -+record FinePositionImpl(double x, double y, double z) implements FinePosition { -+} -diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/math/Position.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.math; -+ -+import org.bukkit.Location; -+import org.bukkit.World; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Common interface for {@link FinePosition} and {@link BlockPosition}. -+ *

-+ * May see breaking changes until Experimental annotation is removed. -+ */ -+@ApiStatus.Experimental -+@NullMarked -+public interface Position { -+ -+ FinePosition FINE_ZERO = new FinePositionImpl(0, 0, 0); -+ BlockPosition BLOCK_ZERO = new BlockPositionImpl(0, 0, 0); -+ -+ /** -+ * Gets the block x value for this position -+ * -+ * @return the block x value -+ */ -+ int blockX(); -+ -+ /** -+ * Gets the block x value for this position -+ * -+ * @return the block x value -+ */ -+ int blockY(); -+ -+ /** -+ * Gets the block x value for this position -+ * -+ * @return the block x value -+ */ -+ int blockZ(); -+ -+ /** -+ * Gets the x value for this position -+ * -+ * @return the x value -+ */ -+ double x(); -+ -+ /** -+ * Gets the y value for this position -+ * -+ * @return the y value -+ */ -+ double y(); -+ -+ /** -+ * Gets the z value for this position -+ * -+ * @return the z value -+ */ -+ double z(); -+ -+ /** -+ * Checks of this position represents a {@link BlockPosition} -+ * -+ * @return true if block -+ */ -+ boolean isBlock(); -+ -+ /** -+ * Checks if this position represents a {@link FinePosition} -+ * -+ * @return true if fine -+ */ -+ boolean isFine(); -+ -+ /** -+ * Checks if each component of this position is finite. -+ */ -+ default boolean isFinite() { -+ return Double.isFinite(this.x()) && Double.isFinite(this.y()) && Double.isFinite(this.z()); -+ } -+ -+ /** -+ * Returns a position offset by the specified amounts. -+ * -+ * @param x x value to offset -+ * @param y y value to offset -+ * @param z z value to offset -+ * @return the offset position -+ */ -+ Position offset(int x, int y, int z); -+ -+ /** -+ * Returns a position offset by the specified amounts. -+ * -+ * @param x x value to offset -+ * @param y y value to offset -+ * @param z z value to offset -+ * @return the offset position -+ */ -+ FinePosition offset(double x, double y, double z); -+ -+ /** -+ * Returns a new position at the center of the block position this represents -+ * -+ * @return a new center position -+ */ -+ @Contract(value = "-> new", pure = true) -+ default FinePosition toCenter() { -+ return new FinePositionImpl(this.blockX() + 0.5, this.blockY() + 0.5, this.blockZ() + 0.5); -+ } -+ -+ /** -+ * Returns the block position of this position -+ * or itself if it already is a block position -+ * -+ * @return the block position -+ */ -+ @Contract(pure = true) -+ BlockPosition toBlock(); -+ -+ /** -+ * Converts this position to a vector -+ * -+ * @return a new vector -+ */ -+ @Contract(value = "-> new", pure = true) -+ default Vector toVector() { -+ return new Vector(this.x(), this.y(), this.z()); -+ } -+ -+ /** -+ * Creates a new location object at this position with the specified world -+ * -+ * @param world the world for the location object -+ * @return a new location -+ */ -+ @Contract(value = "_ -> new", pure = true) -+ default Location toLocation(final World world) { -+ return new Location(world, this.x(), this.y(), this.z()); -+ } -+ -+ /** -+ * Creates a position at the coordinates -+ * -+ * @param x x coord -+ * @param y y coord -+ * @param z z coord -+ * @return a position with those coords -+ */ -+ @Contract(value = "_, _, _ -> new", pure = true) -+ static BlockPosition block(final int x, final int y, final int z) { -+ return new BlockPositionImpl(x, y, z); -+ } -+ -+ /** -+ * Creates a position from the location. -+ * -+ * @param location the location to copy the position of -+ * @return a new position at that location -+ */ -+ @Contract(value = "_ -> new", pure = true) -+ static BlockPosition block(final Location location) { -+ return new BlockPositionImpl(location.getBlockX(), location.getBlockY(), location.getBlockZ()); -+ } -+ -+ /** -+ * Creates a position at the coordinates -+ * -+ * @param x x coord -+ * @param y y coord -+ * @param z z coord -+ * @return a position with those coords -+ */ -+ @Contract(value = "_, _, _ -> new", pure = true) -+ static FinePosition fine(final double x, final double y, final double z) { -+ return new FinePositionImpl(x, y, z); -+ } -+ -+ /** -+ * Creates a position from the location. -+ * -+ * @param location the location to copy the position of -+ * @return a new position at that location -+ */ -+ @Contract(value = "_ -> new", pure = true) -+ static FinePosition fine(final Location location) { -+ return new FinePositionImpl(location.getX(), location.getY(), location.getZ()); -+ } -+} -diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Location.java -+++ b/src/main/java/org/bukkit/Location.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * magnitude than 360 are valid, but may be normalized to any other equivalent - * representation by the implementation. - */ --public class Location implements Cloneable, ConfigurationSerializable { -+public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper - private Reference world; - private double x; - private double y; -@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable { - } - return pitch; - } -+ -+ // Paper - add Position -+ @Override -+ public double x() { -+ return this.getX(); -+ } -+ -+ @Override -+ public double y() { -+ return this.getY(); -+ } -+ -+ @Override -+ public double z() { -+ return this.getZ(); -+ } -+ -+ @Override -+ public boolean isFinite() { -+ return io.papermc.paper.math.FinePosition.super.isFinite() && Float.isFinite(this.getYaw()) && Float.isFinite(this.getPitch()); -+ } -+ -+ @Override -+ public @NotNull Location toLocation(@NotNull World world) { -+ return new Location(world, this.x(), this.y(), this.z(), this.getYaw(), this.getPitch()); -+ } -+ // Paper end - } diff --git a/patches/api/Add-PrePlayerAttackEntityEvent.patch b/patches/api/Add-PrePlayerAttackEntityEvent.patch deleted file mode 100644 index d6e180fda0..0000000000 --- a/patches/api/Add-PrePlayerAttackEntityEvent.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 18 Sep 2022 13:10:28 -0400 -Subject: [PATCH] Add PrePlayerAttackEntityEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when the player tries to attack an entity. -+ *

-+ * This occurs before any of the damage logic, so cancelling this event -+ * will prevent any sort of sounds from being played when attacking. -+ *

-+ * This event will fire as cancelled for certain entities, with {@link PrePlayerAttackEntityEvent#willAttack()} being false -+ * to indicate that this entity will not actually be attacked. -+ *

-+ * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover -+ */ -+@NullMarked -+public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity attacked; -+ private final boolean willAttack; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PrePlayerAttackEntityEvent(final Player player, final Entity attacked, final boolean willAttack) { -+ super(player); -+ this.attacked = attacked; -+ this.willAttack = willAttack; -+ this.cancelled = !willAttack; -+ } -+ -+ /** -+ * Gets the entity that was attacked in this event. -+ * -+ * @return entity that was attacked -+ */ -+ public Entity getAttacked() { -+ return this.attacked; -+ } -+ -+ /** -+ * Gets if this entity will be attacked normally. -+ * Entities like falling sand will return {@code false} because -+ * their entity type does not allow them to be attacked. -+ *

-+ * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover -+ * -+ * @return if the entity will actually be attacked -+ */ -+ public boolean willAttack() { -+ return this.willAttack; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Sets if this attack should be cancelled, note if {@link PrePlayerAttackEntityEvent#willAttack()} returns false -+ * this event will always be cancelled. -+ * -+ * @param cancel {@code true} if you wish to cancel this event -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ if (!this.willAttack) { -+ return; -+ } -+ -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch b/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch deleted file mode 100644 index f6b598beaa..0000000000 --- a/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch +++ /dev/null @@ -1,206 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Fri, 3 Jul 2020 11:58:56 -0500 -Subject: [PATCH] Add PrepareResultEvent / PrepareGrindstoneEvent - -Adds a new event for all crafting stations that generate a result slot item - -Anvil, Grindstone and Smithing now extend this event - -Grindstone is a backwards compat from a previous PrepareGrindstoneEvent - -diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.inventory; -+ -+import org.bukkit.Warning; -+import org.bukkit.inventory.GrindstoneInventory; -+import org.bukkit.inventory.InventoryView; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when an item is put in a slot for grinding in a Grindstone -+ * -+ * @deprecated use {@link org.bukkit.event.inventory.PrepareGrindstoneEvent} -+ */ -+@Deprecated(since = "1.16.1") -+@Warning -+public class PrepareGrindstoneEvent extends PrepareResultEvent { -+ -+ @ApiStatus.Internal -+ public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { -+ super(inventory, result); -+ } -+ -+ @NotNull -+ @Override -+ public GrindstoneInventory getInventory() { -+ return (GrindstoneInventory) super.getInventory(); -+ } -+ -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.inventory; -+ -+import org.bukkit.event.inventory.PrepareInventoryResultEvent; -+import org.bukkit.inventory.InventoryView; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when an item is put in an inventory containing a result slot -+ */ -+@NullMarked -+public class PrepareResultEvent extends PrepareInventoryResultEvent { -+ -+ // HandlerList on PrepareInventoryResultEvent to ensure api compat -+ -+ @ApiStatus.Internal -+ public PrepareResultEvent(final InventoryView inventory, final @Nullable ItemStack result) { -+ super(inventory, result); -+ } -+ -+ /** -+ * Get result item, may be {@code null}. -+ * -+ * @return result item -+ */ -+ @Override -+ public @Nullable ItemStack getResult() { -+ return super.getResult(); -+ } -+ -+ /** -+ * Set result item, may be {@code null}. -+ * -+ * @param result result item -+ */ -+ @Override -+ public void setResult(final @Nullable ItemStack result) { -+ super.setResult(result); -+ } -+} -diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Called when an item is put in a slot for repair by an anvil. - */ --public class PrepareAnvilEvent extends PrepareInventoryResultEvent { -+public class PrepareAnvilEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent { - -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - move HandlerList to PrepareInventoryResultEvent - - public PrepareAnvilEvent(@NotNull AnvilView inventory, @Nullable ItemStack result) { - super(inventory, result); -@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent { - return (AnvilView) super.getView(); - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - move HandlerList to PrepareInventoryResultEvent - } -diff --git a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Called when an item is put in a slot for repair or unenchanting in a grindstone. - */ --public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent { -+public class PrepareGrindstoneEvent extends com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent { // Paper - -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - move HandlerList to PrepareInventoryResultEvent - - public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { - super(inventory, result); -@@ -0,0 +0,0 @@ public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent { - return (GrindstoneInventory) super.getInventory(); - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - move HandlerList to PrepareInventoryResultEvent - } -diff --git a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - - /** - * Called when an item is put in a slot and the result is calculated. -+ * @deprecated use {@link com.destroystokyo.paper.event.inventory.PrepareResultEvent} - */ -+@Deprecated @org.bukkit.Warning(false) // Paper - public class PrepareInventoryResultEvent extends InventoryEvent { - - private static final HandlerList handlers = new HandlerList(); -diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Called when an item is put in a slot for upgrade by a Smithing Table. - */ --public class PrepareSmithingEvent extends PrepareInventoryResultEvent { -+public class PrepareSmithingEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent { - -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - move HandlerList ot PrepareInventoryResultEvent - - public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { - super(inventory, result); -@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends PrepareInventoryResultEvent { - return (SmithingInventory) super.getInventory(); - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - move HandlerList to PrepareInventoryResultEvent - } diff --git a/patches/api/Add-ProjectileCollideEvent.patch b/patches/api/Add-ProjectileCollideEvent.patch deleted file mode 100644 index 0b9f8b7ca9..0000000000 --- a/patches/api/Add-ProjectileCollideEvent.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Techcable -Date: Fri, 16 Dec 2016 21:25:39 -0600 -Subject: [PATCH] Add ProjectileCollideEvent - -Now deprecated and replaced with ProjectileHitEvent - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Projectile; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityDamageByEntityEvent; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a projectile collides with an entity -+ *

-+ * This event is called before {@link EntityDamageByEntityEvent}, and cancelling it will allow the projectile to continue flying -+ * -+ * @deprecated Deprecated, use {@link org.bukkit.event.entity.ProjectileHitEvent} and check if there is a hit entity -+ */ -+@Deprecated(since = "1.19.3") -+public class ProjectileCollideEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final Entity collidedWith; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public ProjectileCollideEvent(@NotNull Projectile projectile, @NotNull Entity collidedWith) { -+ super(projectile); -+ this.collidedWith = collidedWith; -+ } -+ -+ /** -+ * Get the projectile that collided -+ * -+ * @return the projectile that collided -+ */ -+ @NotNull -+ public Projectile getEntity() { -+ return (Projectile) super.getEntity(); -+ } -+ -+ /** -+ * Get the entity the projectile collided with -+ * -+ * @return the entity collided with -+ */ -+ @NotNull -+ public Entity getCollidedWith() { -+ return this.collidedWith; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-PufferFishStateChangeEvent.patch b/patches/api/Add-PufferFishStateChangeEvent.patch deleted file mode 100644 index da5161715a..0000000000 --- a/patches/api/Add-PufferFishStateChangeEvent.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: HexedHero <6012891+HexedHero@users.noreply.github.com> -Date: Mon, 10 May 2021 16:58:38 +0100 -Subject: [PATCH] Add PufferFishStateChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.PufferFish; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called just before a {@link PufferFish} inflates or deflates. -+ */ -+@NullMarked -+public class PufferFishStateChangeEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final int newPuffState; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PufferFishStateChangeEvent(final PufferFish entity, final int newPuffState) { -+ super(entity); -+ this.newPuffState = newPuffState; -+ } -+ -+ @Override -+ public PufferFish getEntity() { -+ return (PufferFish) super.getEntity(); -+ } -+ -+ /** -+ * Get the new puff state of the {@link PufferFish}. -+ *

-+ * This is what the {@link PufferFish}'s new puff state will be after this event if it isn't cancelled.
-+ * Refer to {@link PufferFish#getPuffState()} to get the current puff state. -+ * -+ * @return The new puff state, 0 being not inflated, 1 being slightly inflated and 2 being fully inflated -+ */ -+ public int getNewPuffState() { -+ return this.newPuffState; -+ } -+ -+ /** -+ * Get if the {@link PufferFish} is going to inflate. -+ * -+ * @return If it's going to inflate -+ */ -+ public boolean isInflating() { -+ return this.newPuffState > this.getEntity().getPuffState(); -+ } -+ -+ /** -+ * Get if the {@link PufferFish} is going to deflate. -+ * -+ * @return If it's going to deflate -+ */ -+ public boolean isDeflating() { -+ return this.newPuffState < this.getEntity().getPuffState(); -+ } -+ -+ /** -+ * Set whether to cancel the {@link PufferFish} (in/de)flating. -+ * -+ * @param cancel {@code true} if you wish to cancel the (in/de)flation -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-Raw-Byte-Entity-Serialization.patch b/patches/api/Add-Raw-Byte-Entity-Serialization.patch deleted file mode 100644 index 87db065cfa..0000000000 --- a/patches/api/Add-Raw-Byte-Entity-Serialization.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Sun, 24 Oct 2021 16:19:26 -0400 -Subject: [PATCH] Add Raw Byte Entity Serialization - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ public interface UnsafeValues { - - ItemStack deserializeItem(byte[] data); - -+ byte[] serializeEntity(org.bukkit.entity.Entity entity); -+ -+ default org.bukkit.entity.Entity deserializeEntity(byte[] data, World world) { -+ return deserializeEntity(data, world, false); -+ } -+ -+ org.bukkit.entity.Entity deserializeEntity(byte[] data, World world, boolean preserveUUID); -+ - /** - * Creates and returns the next EntityId available. - *

-diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - @Deprecated - @NotNull Set getTrackedPlayers(); -+ -+ /** -+ * Spawns the entity in the world at the given {@link Location} with the default spawn reason. -+ *

-+ * This will not spawn the entity if the entity is already spawned or has previously been despawned. -+ *

-+ * Also, this method will fire the same events as a normal entity spawn. -+ * -+ * @param location The location to spawn the entity at. -+ * @return Whether the entity was successfully spawned. -+ */ -+ public default boolean spawnAt(@NotNull Location location) { -+ return spawnAt(location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT); -+ } -+ -+ /** -+ * Spawns the entity in the world at the given {@link Location} with the reason given. -+ *

-+ * This will not spawn the entity if the entity is already spawned or has previously been despawned. -+ *

-+ * Also, this method will fire the same events as a normal entity spawn. -+ * -+ * @param location The location to spawn the entity at. -+ * @param reason The reason for the entity being spawned. -+ * @return Whether the entity was successfully spawned. -+ */ -+ public boolean spawnAt(@NotNull Location location, @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason); - // Paper end - } diff --git a/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch b/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch deleted file mode 100644 index 57e83288d9..0000000000 --- a/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Thu, 30 Apr 2020 16:56:31 +0200 -Subject: [PATCH] Add Raw Byte ItemStack Serialization - -Serializes using NBT which is safer for server data migrations than bukkits format. - -Co-authored-by: Nassim Jahnke - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ public interface UnsafeValues { - default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { - return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher(); - } -+ -+ byte[] serializeItem(ItemStack item); -+ -+ ItemStack deserializeItem(byte[] data); - // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - return Bukkit.getServer().getItemFactory().ensureServerConversions(this); - } - -+ /** -+ * Deserializes this itemstack from raw NBT bytes. NBT is safer for data migrations as it will -+ * use the built in data converter instead of bukkits dangerous serialization system. -+ * -+ * This expects that the DataVersion was stored on the root of the Compound, as saved from -+ * the {@link #serializeAsBytes()} API returned. -+ * @param bytes bytes representing an item in NBT -+ * @return ItemStack migrated to this version of Minecraft if needed. -+ */ -+ @NotNull -+ public static ItemStack deserializeBytes(@NotNull byte[] bytes) { -+ return org.bukkit.Bukkit.getUnsafe().deserializeItem(bytes); -+ } -+ -+ /** -+ * Serializes this itemstack to raw bytes in NBT. NBT is safer for data migrations as it will -+ * use the built in data converter instead of bukkits dangerous serialization system. -+ * @return bytes representing this item in NBT. -+ */ -+ @NotNull -+ public byte[] serializeAsBytes() { -+ return org.bukkit.Bukkit.getUnsafe().serializeItem(this); -+ } -+ -+ /** -+ * The current version byte of the item array format used in {@link #serializeItemsAsBytes(java.util.Collection)} -+ * and {@link #deserializeItemsFromBytes(byte[])} respectively. -+ */ -+ private static final byte ARRAY_SERIALIZATION_VERSION = 1; -+ -+ /** -+ * Serializes a collection of items to raw bytes in NBT. Serializes null items as {@link #empty()}. -+ *

-+ * If you need a string representation to put into a file, you can for example use {@link java.util.Base64} encoding. -+ * -+ * @param items items to serialize -+ * @return bytes representing the items in NBT -+ * @see #serializeAsBytes() -+ */ -+ public static byte @NotNull [] serializeItemsAsBytes(java.util.@NotNull Collection items) { -+ try (final java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream()) { -+ final java.io.DataOutput output = new java.io.DataOutputStream(outputStream); -+ output.writeByte(ARRAY_SERIALIZATION_VERSION); -+ output.writeInt(items.size()); -+ for (final ItemStack item : items) { -+ if (item == null || item.isEmpty()) { -+ // Ensure the correct order by including empty/null items -+ output.writeInt(0); -+ continue; -+ } -+ -+ final byte[] itemBytes = item.serializeAsBytes(); -+ output.writeInt(itemBytes.length); -+ output.write(itemBytes); -+ } -+ return outputStream.toByteArray(); -+ } catch (final java.io.IOException e) { -+ throw new RuntimeException("Error while writing itemstack", e); -+ } -+ } -+ -+ /** -+ * Serializes a collection of items to raw bytes in NBT. Serializes null items as {@link #empty()}. -+ *

-+ * If you need a string representation to put into a file, you can for example use {@link java.util.Base64} encoding. -+ * -+ * @param items items to serialize -+ * @return bytes representing the items in NBT -+ * @see #serializeAsBytes() -+ */ -+ public static byte @NotNull [] serializeItemsAsBytes(@Nullable ItemStack @NotNull [] items) { -+ return serializeItemsAsBytes(java.util.Arrays.asList(items)); -+ } -+ -+ /** -+ * Deserializes this itemstack from raw NBT bytes. -+ *

-+ * If you need a string representation to put into a file, you can for example use {@link java.util.Base64} encoding. -+ * -+ * @param bytes bytes representing an item in NBT -+ * @return ItemStack array migrated to this version of Minecraft if needed -+ * @see #deserializeBytes(byte[]) -+ */ -+ public static @NotNull ItemStack @NotNull [] deserializeItemsFromBytes(final byte @NotNull [] bytes) { -+ try (final java.io.ByteArrayInputStream inputStream = new java.io.ByteArrayInputStream(bytes)) { -+ final java.io.DataInputStream input = new java.io.DataInputStream(inputStream); -+ final byte version = input.readByte(); -+ if (version != ARRAY_SERIALIZATION_VERSION) { -+ throw new IllegalArgumentException("Unsupported version or bad data: " + version); -+ } -+ -+ final int count = input.readInt(); -+ final ItemStack[] items = new ItemStack[count]; -+ for (int i = 0; i < count; i++) { -+ final int length = input.readInt(); -+ if (length == 0) { -+ // Empty item, keep entry as empty -+ items[i] = ItemStack.empty(); -+ continue; -+ } -+ -+ final byte[] itemBytes = new byte[length]; -+ input.read(itemBytes); -+ items[i] = ItemStack.deserializeBytes(itemBytes); -+ } -+ return items; -+ } catch (final java.io.IOException e) { -+ throw new RuntimeException("Error while reading itemstack", e); -+ } -+ } -+ - /** - * Gets the Display name as seen in the Client. - * Currently the server only supports the English language. To override this, -diff --git a/src/main/java/org/bukkit/util/io/BukkitObjectInputStream.java b/src/main/java/org/bukkit/util/io/BukkitObjectInputStream.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/util/io/BukkitObjectInputStream.java -+++ b/src/main/java/org/bukkit/util/io/BukkitObjectInputStream.java -@@ -0,0 +0,0 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization; - *

- * Behavior of implementations extending this class is not guaranteed across - * future versions. -+ * @deprecated Object streams on their own are not safe. For safer and more consistent serialization of items, -+ * use {@link org.bukkit.inventory.ItemStack#serializeAsBytes()} or -+ * {@link org.bukkit.inventory.ItemStack#serializeItemsAsBytes(java.util.Collection)}. - */ -+@Deprecated(since = "1.21") // Paper - public class BukkitObjectInputStream extends ObjectInputStream { - - /** -diff --git a/src/main/java/org/bukkit/util/io/BukkitObjectOutputStream.java b/src/main/java/org/bukkit/util/io/BukkitObjectOutputStream.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/util/io/BukkitObjectOutputStream.java -+++ b/src/main/java/org/bukkit/util/io/BukkitObjectOutputStream.java -@@ -0,0 +0,0 @@ import org.bukkit.configuration.serialization.ConfigurationSerializable; - *

- * Behavior of implementations extending this class is not guaranteed across - * future versions. -+ * @deprecated Object streams on their own are not safe. For safer and more consistent serialization of items, -+ * use {@link org.bukkit.inventory.ItemStack#serializeAsBytes()} or -+ * {@link org.bukkit.inventory.ItemStack#serializeItemsAsBytes(java.util.Collection)}. - */ -+@Deprecated(since = "1.21") // Paper - public class BukkitObjectOutputStream extends ObjectOutputStream { - - /** diff --git a/patches/api/Add-RegistryAccess-for-managing-registries.patch b/patches/api/Add-RegistryAccess-for-managing-registries.patch deleted file mode 100644 index 9f42e4bc06..0000000000 --- a/patches/api/Add-RegistryAccess-for-managing-registries.patch +++ /dev/null @@ -1,599 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -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..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/Reference.java -@@ -0,0 +0,0 @@ -+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 type of the value -+ */ -+@Deprecated(forRemoval = true, since = "1.20.6") -+public interface Reference 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 the type of the value -+ * @return a reference -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ static @NotNull Reference create(@NotNull Registry 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..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java -@@ -0,0 +0,0 @@ -+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(@NotNull Registry registry, @NotNull NamespacedKey key) implements Reference { -+ -+ @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..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/RegistryAccess.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.registry; -+ -+import org.bukkit.Keyed; -+import org.bukkit.Registry; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Used for accessing different {@link Registry} instances -+ * by a {@link RegistryKey}. Get the main instance of {@link RegistryAccess} -+ * with {@link RegistryAccess#registryAccess()}. -+ */ -+@NullMarked -+@ApiStatus.NonExtendable -+public interface RegistryAccess { -+ -+ /** -+ * Get the {@link RegistryAccess} instance for the server. -+ * -+ * @return the RegistryAccess instance -+ */ -+ static 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 the type -+ * @deprecated use {@link #getRegistry(RegistryKey)} with keys from {@link RegistryKey} -+ */ -+ @Deprecated(since = "1.20.6", forRemoval = true) -+ @Nullable Registry getRegistry(Class type); -+ -+ /** -+ * Gets the registry with the specified key. -+ * -+ * @param registryKey the key -+ * @return the registry -+ * @param 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. -+ Registry getRegistry(RegistryKey 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..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.registry; -+ -+import java.util.Optional; -+import java.util.ServiceLoader; -+ -+final class RegistryAccessHolder { -+ -+ static final Optional 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java -+++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java -@@ -0,0 +0,0 @@ record RegistryKeyImpl(Key key) implements RegistryKey { - - static final Set> REGISTRY_KEYS = Sets.newIdentityHashSet(); - -+ // override equals and hashCode to this can be used to simulate an "identity" hashmap -+ @Override -+ public boolean equals(final @Nullable Object obj) { -+ return obj == this; -+ } -+ -+ @Override -+ public int hashCode() { -+ return System.identityHashCode(this); -+ } -+ - static RegistryKey create(@Subst("some_key") final String key) { - final RegistryKey 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - * @param tClass of the registry to get - * @param 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 Registry getRegistry(@NotNull Class tClass) { - return server.getRegistry(tClass); - } -diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Particle.java -+++ b/src/main/java/org/bukkit/Particle.java -@@ -0,0 +0,0 @@ public enum Particle implements Keyed { - - private final NamespacedKey key; - private final Class dataType; -- final boolean register; -+ // Paper - all particles are registered - - Particle(String key) { - this(key, Void.class); - } - -- Particle(String key, boolean register) { -- this(key, Void.class, register); -- } -+ // Paper - all particles are registered - - Particle(String key, /*@NotNull*/ Class data) { -- this(key, data, true); -- } -- -- Particle(String key, /*@NotNull*/ Class data, boolean register) { -+ // Paper - all particles are registered - if (key != null) { - this.key = NamespacedKey.minecraft(key); - } else { - this.key = null; - } - dataType = data; -- this.register = register; -+ // Paper - all particles are registered - } - - /** -diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Registry.java -+++ b/src/main/java/org/bukkit/Registry.java -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { - * Server art. - * - * @see Art -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT} - */ -- Registry ART = Objects.requireNonNull(Bukkit.getRegistry(Art.class), "No registry present for Art. This is a bug."); -+ @Deprecated(since = "1.21.3") // Paper -+ Registry ART = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Art.class), "No registry present for Art. This is a bug."); - /** - * Attribute. - * - * @see Attribute - */ -- Registry ATTRIBUTE = Objects.requireNonNull(Bukkit.getRegistry(Attribute.class), "No registry present for Attribute. This is a bug."); -+ Registry ATTRIBUTE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ATTRIBUTE); // Paper - /** - * Server banner patterns. - * - * @see PatternType -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN} - */ -- Registry BANNER_PATTERN = Objects.requireNonNull(Bukkit.getRegistry(PatternType.class), "No registry present for Pattern Type. This is a bug."); -+ @Deprecated(since = "1.21") // Paper -+ Registry BANNER_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(PatternType.class), "No registry present for PatternType. This is a bug."); // Paper - /** - * Server biomes. - * - * @see Biome -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#BIOME} - */ -- Registry BIOME = Objects.requireNonNull(Bukkit.getRegistry(Biome.class), "No registry present for Biome. This is a bug."); -+ @Deprecated(since = "1.21.3") // Paper -+ Registry BIOME = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Biome.class), "No registry present for Biome. This is a bug."); - /** - * Server block types. - * -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { - * @apiNote BlockType is not ready for public usage yet - */ - @ApiStatus.Internal -- Registry BLOCK = Objects.requireNonNull(Bukkit.getRegistry(BlockType.class), "No registry present for BlockType. This is a bug."); -+ Registry BLOCK = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.BLOCK); // Paper - /** - * Custom boss bars. - * -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { - * - * @see Cat.Type - */ -- Registry CAT_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Cat.Type.class), "No registry present for Cat Type. This is a bug."); -+ Registry CAT_VARIANT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.CAT_VARIANT); // Paper - /** - * Server enchantments. - * - * @see Enchantment -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#ENCHANTMENT} - */ -- Registry ENCHANTMENT = Objects.requireNonNull(Bukkit.getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug."); -+ @Deprecated(since = "1.21") -+ Registry ENCHANTMENT = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug."); // Paper - /** - * Server entity types. - * - * @see EntityType - */ -- Registry ENTITY_TYPE = new SimpleRegistry<>(EntityType.class, (entity) -> entity != EntityType.UNKNOWN); -+ Registry ENTITY_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ENTITY_TYPE); // Paper - /** - * Server instruments. - * - * @see MusicInstrument -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#INSTRUMENT} - */ -- Registry INSTRUMENT = Objects.requireNonNull(Bukkit.getRegistry(MusicInstrument.class), "No registry present for MusicInstrument. This is a bug."); -+ @Deprecated(since = "1.21.2") -+ Registry INSTRUMENT = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(MusicInstrument.class), "No registry present for Instruments. This is a bug."); // Paper - /** - * Server item types. - * -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { - * @apiNote ItemType is not ready for public usage yet - */ - @ApiStatus.Internal -- Registry ITEM = Objects.requireNonNull(Bukkit.getRegistry(ItemType.class), "No registry present for ItemType. This is a bug."); -+ Registry ITEM = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ITEM); // Paper - /** - * Default server loot tables. - * -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { - * @see MenuType - */ - @ApiStatus.Experimental -- Registry MENU = Objects.requireNonNull(Bukkit.getRegistry(MenuType.class), "No registry present for MenuType. This is a bug."); -+ Registry MENU = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.MENU); // Paper - /** - * Server mob effects. - * - * @see PotionEffectType - */ -- Registry EFFECT = Objects.requireNonNull(Bukkit.getRegistry(PotionEffectType.class), "No registry present for PotionEffectType. This is a bug."); -+ Registry EFFECT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.MOB_EFFECT); // Paper - /** - * Server particles. - * - * @see Particle - */ -- Registry PARTICLE_TYPE = new SimpleRegistry<>(Particle.class, (par) -> par.register); -+ Registry PARTICLE_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.PARTICLE_TYPE); // Paper - /** - * Server potions. - * - * @see PotionType - */ -- Registry POTION = new SimpleRegistry<>(PotionType.class); -+ Registry POTION = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.POTION); // Paper - /** - * Server statistics. - * -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { - * 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 = Objects.requireNonNull(Bukkit.getRegistry(Structure.class), "No registry present for Structure. This is a bug."); -+ @Deprecated(since = "1.20.6") // Paper -+ Registry 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 STRUCTURE_TYPE = Objects.requireNonNull(Bukkit.getRegistry(StructureType.class), "No registry present for StructureType. This is a bug."); -+ Registry STRUCTURE_TYPE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.STRUCTURE_TYPE), "No registry present for StructureType. This is a bug."); // Paper - /** - * Sound keys. - * - * @see Sound - */ -- Registry SOUNDS = Objects.requireNonNull(Bukkit.getRegistry(Sound.class), "No registry present for Sound. This is a bug."); -+ Registry SOUNDS = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.SOUND_EVENT); // Paper - /** - * 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 TRIM_MATERIAL = Objects.requireNonNull(Bukkit.getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug."); -+ @Deprecated(since = "1.20.6") // Paper -+ Registry 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 TRIM_PATTERN = Objects.requireNonNull(Bukkit.getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug."); -+ @Deprecated(since = "1.20.6") -+ Registry 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 DAMAGE_TYPE = Objects.requireNonNull(Bukkit.getRegistry(DamageType.class), "No registry present for DamageType. This is a bug."); -+ @Deprecated(since = "1.20.6") -+ Registry DAMAGE_TYPE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(DamageType.class), "No registry present for DamageType. This is a bug."); // Paper - /** - * Jukebox songs. - * - * @see JukeboxSong -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#JUKEBOX_SONG} - */ - @ApiStatus.Experimental -- Registry JUKEBOX_SONG = Objects.requireNonNull(Bukkit.getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug."); -+ @Deprecated(since = "1.21") -+ Registry JUKEBOX_SONG = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug."); // Paper - /** - * Villager profession. - * - * @see Villager.Profession - */ -- Registry VILLAGER_PROFESSION = Objects.requireNonNull(Bukkit.getRegistry(Villager.Profession.class), "No registry present for Villager Profession. This is a bug."); -+ Registry VILLAGER_PROFESSION = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.VILLAGER_PROFESSION); // Paper - /** - * Villager type. - * - * @see Villager.Type - */ -- Registry VILLAGER_TYPE = Objects.requireNonNull(Bukkit.getRegistry(Villager.Type.class), "No registry present for Villager Type. This is a bug."); -+ Registry VILLAGER_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.VILLAGER_TYPE); // Paper - /** - * Memory Keys. - * -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { - * - * @see Fluid - */ -- Registry FLUID = Objects.requireNonNull(Bukkit.getRegistry(Fluid.class), "No registry present for Fluid. This is a bug."); -+ Registry FLUID = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.FLUID); // Paper - /** - * Frog variants. - * - * @see Frog.Variant - */ -- Registry FROG_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Frog.Variant.class), "No registry present for Frog Variant. This is a bug."); -+ Registry FROG_VARIANT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.FROG_VARIANT); // Paper - /** - * 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 = 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 = 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. - * - * @see MapCursor.Type - */ -- Registry MAP_DECORATION_TYPE = Objects.requireNonNull(Bukkit.getRegistry(MapCursor.Type.class), "No registry present for MapCursor Type. This is a bug."); -+ Registry MAP_DECORATION_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.MAP_DECORATION_TYPE); // Paper - /** - * Game events. - * - * @see GameEvent - */ -- Registry GAME_EVENT = Objects.requireNonNull(Bukkit.getRegistry(GameEvent.class), "No registry present for GameEvent. This is a bug."); -+ Registry GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper - /** - * Get the object by its key. - * -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { - return (namespacedKey != null) ? get(namespacedKey) : null; - } - -- static final class SimpleRegistry & Keyed> implements Registry { -+ class SimpleRegistry & Keyed> implements Registry { // Paper - remove final - - private final Class type; - private final Map map; -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * @param tClass of the registry to get - * @param 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 - Registry getRegistry(@NotNull Class 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..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java -@@ -0,0 +0,0 @@ -+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 Registry getRegistry(final @NotNull Class type) { -+ throw new UnsupportedOperationException("Not supported"); -+ } -+ -+ @Override -+ public @NotNull Registry getRegistry(final @NotNull RegistryKey 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/support/TestServer.java -+++ b/src/test/java/org/bukkit/support/TestServer.java -@@ -0,0 +0,0 @@ public final class TestServer { - - when(instance.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion()); - -- Map, Registry> registers = new HashMap<>(); -- when(instance.getRegistry(any())).then(invocationOnMock -> registers.computeIfAbsent(invocationOnMock.getArgument(0), aClass -> new Registry<>() { -- private final Map cache = new HashMap<>(); -- -- @Override -- public Keyed get(NamespacedKey key) { -- Class theClass; -- // Some registries have extra Typed classes such as BlockType and ItemType. -- // To avoid class cast exceptions during init mock the Typed class. -- // To get the correct class, we just use the field type. -- try { -- theClass = (Class) aClass.getField(key.getKey().toUpperCase(Locale.ROOT).replace('.', '_')).getType(); -- } catch (ClassCastException | NoSuchFieldException e) { -- throw new RuntimeException(e); -- } -- -- return cache.computeIfAbsent(key, key2 -> mock(theClass, withSettings().stubOnly())); -- } -- -- @NotNull -- @Override -- public Keyed getOrThrow(@NotNull NamespacedKey key) { -- Keyed keyed = get(key); -- -- Preconditions.checkArgument(keyed != null, "No %s registry entry found for key %s.", aClass, key); -- -- return keyed; -- } -- -- @NotNull -- @Override -- public Stream stream() { -- throw new UnsupportedOperationException("Not supported"); -- } -- -- @Override -- public Iterator iterator() { -- throw new UnsupportedOperationException("Not supported"); -- } -- })); -+ // Paper start - RegistryAccess -+ when(instance.getRegistry(any())).then(invocationOnMock -> { -+ return io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(((Class)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..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess -@@ -0,0 +1 @@ -+io.papermc.paper.registry.TestRegistryAccess diff --git a/patches/api/Add-Shearable-API.patch b/patches/api/Add-Shearable-API.patch deleted file mode 100644 index 07610ab778..0000000000 --- a/patches/api/Add-Shearable-API.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 17 Oct 2021 15:39:41 -0400 -Subject: [PATCH] Add Shearable API - - -diff --git a/src/main/java/io/papermc/paper/entity/Shearable.java b/src/main/java/io/papermc/paper/entity/Shearable.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/Shearable.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.entity; -+ -+import net.kyori.adventure.sound.Sound; -+import org.bukkit.entity.Entity; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Represents an entity that can be sheared. -+ */ -+@NullMarked -+public interface Shearable extends Entity { -+ -+ /** -+ * Forces the entity to be sheared and then play the effect as if it were sheared by a player. -+ * This will cause the entity to be sheared, even if {@link Shearable#readyToBeSheared()} is false. -+ *

-+ * Some shearing behavior may cause the entity to no longer be valid -+ * due to it being replaced by a different entity. -+ */ -+ default void shear() { -+ this.shear(Sound.Source.PLAYER); -+ } -+ -+ /** -+ * Forces the entity to be sheared and then play the effect as if it were sheared by the provided source. -+ * This will cause the entity to be sheared, even if {@link Shearable#readyToBeSheared()} is false. -+ *

-+ * Some shearing behavior may cause the entity to no longer be valid -+ * due to it being replaced by a different entity. -+ *

-+ * This simulates the behavior of an actual shearing, which may cause events like EntityTransformEvent to be called -+ * for mooshrooms, and EntityDropItemEvent to be called for sheep. -+ * -+ * @param source Sound source to play any sound effects on -+ */ -+ void shear(Sound.Source source); -+ -+ /** -+ * Gets if the entity would be able to be sheared or not naturally using shears. -+ * -+ * @return if the entity can be sheared -+ */ -+ boolean readyToBeSheared(); -+} -diff --git a/src/main/java/org/bukkit/entity/Bogged.java b/src/main/java/org/bukkit/entity/Bogged.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Bogged.java -+++ b/src/main/java/org/bukkit/entity/Bogged.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.ApiStatus; - * Represents a Bogged Skeleton. - */ - @ApiStatus.Experimental --public interface Bogged extends AbstractSkeleton, Shearable { -+public interface Bogged extends AbstractSkeleton, Shearable, io.papermc.paper.entity.Shearable { // Paper - Shear API - - /** - * Gets whether the bogged is in its sheared state. -diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/MushroomCow.java -+++ b/src/main/java/org/bukkit/entity/MushroomCow.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a mushroom {@link Cow} - */ --public interface MushroomCow extends Cow { -+public interface MushroomCow extends Cow, io.papermc.paper.entity.Shearable { // Paper - - /** - * Checks for the presence of custom potion effects to be applied to the -diff --git a/src/main/java/org/bukkit/entity/Shearable.java b/src/main/java/org/bukkit/entity/Shearable.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Shearable.java -+++ b/src/main/java/org/bukkit/entity/Shearable.java -@@ -0,0 +0,0 @@ package org.bukkit.entity; - - /** - * Represents an entity which can be shorn with shears. -+ * @deprecated Spigots shearable API miserably fails at capturing all entities that may be sheared by a player, like -+ * mushroom cows which, once sheared, convert into normal cows. For such entities, methods like -+ * {@link #setSheared(boolean)} or {@link #isSheared()} make no sense, making this API and interface dead API from -+ * the get-go. - */ -+@Deprecated(forRemoval = true, since = "1.21") - public interface Shearable { - - /** - * Gets whether the entity is in its sheared state. - * - * @return Whether the entity is sheared. -+ * @deprecated Use {@link io.papermc.paper.entity.Shearable#readyToBeSheared()} instead. - */ -+ @Deprecated(forRemoval = true, since = "1.21") - boolean isSheared(); - - /** - * Sets whether the entity is in its sheared state. - * - * @param flag Whether to shear the entity -+ * @deprecated Use {@link io.papermc.paper.entity.Shearable#shear()} instead if applicable. -+ * Some entities cannot be "unsheared". - */ -+ @Deprecated(forRemoval = true, since = "1.21") - void setSheared(boolean flag); - } -diff --git a/src/main/java/org/bukkit/entity/Sheep.java b/src/main/java/org/bukkit/entity/Sheep.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Sheep.java -+++ b/src/main/java/org/bukkit/entity/Sheep.java -@@ -0,0 +0,0 @@ import org.bukkit.material.Colorable; - /** - * Represents a Sheep. - */ --public interface Sheep extends Animals, Colorable, Shearable { -+public interface Sheep extends Animals, Colorable, Shearable, io.papermc.paper.entity.Shearable { // Paper - Shear API - - /** - * Gets whether the sheep is in its sheared state. -diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Snowman.java -+++ b/src/main/java/org/bukkit/entity/Snowman.java -@@ -0,0 +0,0 @@ import com.destroystokyo.paper.entity.RangedEntity; - /** - * Represents a snowman entity - */ --public interface Snowman extends Golem, RangedEntity { // Paper -+public interface Snowman extends Golem, RangedEntity, io.papermc.paper.entity.Shearable { // Paper - - /** - * Gets whether this snowman is in "derp mode", meaning it is not wearing a diff --git a/patches/api/Add-ShulkerDuplicateEvent.patch b/patches/api/Add-ShulkerDuplicateEvent.patch deleted file mode 100644 index eb4e07b70c..0000000000 --- a/patches/api/Add-ShulkerDuplicateEvent.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chase Henderson -Date: Fri, 5 Jan 2024 03:50:10 -0500 -Subject: [PATCH] Add ShulkerDuplicateEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.Shulker; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired when a shulker duplicates itself by spawning a new shulker. -+ *

-+ * The event is fired prior to the newly created shulker, accessible via {@link #getEntity()}, being added to the world. -+ */ -+@NullMarked -+public class ShulkerDuplicateEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Shulker parent; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public ShulkerDuplicateEvent(final Shulker child, final Shulker parent) { -+ super(child); -+ this.parent = parent; -+ } -+ -+ /** -+ * Provides the newly created shulker, which did not exist prior to the duplication. -+ * At the point of this event, said shulker is not part of the world yet. -+ * -+ * @return the newly duplicated shulker. -+ */ -+ @Override -+ public Shulker getEntity() { -+ return (Shulker) super.getEntity(); -+ } -+ -+ /** -+ * Provides the "parent" of the freshly created shulker. -+ * The parent shulker is the one that initiated the duplication. -+ * -+ * @return the previously existing shulker which duplicated. -+ */ -+ public Shulker getParent() { -+ return this.parent; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-Sneaking-API-for-Entities.patch b/patches/api/Add-Sneaking-API-for-Entities.patch deleted file mode 100644 index 0f3f1c83b3..0000000000 --- a/patches/api/Add-Sneaking-API-for-Entities.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dawon -Date: Wed, 19 Oct 2022 23:36:42 +0200 -Subject: [PATCH] Add Sneaking API for Entities - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - @NotNull - Pose getPose(); - -+ // Paper start -+ /** -+ * Returns if the entity is in sneak mode -+ * -+ * @return true if the entity is in sneak mode -+ */ -+ boolean isSneaking(); -+ -+ /** -+ * Sets the sneak mode the entity. -+ *

-+ * Note: For most Entities this does not update Entity's pose -+ * and just makes its name tag less visible. -+ * -+ * @param sneak true if the entity should be sneaking -+ */ -+ void setSneaking(boolean sneak); -+ // Paper end -+ - /** - * Get the category of spawn to which this entity belongs. - * -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * - * @return true if player is in sneak mode - */ -+ @Override // Paper - public boolean isSneaking(); - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * - * @param sneak true if player should appear sneaking - */ -+ @Override // Paper - public void setSneaking(boolean sneak); - - /** diff --git a/patches/api/Add-String-based-Action-Bar-API.patch b/patches/api/Add-String-based-Action-Bar-API.patch deleted file mode 100644 index cec074fe1f..0000000000 --- a/patches/api/Add-String-based-Action-Bar-API.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 20 Dec 2016 15:55:55 -0500 -Subject: [PATCH] Add String based Action Bar API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - public void sendMap(@NotNull MapView map); - - // Paper start -+ -+ /** -+ * Sends an Action Bar message to the client. -+ * -+ * Use Section symbols for legacy color codes to send formatting. -+ * -+ * @param message The message to send -+ * @deprecated use {@link #sendActionBar(net.kyori.adventure.text.Component)} -+ */ -+ @Deprecated -+ public void sendActionBar(@NotNull String message); -+ -+ /** -+ * Sends an Action Bar message to the client. -+ * -+ * Use supplied alternative character to the section symbol to represent legacy color codes. -+ * -+ * @param alternateChar Alternate symbol such as '&' -+ * @param message The message to send -+ * @deprecated use {@link #sendActionBar(net.kyori.adventure.text.Component)} -+ */ -+ @Deprecated -+ public void sendActionBar(char alternateChar, @NotNull String message); -+ -+ /** -+ * Sends an Action Bar message to the client. -+ * -+ * @param message The components to send -+ * @deprecated use {@link #sendActionBar(net.kyori.adventure.text.Component)} -+ */ -+ @Deprecated -+ public void sendActionBar(@NotNull net.md_5.bungee.api.chat.BaseComponent... message); -+ - /** - * Sends the component to the player - * -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - /** - * Sends an array of components as a single message to the specified screen position of this player - * -+ * @deprecated This is unlikely the API you want to use. See {@link #sendActionBar(String)} for a more proper Action Bar API. This deprecated API may send unsafe items to the client. - * @param position the screen position - * @param components the components to send - */ -+ @Deprecated - public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) { - spigot().sendMessage(position, components); - } diff --git a/patches/api/Add-Structure-check-API.patch b/patches/api/Add-Structure-check-API.patch deleted file mode 100644 index 0e7619cf01..0000000000 --- a/patches/api/Add-Structure-check-API.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 27 Mar 2023 10:20:06 -0700 -Subject: [PATCH] Add Structure check API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - */ - int getPlayerCount(); - // Paper end -+ // Paper start - structure check API -+ /** -+ * Check if the naturally-generated structure exists at the position. -+ *

-+ * Note that if the position is not loaded, this may cause chunk loads/generation -+ * to check if a structure is at that position. Use {@link #isPositionLoaded(io.papermc.paper.math.Position)} -+ * to check if a position is loaded -+ * -+ * @param position the position to check at -+ * @param structure the structure to check for -+ * @return true if that structure exists at the position -+ */ -+ boolean hasStructureAt(io.papermc.paper.math.@NotNull Position position, @NotNull Structure structure); -+ -+ /** -+ * Checks if this position is loaded. -+ * -+ * @param position position to check -+ * @return true if loaded -+ */ -+ default boolean isPositionLoaded(io.papermc.paper.math.@NotNull Position position) { -+ return this.isChunkLoaded(position.blockX() >> 4, position.blockZ() >> 4); -+ } -+ // Paper end - - /** - * Gets the {@link Block} at the given coordinates diff --git a/patches/api/Add-StructuresLocateEvent.patch b/patches/api/Add-StructuresLocateEvent.patch deleted file mode 100644 index 9febf91f2a..0000000000 --- a/patches/api/Add-StructuresLocateEvent.patch +++ /dev/null @@ -1,190 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dfsek -Date: Tue, 15 Sep 2020 21:59:16 -0700 -Subject: [PATCH] Add StructuresLocateEvent - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.world; -+ -+import io.papermc.paper.math.Position; -+import java.util.Collections; -+import java.util.List; -+import org.bukkit.Location; -+import org.bukkit.World; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.world.WorldEvent; -+import org.bukkit.generator.structure.Structure; -+import org.bukkit.generator.structure.StructureType; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.UnmodifiableView; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called before a set of configured structures is located. -+ * This happens when: -+ *

-+ */ -+@NullMarked -+public class StructuresLocateEvent extends WorldEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Location origin; -+ private @Nullable Result result; -+ private List structures; -+ private int radius; -+ private boolean findUnexplored; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public StructuresLocateEvent(final World world, final Location origin, final List structures, final int radius, final boolean findUnexplored) { -+ super(world); -+ this.origin = origin; -+ this.structures = structures; -+ this.radius = radius; -+ this.findUnexplored = findUnexplored; -+ } -+ -+ /** -+ * Gets the {@link Location} from which the search is to be conducted. -+ * -+ * @return {@link Location} where search begins -+ */ -+ public Location getOrigin() { -+ return this.origin.clone(); -+ } -+ -+ /** -+ * Gets the {@link Location} and {@link Structure} set as the result, if it was defined. -+ *

-+ * Returns {@code null} if it has not been set by {@link StructuresLocateEvent#setResult(Result)}. -+ * Since this event fires before the search is done, the actual result is unknown at this point. -+ * -+ * @return The result location and structure, if it has been set. {@code null} if it has not. -+ * @see World#locateNearestStructure(Location, StructureType, int, boolean) -+ */ -+ public @Nullable Result getResult() { -+ return this.result; -+ } -+ -+ /** -+ * Sets the result {@link Location} and {@link Structure}. This causes the search to be -+ * skipped, and the result object passed here to be used as the result. -+ * -+ * @param result the {@link Location} and {@link Structure} of the search. -+ */ -+ public void setResult(final @Nullable Result result) { -+ this.result = result; -+ } -+ -+ /** -+ * Gets an unmodifiable list of Structures that are valid targets for the search. -+ * -+ * @return an unmodifiable list of Structures -+ */ -+ public @UnmodifiableView List getStructures() { -+ return Collections.unmodifiableList(this.structures); -+ } -+ -+ /** -+ * Sets the list of Structures that are valid targets for the search. -+ * -+ * @param structures a list of Structures targets -+ */ -+ public void setStructures(final List structures) { -+ this.structures = structures; -+ } -+ -+ /** -+ * Gets the search radius in which to attempt locating the structure. -+ *

-+ * This radius may not always be obeyed during the structure search! -+ * -+ * @return the search radius (in chunks) -+ */ -+ public int getRadius() { -+ return this.radius; -+ } -+ -+ /** -+ * Sets the search radius in which to attempt locating the structure. -+ *

-+ * This radius may not always be obeyed during the structure search! -+ * -+ * @param radius the search radius (in chunks) -+ */ -+ public void setRadius(final int radius) { -+ this.radius = radius; -+ } -+ -+ /** -+ * Gets whether to search exclusively for unexplored structures. -+ *

-+ * As with the search radius, this value is not always obeyed. -+ * -+ * @return Whether to search for only unexplored structures. -+ */ -+ public boolean shouldFindUnexplored() { -+ return this.findUnexplored; -+ } -+ -+ /** -+ * Sets whether to search exclusively for unexplored structures. -+ *

-+ * As with the search radius, this value is not always obeyed. -+ * -+ * @param findUnexplored Whether to search for only unexplored structures. -+ */ -+ public void setFindUnexplored(final boolean findUnexplored) { -+ this.findUnexplored = findUnexplored; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * Result for {@link StructuresLocateEvent}. -+ */ -+ public record Result(Position pos, Structure structure) { -+ -+ @Deprecated(forRemoval = true) -+ public Location position() { -+ //noinspection DataFlowIssue -+ return this.pos.toLocation(null); -+ } -+ } -+} diff --git a/patches/api/Add-TNTPrimeEvent.patch b/patches/api/Add-TNTPrimeEvent.patch deleted file mode 100644 index 105dd77404..0000000000 --- a/patches/api/Add-TNTPrimeEvent.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Sun, 15 Jul 2018 22:17:55 +0300 -Subject: [PATCH] Add TNTPrimeEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.block; -+ -+import org.bukkit.Material; -+import org.bukkit.block.Block; -+import org.bukkit.enchantments.Enchantment; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.entity.TNTPrimed; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when TNT block is about to turn into {@link TNTPrimed} -+ *

-+ * Cancelling it won't turn TNT into {@link TNTPrimed} and leaves -+ * the TNT block as-is -+ * -+ * @author Mark Vainomaa -+ * @deprecated use {@link org.bukkit.event.block.TNTPrimeEvent} -+ */ -+@Deprecated(forRemoval = true, since = "1.19.4") -+public class TNTPrimeEvent extends BlockEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final PrimeReason reason; -+ @Nullable private final Entity primerEntity; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public TNTPrimeEvent(@NotNull Block theBlock, @NotNull PrimeReason reason, @Nullable Entity primerEntity) { -+ super(theBlock); -+ this.reason = reason; -+ this.primerEntity = primerEntity; -+ } -+ -+ /** -+ * Gets the TNT prime reason -+ * -+ * @return Prime reason -+ */ -+ @NotNull -+ public PrimeReason getReason() { -+ return this.reason; -+ } -+ -+ /** -+ * Gets the TNT primer {@link Entity}. -+ *

-+ * It's {@code null} if {@link #getReason()} is {@link PrimeReason#REDSTONE} or {@link PrimeReason#FIRE}. -+ * It's not {@code null} if {@link #getReason()} is {@link PrimeReason#ITEM} or {@link PrimeReason#PROJECTILE} -+ * It might be {@code null} if {@link #getReason()} is {@link PrimeReason#EXPLOSION} -+ * -+ * @return The {@link Entity} who primed the TNT -+ */ -+ @Nullable -+ public Entity getPrimerEntity() { -+ return this.primerEntity; -+ } -+ -+ /** -+ * Gets whether spawning {@link TNTPrimed} should be cancelled or not -+ * -+ * @return Whether spawning {@link TNTPrimed} should be cancelled or not -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Sets whether to cancel spawning {@link TNTPrimed} or not -+ * -+ * @param cancel whether spawning {@link TNTPrimed} should be cancelled or not -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum PrimeReason { -+ /** -+ * When TNT prime was caused by other explosion (chain reaction) -+ */ -+ EXPLOSION, -+ -+ /** -+ * When TNT prime was caused by fire -+ */ -+ FIRE, -+ -+ /** -+ * When {@link Player} used {@link Material#FLINT_AND_STEEL} or -+ * {@link Material#FIRE_CHARGE} on given TNT block -+ */ -+ ITEM, -+ -+ /** -+ * When TNT prime was caused by an {@link Entity} shooting TNT -+ * using a bow with {@link Enchantment#FLAME} enchantment -+ */ -+ PROJECTILE, -+ -+ /** -+ * When redstone power triggered the TNT prime -+ */ -+ REDSTONE -+ } -+} diff --git a/patches/api/Add-TameableDeathMessageEvent.patch b/patches/api/Add-TameableDeathMessageEvent.patch deleted file mode 100644 index a696f088f1..0000000000 --- a/patches/api/Add-TameableDeathMessageEvent.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Fri, 19 Mar 2021 23:25:38 -0400 -Subject: [PATCH] Add TameableDeathMessageEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java b/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.Tameable; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a {@link Tameable} dies and sends a death message. -+ */ -+@NullMarked -+public class TameableDeathMessageEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private Component deathMessage; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public TameableDeathMessageEvent(final Tameable tameable, final Component deathMessage) { -+ super(tameable); -+ this.deathMessage = deathMessage; -+ } -+ -+ /** -+ * Set the death message that appears to the owner of the tameable. -+ * -+ * @param deathMessage Death message to appear -+ */ -+ public void deathMessage(final Component deathMessage) { -+ this.deathMessage = deathMessage; -+ } -+ -+ /** -+ * Get the death message that appears to the owner of the tameable. -+ * -+ * @return Death message to appear -+ */ -+ public Component deathMessage() { -+ return this.deathMessage; -+ } -+ -+ @Override -+ public Tameable getEntity() { -+ return (Tameable) super.getEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-TargetHitEvent-API.patch b/patches/api/Add-TargetHitEvent-API.patch deleted file mode 100644 index fb7d945401..0000000000 --- a/patches/api/Add-TargetHitEvent-API.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Wed, 25 Nov 2020 23:21:32 -0800 -Subject: [PATCH] Add TargetHitEvent API - - -diff --git a/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.block; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockFace; -+import org.bukkit.entity.Projectile; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.ProjectileHitEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Range; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a Target Block is hit by a projectile. -+ *

-+ * Cancelling this event will stop the Target from emitting a redstone signal, -+ * and in the case that the shooter is a player, will stop them from receiving -+ * advancement criteria. -+ */ -+@NullMarked -+public class TargetHitEvent extends ProjectileHitEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private int signalStrength; -+ -+ @ApiStatus.Internal -+ public TargetHitEvent(final Projectile projectile, final Block block, final BlockFace blockFace, final int signalStrength) { -+ super(projectile, null, block, blockFace); -+ this.signalStrength = signalStrength; -+ } -+ -+ /** -+ * Gets the strength of the redstone signal to be emitted by the Target block -+ * -+ * @return the strength of the redstone signal to be emitted -+ */ -+ public @Range(from = 0, to = 15) int getSignalStrength() { -+ return this.signalStrength; -+ } -+ -+ /** -+ * Sets the strength of the redstone signal to be emitted by the Target block -+ * -+ * @param signalStrength the strength of the redstone signal to be emitted -+ */ -+ public void setSignalStrength(final @Range(from = 0, to = 15) int signalStrength) { -+ Preconditions.checkArgument(signalStrength >= 0 && signalStrength <= 15, "Signal strength out of range (%s), must be in range [0,15]", signalStrength); -+ this.signalStrength = signalStrength; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-ThrownEggHatchEvent.patch b/patches/api/Add-ThrownEggHatchEvent.patch deleted file mode 100644 index 4398dfba7e..0000000000 --- a/patches/api/Add-ThrownEggHatchEvent.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 9 Feb 2020 00:19:08 -0600 -Subject: [PATCH] Add ThrownEggHatchEvent - -Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement -(dispensers can throw eggs to hatch them, too). - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Egg; -+import org.bukkit.entity.EntityType; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a thrown egg might hatch. -+ *

-+ * This event fires for all thrown eggs that may hatch, players, dispensers, etc. -+ */ -+@NullMarked -+public class ThrownEggHatchEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Egg egg; -+ private boolean hatching; -+ private byte numHatches; -+ private EntityType hatchType; -+ -+ @ApiStatus.Internal -+ public ThrownEggHatchEvent(final Egg egg, final boolean hatching, final byte numHatches, final EntityType hatchingType) { -+ this.egg = egg; -+ this.hatching = hatching; -+ this.numHatches = numHatches; -+ this.hatchType = hatchingType; -+ } -+ -+ /** -+ * Gets the egg involved in this event. -+ * -+ * @return the egg involved in this event -+ */ -+ public Egg getEgg() { -+ return this.egg; -+ } -+ -+ /** -+ * Gets whether the egg is hatching or not. Will be what the server -+ * would've done without interaction. -+ * -+ * @return boolean Whether the egg is going to hatch or not -+ */ -+ public boolean isHatching() { -+ return this.hatching; -+ } -+ -+ /** -+ * Sets whether the egg will hatch or not. -+ * -+ * @param hatching {@code true} if you want the egg to hatch, {@code false} if you want it -+ * not to -+ */ -+ public void setHatching(final boolean hatching) { -+ this.hatching = hatching; -+ } -+ -+ /** -+ * Get the type of the mob being hatched ({@link EntityType#CHICKEN} by default) -+ * -+ * @return The type of the mob being hatched by the egg -+ */ -+ public EntityType getHatchingType() { -+ return this.hatchType; -+ } -+ -+ /** -+ * Change the type of mob being hatched by the egg -+ * -+ * @param hatchType The type of the mob being hatched by the egg -+ */ -+ public void setHatchingType(final EntityType hatchType) { -+ Preconditions.checkArgument(hatchType.isSpawnable(), "Can't spawn that entity type from an egg!"); -+ this.hatchType = hatchType; -+ } -+ -+ /** -+ * Get the number of mob hatches from the egg. By default, the number will -+ * be the number the server would've done -+ *

    -+ *
  • 7/8 chance of being 0 -+ *
  • 31/256 ~= 1/8 chance to be 1 -+ *
  • 1/256 chance to be 4 -+ *
-+ * -+ * @return The number of mobs going to be hatched by the egg -+ */ -+ public byte getNumHatches() { -+ return this.numHatches; -+ } -+ -+ /** -+ * Change the number of mobs coming out of the hatched egg -+ *

-+ * The boolean hatching will override this number. I.e. If hatching is -+ * {@code false}, this number will not matter -+ * -+ * @param numHatches The number of mobs coming out of the egg -+ */ -+ public void setNumHatches(final byte numHatches) { -+ this.numHatches = numHatches; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-Tick-TemporalUnit.patch b/patches/api/Add-Tick-TemporalUnit.patch deleted file mode 100644 index 94ddd3e051..0000000000 --- a/patches/api/Add-Tick-TemporalUnit.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Kieran Wallbanks -Date: Fri, 2 Apr 2021 17:28:58 +0100 -Subject: [PATCH] Add Tick TemporalUnit - - -diff --git a/src/main/java/io/papermc/paper/util/Tick.java b/src/main/java/io/papermc/paper/util/Tick.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/util/Tick.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.util; -+ -+import java.time.Duration; -+import java.time.temporal.ChronoUnit; -+import java.time.temporal.Temporal; -+import java.time.temporal.TemporalUnit; -+import java.util.Objects; -+import net.kyori.adventure.util.Ticks; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A TemporalUnit that represents the target length of one server tick. This is defined -+ * as 50 milliseconds. Note that this class is not for measuring the length that a tick -+ * took, rather it is used for simple conversion between times and ticks. -+ * -+ * @see #tick() -+ */ -+@NullMarked -+public final class Tick implements TemporalUnit { -+ -+ private static final Tick INSTANCE = new Tick(Ticks.SINGLE_TICK_DURATION_MS); -+ -+ private final long milliseconds; -+ -+ /** -+ * Gets the instance of the tick temporal unit. -+ * -+ * @return the tick instance -+ */ -+ public static Tick tick() { -+ return INSTANCE; -+ } -+ -+ /** -+ * Creates a new tick. -+ * -+ * @param length the length of the tick in milliseconds -+ * @see #tick() -+ */ -+ private Tick(final long length) { -+ this.milliseconds = length; -+ } -+ -+ /** -+ * Creates a duration from an amount of ticks. This is shorthand for -+ * {@link Duration#of(long, TemporalUnit)} called with the amount of ticks and -+ * {@link #tick()}. -+ * -+ * @param ticks the amount of ticks -+ * @return the duration -+ */ -+ public static Duration of(final long ticks) { -+ return Duration.of(ticks, INSTANCE); -+ } -+ -+ /** -+ * Gets the number of whole ticks that occur in the provided duration. Note that this -+ * method returns an {@code int} as this is the unit that Minecraft stores ticks in. -+ * -+ * @param duration the duration -+ * @return the number of whole ticks in this duration -+ * @throws ArithmeticException if the duration is zero or an overflow occurs -+ */ -+ public int fromDuration(final Duration duration) { -+ Objects.requireNonNull(duration, "duration cannot be null"); -+ return Math.toIntExact(Math.floorDiv(duration.toMillis(), this.milliseconds)); -+ } -+ -+ @Override -+ public Duration getDuration() { -+ return Duration.ofMillis(this.milliseconds); -+ } -+ -+ // Note: This is a workaround in order to allow calculations with this duration. -+ // See: Duration#add -+ @Override -+ public boolean isDurationEstimated() { -+ return false; -+ } -+ -+ @Override -+ public boolean isDateBased() { -+ return false; -+ } -+ -+ @Override -+ public boolean isTimeBased() { -+ return true; -+ } -+ -+ @SuppressWarnings("unchecked") // following ChronoUnit#addTo -+ @Override -+ public R addTo(final R temporal, final long amount) { -+ return (R) temporal.plus(this.getDuration().multipliedBy(amount)); -+ } -+ -+ @Override -+ public long between(final Temporal start, final Temporal end) { -+ return start.until(end, ChronoUnit.MILLIS) / this.milliseconds; -+ } -+} -diff --git a/src/test/java/io/papermc/paper/util/TickTest.java b/src/test/java/io/papermc/paper/util/TickTest.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/test/java/io/papermc/paper/util/TickTest.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.util; -+ -+import java.time.Duration; -+import java.time.Instant; -+import java.time.temporal.ChronoUnit; -+import org.junit.jupiter.api.Test; -+ -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ -+public class TickTest { -+ -+ @Test -+ public void testTickLength() { -+ assertEquals(50, Duration.of(1, Tick.tick()).toMillis()); -+ assertEquals(100, Duration.of(2, Tick.tick()).toMillis()); -+ } -+ -+ @Test -+ public void testTickFromDuration() { -+ assertEquals(0, Tick.tick().fromDuration(Duration.ofMillis(0))); -+ assertEquals(0, Tick.tick().fromDuration(Duration.ofMillis(10))); -+ assertEquals(1, Tick.tick().fromDuration(Duration.ofMillis(60))); -+ assertEquals(2, Tick.tick().fromDuration(Duration.ofMillis(100))); -+ } -+ -+ @Test -+ public void testAddTickToInstant() { -+ Instant now = Instant.now(); -+ assertEquals(now, now.plus(0, Tick.tick())); -+ assertEquals(now.plus(50, ChronoUnit.MILLIS), now.plus(1, Tick.tick())); -+ assertEquals(now.plus(100, ChronoUnit.MILLIS), now.plus(2, Tick.tick())); -+ assertEquals(now.plus(150, ChronoUnit.MILLIS), now.plus(3, Tick.tick())); -+ } -+ -+ @Test -+ public void testTicksBetweenInstants() { -+ Instant now = Instant.now(); -+ assertEquals(0, now.until(now.plus(20, ChronoUnit.MILLIS), Tick.tick())); -+ assertEquals(1, now.until(now.plus(50, ChronoUnit.MILLIS), Tick.tick())); -+ assertEquals(1, now.until(now.plus(60, ChronoUnit.MILLIS), Tick.tick())); -+ assertEquals(2, now.until(now.plus(100, ChronoUnit.MILLIS), Tick.tick())); -+ } -+} diff --git a/patches/api/Add-UnknownCommandEvent.patch b/patches/api/Add-UnknownCommandEvent.patch deleted file mode 100644 index 39daf8e00b..0000000000 --- a/patches/api/Add-UnknownCommandEvent.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Sweepyoface -Date: Sat, 17 Jun 2017 18:48:06 -0400 -Subject: [PATCH] Add UnknownCommandEvent - - -diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java -@@ -0,0 +0,0 @@ -+package org.bukkit.event.command; -+ -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -+import org.bukkit.command.CommandSender; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Thrown when a player executes a command that is not defined -+ */ -+@NullMarked -+public class UnknownCommandEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final CommandSender sender; -+ private final String commandLine; -+ private @Nullable Component message; -+ -+ @ApiStatus.Internal -+ public UnknownCommandEvent(final CommandSender sender, final String commandLine, final @Nullable Component message) { -+ super(false); -+ this.sender = sender; -+ this.commandLine = commandLine; -+ this.message = message; -+ } -+ -+ /** -+ * Gets the CommandSender or ConsoleCommandSender -+ * -+ * @return Sender of the command -+ */ -+ public CommandSender getSender() { -+ return this.sender; -+ } -+ -+ /** -+ * Gets the command that was sent -+ * -+ * @return Command sent -+ */ -+ public String getCommandLine() { -+ return this.commandLine; -+ } -+ -+ /** -+ * Gets message that will be returned -+ * -+ * @return Unknown command message -+ * @deprecated use {@link #message()} -+ */ -+ @Deprecated -+ public @Nullable String getMessage() { -+ return this.message == null ? null : LegacyComponentSerializer.legacySection().serialize(this.message); -+ } -+ -+ /** -+ * Sets message that will be returned -+ *

-+ * Set to {@code null} to avoid any message being sent -+ * -+ * @param message the message to be returned, or {@code null} -+ * @deprecated use {@link #message(Component)} -+ */ -+ @Deprecated -+ public void setMessage(@Nullable String message) { -+ this.message(message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message)); -+ } -+ -+ /** -+ * Gets message that will be returned -+ * -+ * @return Unknown command message -+ */ -+ @Contract(pure = true) -+ public @Nullable Component message() { -+ return this.message; -+ } -+ -+ /** -+ * Sets message that will be returned -+ *

-+ * Set to {@code null} to avoid any message being sent -+ * -+ * @param message the message to be returned, or {@code null} -+ */ -+ public void message(@Nullable Component message) { -+ this.message = message; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -+ diff --git a/patches/api/Add-WardenAngerChangeEvent.patch b/patches/api/Add-WardenAngerChangeEvent.patch deleted file mode 100644 index b61e768424..0000000000 --- a/patches/api/Add-WardenAngerChangeEvent.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: nopjar -Date: Sun, 12 Jun 2022 00:56:45 +0200 -Subject: [PATCH] Add WardenAngerChangeEvent - -Adding a event which gets called when a warden is angered by -another entity. - -diff --git a/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Warden; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Range; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a Warden's anger level has changed due to another entity. -+ *

-+ * If the event is cancelled, the warden's anger level will not change. -+ */ -+@NullMarked -+public class WardenAngerChangeEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity target; -+ private final int oldAnger; -+ private int newAnger; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WardenAngerChangeEvent(final Warden warden, final Entity target, final int oldAnger, final int newAnger) { -+ super(warden); -+ this.target = target; -+ this.oldAnger = oldAnger; -+ this.newAnger = newAnger; -+ } -+ -+ /** -+ * Gets the entity which triggered this anger update. -+ * -+ * @return triggering entity -+ */ -+ public Entity getTarget() { -+ return this.target; -+ } -+ -+ /** -+ * Gets the old anger level. -+ * -+ * @return old anger level -+ * @see Warden#getAnger(Entity) -+ */ -+ public @Range(from = 0, to = 150) int getOldAnger() { -+ return this.oldAnger; -+ } -+ -+ /** -+ * Gets the new anger level resulting from this event. -+ * -+ * @return new anger level -+ * @see Warden#getAnger(Entity) -+ */ -+ public @Range(from = 0, to = 150) int getNewAnger() { -+ return this.newAnger; -+ } -+ -+ /** -+ * Sets the new anger level resulting from this event. -+ *

-+ * The anger of a warden is capped at 150. -+ * -+ * @param newAnger the new anger level, max 150 -+ * @throws IllegalArgumentException if newAnger is greater than 150 -+ * @see Warden#setAnger(Entity, int) -+ */ -+ public void setNewAnger(final @Range(from = 0, to = 150) int newAnger) { -+ Preconditions.checkArgument(newAnger <= 150, "newAnger must not be greater than 150"); -+ this.newAnger = newAnger; -+ } -+ -+ @Override -+ public Warden getEntity() { -+ return (Warden) super.getEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-WaterBottleSplashEvent.patch b/patches/api/Add-WaterBottleSplashEvent.patch deleted file mode 100644 index 59de70fc1e..0000000000 --- a/patches/api/Add-WaterBottleSplashEvent.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Thu, 8 Dec 2022 10:12:23 -0700 -Subject: [PATCH] Add WaterBottleSplashEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import java.util.Collection; -+import java.util.Map; -+import java.util.Set; -+import java.util.stream.Collectors; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockFace; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.ThrownPotion; -+import org.bukkit.event.entity.PotionSplashEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Unmodifiable; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when a splash water potion "splashes" and affects -+ * different entities in different ways. -+ */ -+@NullMarked -+public class WaterBottleSplashEvent extends PotionSplashEvent { -+ -+ private final Set rehydrate; -+ private final Set extinguish; -+ -+ @ApiStatus.Internal -+ public WaterBottleSplashEvent( -+ final ThrownPotion potion, -+ final @Nullable Entity hitEntity, -+ final @Nullable Block hitBlock, -+ final @Nullable BlockFace hitFace, -+ final Map affectedEntities, -+ final Set rehydrate, -+ final Set extinguish -+ ) { -+ super(potion, hitEntity, hitBlock, hitFace, affectedEntities); -+ this.rehydrate = rehydrate; -+ this.extinguish = extinguish; -+ } -+ -+ /** -+ * Gets an immutable collection of entities that -+ * will take damage as a result of this event. Use -+ * other methods on this class to modify which entities -+ * take damage. -+ * -+ * @return an immutable collection of entities -+ * @see #doNotDamageAsWaterSensitive(LivingEntity) -+ * @see #damageAsWaterSensitive(LivingEntity) -+ */ -+ public @Unmodifiable Collection getToDamage() { -+ return this.affectedEntities.entrySet().stream().filter(entry -> entry.getValue() > 0).map(Map.Entry::getKey).collect(Collectors.toUnmodifiableSet()); -+ } -+ -+ /** -+ * Removes this entity from the group that -+ * will be damaged. -+ * -+ * @param entity entity to remove -+ */ -+ public void doNotDamageAsWaterSensitive(final LivingEntity entity) { -+ this.affectedEntities.remove(entity); -+ } -+ -+ /** -+ * Adds this entity to the group that -+ * will be damaged -+ * -+ * @param entity entity to add -+ */ -+ public void damageAsWaterSensitive(final LivingEntity entity) { -+ this.affectedEntities.put(entity, 1.0); -+ } -+ -+ /** -+ * Get a mutable collection of entities -+ * that will be rehydrated by this. -+ *

-+ * As of 1.19.3 this only will contain Axolotls as they -+ * are the only entity type that can be rehydrated, but -+ * it may change in the future. -+ * -+ * @return the entities -+ */ -+ public Collection getToRehydrate() { -+ return this.rehydrate; -+ } -+ -+ /** -+ * Get a mutable collection of entities that will -+ * be extinguished as a result of this event. -+ * -+ * @return entities to be extinguished -+ */ -+ public Collection getToExtinguish() { -+ return this.extinguish; -+ } -+ -+ /** -+ * @return a confusing collection, don't use it -+ * @deprecated Use {@link #getToDamage()} -+ */ -+ @Deprecated(since = "1.19.3") -+ @Override -+ public Collection getAffectedEntities() { -+ return super.getAffectedEntities(); -+ } -+ -+ /** -+ * Doesn't make sense for this event as intensity doesn't vary. -+ * -+ * @return a confusing value -+ * @deprecated check if {@link #getToDamage()} contains an entity -+ */ -+ @Deprecated(since = "1.19.3") -+ @Override -+ public double getIntensity(final LivingEntity entity) { -+ return super.getIntensity(entity); -+ } -+ -+ /** -+ * Doesn't make sense for this event as intensity doesn't vary. -+ * -+ * @deprecated use {@link #damageAsWaterSensitive(LivingEntity)} -+ * or {@link #doNotDamageAsWaterSensitive(LivingEntity)} to change which entities are -+ * damaged -+ */ -+ @Deprecated(since = "1.19.3") -+ @Override -+ public void setIntensity(final LivingEntity entity, final double intensity) { -+ super.setIntensity(entity, intensity); -+ } -+} -diff --git a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java -+++ b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; -- private final Map affectedEntities; -+ protected final Map affectedEntities; // Paper - - @Deprecated(since = "1.20.2") - public PotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final Map affectedEntities) { diff --git a/patches/api/Add-WhitelistToggleEvent.patch b/patches/api/Add-WhitelistToggleEvent.patch deleted file mode 100644 index db5caabd74..0000000000 --- a/patches/api/Add-WhitelistToggleEvent.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Wed, 13 Mar 2019 20:04:43 +0200 -Subject: [PATCH] Add WhitelistToggleEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.server; -+ -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * This event is fired when whitelist is toggled -+ * -+ * @author Mark Vainomaa -+ */ -+@NullMarked -+public class WhitelistToggleEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final boolean enabled; -+ -+ @ApiStatus.Internal -+ public WhitelistToggleEvent(final boolean enabled) { -+ this.enabled = enabled; -+ } -+ -+ /** -+ * Gets whether whitelist is going to be enabled or not -+ * -+ * @return Whether whitelist is going to be enabled or not -+ */ -+ public boolean isEnabled() { -+ return this.enabled; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-World.getEntity-UUID-API.patch b/patches/api/Add-World.getEntity-UUID-API.patch deleted file mode 100644 index b0f7d9ec33..0000000000 --- a/patches/api/Add-World.getEntity-UUID-API.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brokkonaut -Date: Tue, 3 Jul 2018 16:07:16 +0200 -Subject: [PATCH] Add World.getEntity(UUID) API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @NotNull - public Collection getNearbyEntities(@NotNull Location location, double x, double y, double z); - -+ // Paper start - getEntity by UUID API -+ /** -+ * Gets an entity in this world by its UUID -+ * -+ * @param uuid the UUID of the entity -+ * @return the entity with the given UUID, or null if it isn't found -+ */ -+ @Nullable -+ public Entity getEntity(@NotNull java.util.UUID uuid); -+ // Paper end -+ - /** - * Returns a list of entities within a bounding box centered around a - * Location. diff --git a/patches/api/Add-a-call-helper-to-Event.patch b/patches/api/Add-a-call-helper-to-Event.patch deleted file mode 100644 index e48918d150..0000000000 --- a/patches/api/Add-a-call-helper-to-Event.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 19 May 2013 20:36:58 -0400 -Subject: [PATCH] Add a call helper to Event - -Reduces diff in Server patches - -diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/Event.java -+++ b/src/main/java/org/bukkit/event/Event.java -@@ -0,0 +0,0 @@ public abstract class Event { - this.async = isAsync; - } - -+ // Paper start -+ /** -+ * Calls the event and tests if cancelled. -+ * -+ * @return false if event was cancelled, if cancellable. otherwise true. -+ */ -+ public boolean callEvent() { -+ org.bukkit.Bukkit.getPluginManager().callEvent(this); -+ if (this instanceof Cancellable) { -+ return !((Cancellable) this).isCancelled(); -+ } else { -+ return true; -+ } -+ } -+ // Paper end -+ - /** - * Convenience method for providing a user-friendly identifier. By - * default, it is the event's class's {@linkplain Class#getSimpleName() diff --git a/patches/api/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/api/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch deleted file mode 100644 index 79011bb7b5..0000000000 --- a/patches/api/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MeFisto94 -Date: Tue, 11 May 2021 00:48:51 +0200 -Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and - Skeletons - - -diff --git a/src/main/java/org/bukkit/entity/AbstractSkeleton.java b/src/main/java/org/bukkit/entity/AbstractSkeleton.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/AbstractSkeleton.java -+++ b/src/main/java/org/bukkit/entity/AbstractSkeleton.java -@@ -0,0 +0,0 @@ public interface AbstractSkeleton extends Monster, com.destroystokyo.paper.entit - @Deprecated(since = "1.17") - @Contract("_ -> fail") - public void setSkeletonType(Skeleton.SkeletonType type); -+ -+ // Paper start -+ /** -+ * Check if this skeleton will burn in the sunlight. This -+ * does not take into account an entity's natural fire -+ * immunity. -+ * -+ * @return True if skeleton will burn in sunlight -+ */ -+ boolean shouldBurnInDay(); -+ -+ /** -+ * Set if this skeleton should burn in the sunlight. This -+ * will not override an entity's natural fire -+ * immunity. -+ * -+ * @param shouldBurnInDay True to burn in sunlight -+ */ -+ void setShouldBurnInDay(boolean shouldBurnInDay); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Phantom.java -+++ b/src/main/java/org/bukkit/entity/Phantom.java -@@ -0,0 +0,0 @@ public interface Phantom extends Flying, Enemy { - */ - @Nullable - public java.util.UUID getSpawningEntity(); -+ -+ /** -+ * Check if this phantom will burn in the sunlight -+ * -+ * @return True if phantom will burn in sunlight -+ */ -+ public boolean shouldBurnInDay(); -+ -+ /** -+ * Set if this phantom should burn in the sunlight -+ * -+ * @param shouldBurnInDay True to burn in sunlight -+ */ -+ public void setShouldBurnInDay(boolean shouldBurnInDay); - // Paper end - } diff --git a/patches/api/Add-additional-open-container-api-to-HumanEntity.patch b/patches/api/Add-additional-open-container-api-to-HumanEntity.patch deleted file mode 100644 index 62cd8f5b81..0000000000 --- a/patches/api/Add-additional-open-container-api-to-HumanEntity.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Wed, 26 Aug 2020 02:11:58 -0400 -Subject: [PATCH] Add additional open container api to HumanEntity - - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - @Nullable - public InventoryView openMerchant(@NotNull Merchant merchant, boolean force); - -+ // Paper start - Add additional containers -+ /** -+ * Opens an empty anvil inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no anvil block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openAnvil(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty cartography table inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no cartography table block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openCartographyTable(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty grindstone inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no grindstone block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openGrindstone(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty loom inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no loom block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openLoom(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty smithing table inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no smithing table block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openSmithingTable(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty stonecutter inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no stonecutter block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openStonecutter(@Nullable Location location, boolean force); -+ // Paper end -+ - /** - * Force-closes the currently open inventory view for this player, if any. - */ diff --git a/patches/api/Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch b/patches/api/Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch deleted file mode 100644 index d91b7640a5..0000000000 --- a/patches/api/Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch +++ /dev/null @@ -1,332 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Wed, 12 Sep 2018 18:53:35 +0300 -Subject: [PATCH] Add an API for CanPlaceOn and CanDestroy NBT values - - -diff --git a/src/main/java/com/destroystokyo/paper/Namespaced.java b/src/main/java/com/destroystokyo/paper/Namespaced.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/Namespaced.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper; -+ -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents a namespaced resource, see {@link org.bukkit.NamespacedKey} for single elements -+ * or {@link com.destroystokyo.paper.NamespacedTag} for a collection of elements -+ * -+ * Namespaces may only contain lowercase alphanumeric characters, periods, -+ * underscores, and hyphens. -+ *

-+ * Keys may only contain lowercase alphanumeric characters, periods, -+ * underscores, hyphens, and forward slashes. -+ *

-+ * You should not be implementing this interface yourself, use {@link org.bukkit.NamespacedKey} -+ * or {@link com.destroystokyo.paper.NamespacedTag} as needed instead. -+ */ -+@Deprecated(forRemoval = true, since = "1.20.6") -+public interface Namespaced { -+ /** -+ * Gets the namespace this resource is a part of -+ *

-+ * This is contractually obligated to only contain lowercase alphanumeric characters, -+ * periods, underscores, and hyphens. -+ * -+ * @return resource namespace -+ */ -+ @NotNull -+ String getNamespace(); -+ -+ /** -+ * Gets the key corresponding to this resource -+ *

-+ * This is contractually obligated to only contain lowercase alphanumeric characters, -+ * periods, underscores, hyphens, and forward slashes. -+ * -+ * @return resource key -+ */ -+ @NotNull -+ String getKey(); -+} -diff --git a/src/main/java/com/destroystokyo/paper/NamespacedTag.java b/src/main/java/com/destroystokyo/paper/NamespacedTag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/NamespacedTag.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper; -+ -+import com.google.common.base.Preconditions; -+import java.util.Locale; -+import java.util.UUID; -+import java.util.regex.Pattern; -+import org.bukkit.plugin.Plugin; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents a String based key pertaining to a tagged entry. Consists of two components - a namespace -+ * and a key. -+ *

-+ * Namespaces may only contain lowercase alphanumeric characters, periods, -+ * underscores, and hyphens. -+ *

-+ * Keys may only contain lowercase alphanumeric characters, periods, -+ * underscores, hyphens, and forward slashes. -+ * -+ */ -+// Paper - entire class, based on org.bukkit.NamespacedKey -+@Deprecated(forRemoval = true, since = "1.20.6") -+public final class NamespacedTag implements com.destroystokyo.paper.Namespaced { -+ -+ /** -+ * The namespace representing all inbuilt keys. -+ */ -+ public static final String MINECRAFT = "minecraft"; -+ /** -+ * The namespace representing all keys generated by Bukkit for backwards -+ * compatibility measures. -+ */ -+ public static final String BUKKIT = "bukkit"; -+ // -+ private static final Pattern VALID_NAMESPACE = Pattern.compile("[a-z0-9._-]+"); -+ private static final Pattern VALID_KEY = Pattern.compile("[a-z0-9/._-]+"); -+ // -+ private final String namespace; -+ private final String key; -+ -+ /** -+ * Create a key in a specific namespace. -+ * -+ * @param namespace String representing a grouping of keys -+ * @param key Name for this specific key -+ * @deprecated should never be used by plugins, for internal use only!! -+ */ -+ @Deprecated -+ public NamespacedTag(@NotNull String namespace, @NotNull String key) { -+ Preconditions.checkArgument(namespace != null && VALID_NAMESPACE.matcher(namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace); -+ Preconditions.checkArgument(key != null && VALID_KEY.matcher(key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", key); -+ -+ this.namespace = namespace; -+ this.key = key; -+ -+ String string = toString(); -+ Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters", string); -+ } -+ -+ /** -+ * Create a key in the plugin's namespace. -+ *

-+ * Namespaces may only contain lowercase alphanumeric characters, periods, -+ * underscores, and hyphens. -+ *

-+ * Keys may only contain lowercase alphanumeric characters, periods, -+ * underscores, hyphens, and forward slashes. -+ * -+ * @param plugin the plugin to use for the namespace -+ * @param key the key to create -+ */ -+ public NamespacedTag(@NotNull Plugin plugin, @NotNull String key) { -+ Preconditions.checkArgument(plugin != null, "Plugin cannot be null"); -+ Preconditions.checkArgument(key != null, "Key cannot be null"); -+ -+ this.namespace = plugin.getName().toLowerCase(Locale.ROOT); -+ this.key = key.toLowerCase().toLowerCase(Locale.ROOT); -+ -+ // Check validity after normalization -+ Preconditions.checkArgument(VALID_NAMESPACE.matcher(this.namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace); -+ Preconditions.checkArgument(VALID_KEY.matcher(this.key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", this.key); -+ -+ String string = toString(); -+ Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters (%s)", string); -+ } -+ -+ @NotNull -+ public String getNamespace() { -+ return namespace; -+ } -+ -+ @NotNull -+ public String getKey() { -+ return key; -+ } -+ -+ @Override -+ public int hashCode() { -+ int hash = 7; -+ hash = 47 * hash + this.namespace.hashCode(); -+ hash = 47 * hash + this.key.hashCode(); -+ return hash; -+ } -+ -+ @Override -+ public boolean equals(Object obj) { -+ if (obj == null) { -+ return false; -+ } -+ if (getClass() != obj.getClass()) { -+ return false; -+ } -+ final NamespacedTag other = (NamespacedTag) obj; -+ return this.namespace.equals(other.namespace) && this.key.equals(other.key); -+ } -+ -+ @Override -+ public String toString() { -+ return "#" + this.namespace + ":" + this.key; -+ } -+ -+ /** -+ * Return a new random key in the {@link #BUKKIT} namespace. -+ * -+ * @return new key -+ * @deprecated should never be used by plugins, for internal use only!! -+ */ -+ @Deprecated -+ public static NamespacedTag randomKey() { -+ return new NamespacedTag(BUKKIT, UUID.randomUUID().toString()); -+ } -+ -+ /** -+ * Get a key in the Minecraft namespace. -+ * -+ * @param key the key to use -+ * @return new key in the Minecraft namespace -+ */ -+ @NotNull -+ public static NamespacedTag minecraft(@NotNull String key) { -+ return new NamespacedTag(MINECRAFT, key); -+ } -+} -diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/NamespacedKey.java -+++ b/src/main/java/org/bukkit/NamespacedKey.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * underscores, hyphens, and forward slashes. - * - */ --public final class NamespacedKey implements net.kyori.adventure.key.Key { // Paper - implement Key -+public final class NamespacedKey implements net.kyori.adventure.key.Key, com.destroystokyo.paper.Namespaced { // Paper - implement Key and Namespaced - - /** - * The namespace representing all inbuilt keys. -@@ -0,0 +0,0 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap - } - - @NotNull -+ @Override // Paper - public String getNamespace() { - return namespace; - } - - @NotNull -+ @Override // Paper - public String getKey() { - return key; - } -diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste - @SuppressWarnings("javadoc") - @NotNull - ItemMeta clone(); -+ -+ // Paper start - Add an API for can-place-on/can-break adventure mode predicates -+ /** -+ * Gets set of materials what given item can destroy in {@link org.bukkit.GameMode#ADVENTURE} -+ * -+ * @return Set of materials -+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates. -+ */ -+ @Deprecated(forRemoval = true, since = "1.14") -+ Set getCanDestroy(); -+ -+ /** -+ * Sets set of materials what given item can destroy in {@link org.bukkit.GameMode#ADVENTURE} -+ * -+ * @param canDestroy Set of materials -+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates. -+ */ -+ @Deprecated(forRemoval = true, since = "1.14") -+ void setCanDestroy(Set canDestroy); -+ -+ /** -+ * Gets set of materials where given item can be placed on in {@link org.bukkit.GameMode#ADVENTURE} -+ * -+ * @return Set of materials -+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates. -+ */ -+ @Deprecated(forRemoval = true, since = "1.14") -+ Set getCanPlaceOn(); -+ -+ /** -+ * Sets set of materials where given item can be placed on in {@link org.bukkit.GameMode#ADVENTURE} -+ * -+ * @param canPlaceOn Set of materials -+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates. -+ */ -+ @Deprecated(forRemoval = true, since = "1.14") -+ void setCanPlaceOn(Set canPlaceOn); -+ -+ /** -+ * Gets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE} -+ * -+ * @return Set of {@link com.destroystokyo.paper.Namespaced} -+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates. -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ @NotNull -+ Set getDestroyableKeys(); -+ -+ /** -+ * Sets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE} -+ * -+ * @param canDestroy Collection of {@link com.destroystokyo.paper.Namespaced} -+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates. -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ void setDestroyableKeys(@NotNull Collection canDestroy); -+ -+ /** -+ * Gets the collection of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE} -+ * -+ * @return Set of {@link com.destroystokyo.paper.Namespaced} -+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates. -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ Set getPlaceableKeys(); -+ -+ /** -+ * Sets the set of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE} -+ * -+ * @param canPlaceOn Collection of {@link com.destroystokyo.paper.Namespaced} -+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates. -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ void setPlaceableKeys(@NotNull Collection canPlaceOn); -+ -+ /** -+ * Checks for the existence of any keys that the item can be placed on -+ * -+ * @return true if this item has placeable keys -+ * @deprecated this API is unsupported and will be replaced -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ boolean hasPlaceableKeys(); -+ -+ /** -+ * Checks for the existence of any keys that the item can destroy -+ * -+ * @return true if this item has destroyable keys -+ * @deprecated this API is unsupported and will be replaced -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ boolean hasDestroyableKeys(); -+ // Paper end - Add an API for can-place-on/can-break adventure mode predicates - } diff --git a/patches/api/Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/api/Add-and-implement-PlayerRecipeBookClickEvent.patch deleted file mode 100644 index d6e2156c95..0000000000 --- a/patches/api/Add-and-implement-PlayerRecipeBookClickEvent.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: LordKorea -Date: Mon, 11 May 2020 22:38:10 -0400 -Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.NamespacedKey; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a player clicks a recipe in the recipe book -+ */ -+@NullMarked -+public class PlayerRecipeBookClickEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private NamespacedKey recipe; -+ private boolean makeAll; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerRecipeBookClickEvent(final Player player, final NamespacedKey recipe, final boolean makeAll) { -+ super(player); -+ this.recipe = recipe; -+ this.makeAll = makeAll; -+ } -+ -+ /** -+ * Gets the namespaced key of the recipe that was clicked by the player -+ * -+ * @return The namespaced key of the recipe -+ */ -+ public NamespacedKey getRecipe() { -+ return this.recipe; -+ } -+ -+ /** -+ * Changes what recipe is requested. This sets the requested recipe to the recipe with the given key -+ * -+ * @param recipe The key of the recipe that should be requested -+ */ -+ public void setRecipe(final NamespacedKey recipe) { -+ this.recipe = recipe; -+ } -+ -+ /** -+ * Gets a boolean which indicates whether the player requested to make the maximum amount of results. This is -+ * {@code true} if shift is pressed while the recipe is clicked in the recipe book -+ * -+ * @return {@code true} if shift is pressed while the recipe is clicked -+ */ -+ public boolean isMakeAll() { -+ return this.makeAll; -+ } -+ -+ /** -+ * Sets whether the maximum amount of results should be made. If this is {@code true}, the request is handled as if -+ * the player had pressed shift while clicking on the recipe -+ * -+ * @param makeAll {@code true} if the request should attempt to make the maximum amount of results -+ */ -+ public void setMakeAll(final boolean makeAll) { -+ this.makeAll = makeAll; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - - /** - * Called when a player clicks a recipe in the recipe book. -+ * @deprecated use {@link com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent} - */ -+@Deprecated(forRemoval = true) // Paper -+@org.bukkit.Warning(false) // Paper - public class PlayerRecipeBookClickEvent extends PlayerEvent { - - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/Add-api-for-spawn-egg-texture-colors.patch b/patches/api/Add-api-for-spawn-egg-texture-colors.patch deleted file mode 100644 index 54659d3930..0000000000 --- a/patches/api/Add-api-for-spawn-egg-texture-colors.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Luis -Date: Thu, 11 Jan 2024 19:58:17 +0100 -Subject: [PATCH] Add api for spawn egg texture colors - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ public interface UnsafeValues { - // Paper end - namespaced key biome methods - - String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); // Paper - fix custom stats criteria creation -+ -+ // Paper start - spawn egg color visibility -+ /** -+ * Obtains the underlying color informating for a spawn egg of a given -+ * entity type, or null if the entity passed does not have a spawn egg. -+ * Spawn eggs have two colors - the background layer (0), and the -+ * foreground layer (1) -+ * @param entityType The entity type to get the color for -+ * @param layer The texture layer to get a color for -+ * @return The color of the layer for the entity's spawn egg -+ */ -+ @Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); -+ // Paper end - spawn egg color visibility - } diff --git a/patches/api/Add-basic-Datapack-API.patch b/patches/api/Add-basic-Datapack-API.patch deleted file mode 100644 index 644cf10d9d..0000000000 --- a/patches/api/Add-basic-Datapack-API.patch +++ /dev/null @@ -1,318 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Connor Linfoot -Date: Sun, 16 May 2021 15:07:34 +0100 -Subject: [PATCH] Add basic Datapack API - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/io/papermc/paper/datapack/Datapack.java b/src/main/java/io/papermc/paper/datapack/Datapack.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datapack/Datapack.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.datapack; -+ -+import java.util.Set; -+import net.kyori.adventure.text.Component; -+import org.bukkit.FeatureFlag; -+import org.jetbrains.annotations.Contract; -+import org.jetbrains.annotations.Unmodifiable; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * This is a snapshot of a datapack on the server. It -+ * won't be updated as datapacks are updated. -+ */ -+@NullMarked -+public interface Datapack { -+ -+ /** -+ * Gets the name/id of this datapack. -+ * -+ * @return the name of the pack -+ */ -+ @Contract(pure = true) -+ String getName(); -+ -+ /** -+ * Gets the title component of this datapack. -+ * -+ * @return the title -+ */ -+ Component getTitle(); -+ -+ /** -+ * Gets the description component of this datapack. -+ * -+ * @return the description -+ */ -+ Component getDescription(); -+ -+ /** -+ * Gets if this datapack is required to be enabled. -+ * -+ * @return true if the pack is required -+ */ -+ boolean isRequired(); -+ -+ /** -+ * Gets the compatibility status of this pack. -+ * -+ * @return the compatibility of the pack -+ */ -+ Compatibility getCompatibility(); -+ -+ /** -+ * Gets the set of required features for this datapack. -+ * -+ * @return the set of required features -+ */ -+ @Unmodifiable Set getRequiredFeatures(); -+ -+ /** -+ * Gets the enabled state of this pack. -+ * -+ * @return whether the pack is currently enabled -+ */ -+ boolean isEnabled(); -+ -+ /** -+ * Changes the enabled state of this pack. Will -+ * cause a reload of resources ({@code /minecraft:reload}) if -+ * any change happens. -+ * -+ * @param enabled true to enable, false to disable -+ * @apiNote This method may be deprecated in the future as setters on a "snapshot" type are undesirable. -+ */ -+ void setEnabled(boolean enabled); -+ -+ /** -+ * Gets the source for this datapack. -+ * -+ * @return the pack source -+ */ -+ DatapackSource getSource(); -+ -+ /** -+ * Computes the component vanilla Minecraft uses -+ * to display this datapack. Includes the {@link #getSource()}, -+ * {@link #getDescription()}, {@link #getName()}, and the enabled state. -+ * -+ * @return a new component -+ */ -+ @Contract(pure = true, value = "-> new") -+ Component computeDisplayName(); -+ -+ enum Compatibility { -+ TOO_OLD, -+ TOO_NEW, -+ COMPATIBLE, -+ } -+} -diff --git a/src/main/java/io/papermc/paper/datapack/DatapackManager.java b/src/main/java/io/papermc/paper/datapack/DatapackManager.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datapack/DatapackManager.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.datapack; -+ -+import java.util.Collection; -+import org.jetbrains.annotations.Unmodifiable; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+@NullMarked -+public interface DatapackManager { -+ -+ /** -+ * Triggers a refresh of the available and selected datapacks. This -+ * can find new datapacks, remove old ones, and update the metadata for -+ * existing datapacks. Some of these changes will only take effect -+ * after the next {@link org.bukkit.Server#reloadData()} or {@code /minecraft:reload}. -+ */ -+ void refreshPacks(); -+ -+ /** -+ * Gets a datapack by name. May require calling {@link #refreshPacks()} before -+ * to get the latest pack information. -+ * -+ * @param name the name/id of the datapack -+ * @return the datapack, or null if not found -+ */ -+ @Nullable Datapack getPack(String name); -+ -+ /** -+ * Gets the available datapacks. May require calling {@link #refreshPacks()} before -+ * to get the latest pack information. -+ * -+ * @return all the packs known to the server -+ */ -+ @Unmodifiable Collection getPacks(); -+ -+ /** -+ * Gets the enabled datapacks. May require calling {@link #refreshPacks()} before -+ * to get the latest pack information. -+ * -+ * @return all the packs which are currently enabled -+ */ -+ @Unmodifiable Collection getEnabledPacks(); -+} -diff --git a/src/main/java/io/papermc/paper/datapack/DatapackSource.java b/src/main/java/io/papermc/paper/datapack/DatapackSource.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datapack/DatapackSource.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.datapack; -+ -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Source of a datapack. -+ */ -+@NullMarked -+public sealed interface DatapackSource permits DatapackSourceImpl { -+ -+ DatapackSource DEFAULT = create("default"); -+ DatapackSource BUILT_IN = create("built_in"); -+ DatapackSource FEATURE = create("feature"); -+ DatapackSource WORLD = create("world"); -+ DatapackSource SERVER = create("server"); -+ -+ private static DatapackSource create(final String name) { -+ return new DatapackSourceImpl(name); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/datapack/DatapackSourceImpl.java b/src/main/java/io/papermc/paper/datapack/DatapackSourceImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datapack/DatapackSourceImpl.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.datapack; -+ -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@ApiStatus.Internal -+@NullMarked -+record DatapackSourceImpl(String name) implements DatapackSource { -+ -+ @Override -+ public String toString() { -+ return this.name; -+ } -+} -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - /** - * Get the DataPack Manager. - * -+ * @deprecated use {@link #getDatapackManager()} - * @return the manager - */ - @NotNull -+ @Deprecated(forRemoval = true, since = "1.20") - public static DataPackManager getDataPackManager() { - return server.getDataPackManager(); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { - return server.getMobGoals(); - } -+ -+ /** -+ * @return the datapack manager -+ */ -+ @NotNull -+ public static io.papermc.paper.datapack.DatapackManager getDatapackManager() { -+ return server.getDatapackManager(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - * @param world the world to check - * @return true if this material can be used in this World. - */ -+ @Deprecated(forRemoval = true, since = "1.20") // Paper - public boolean isEnabledByFeature(@NotNull World world) { - if (isItem()) { - return Bukkit.getDataPackManager().isEnabledByFeature(asItemType(), world); -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - /** - * Get the DataPack Manager. - * -+ * @deprecated use {@link #getDatapackManager()} - * @return the manager - */ - @NotNull -+ @Deprecated(forRemoval = true, since = "1.20") // Paper - public DataPackManager getDataPackManager(); - - /** -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - @NotNull - com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); -+ -+ /** -+ * @return the datapack manager -+ */ -+ @NotNull -+ io.papermc.paper.datapack.DatapackManager getDatapackManager(); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/EntityType.java -+++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -0,0 +0,0 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans - * @param world the world to check - * @return true if this EntityType can be used to spawn an Entity for this World. - */ -+ @Deprecated(forRemoval = true, since = "1.20") // Paper - public boolean isEnabledByFeature(@NotNull World world) { - return Bukkit.getDataPackManager().isEnabledByFeature(this, world); - } -diff --git a/src/main/java/org/bukkit/packs/DataPack.java b/src/main/java/org/bukkit/packs/DataPack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/packs/DataPack.java -+++ b/src/main/java/org/bukkit/packs/DataPack.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - * Represents a data pack. - * - * @see Minecraft wiki -+ * @deprecated use {@link io.papermc.paper.datapack.Datapack} - */ -+@Deprecated(forRemoval = true, since = "1.20") // Paper - public interface DataPack extends Keyed { - - /** -diff --git a/src/main/java/org/bukkit/packs/DataPackManager.java b/src/main/java/org/bukkit/packs/DataPackManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/packs/DataPackManager.java -+++ b/src/main/java/org/bukkit/packs/DataPackManager.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - - /** - * Manager of data packs. -+ * @deprecated use {@link io.papermc.paper.datapack.DatapackManager} - */ -+@Deprecated(forRemoval = true, since = "1.20") // Paper - public interface DataPackManager { - - /** diff --git a/patches/api/Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/api/Add-cause-to-Weather-ThunderChangeEvents.patch deleted file mode 100644 index 2d811d4d70..0000000000 --- a/patches/api/Add-cause-to-Weather-ThunderChangeEvents.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 2 Dec 2020 18:25:31 -0800 -Subject: [PATCH] Add cause to Weather/ThunderChangeEvents - - -diff --git a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java -+++ b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java -@@ -0,0 +0,0 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean canceled; - private final boolean to; -+ // Paper start -+ private final Cause cause; - -+ public ThunderChangeEvent(@NotNull final World world, final boolean to, @NotNull final Cause cause) { -+ super(world); -+ this.to = to; -+ this.cause = cause; -+ } -+ -+ @Deprecated // Paper end - public ThunderChangeEvent(@NotNull final World world, final boolean to) { - super(world); - this.to = to; -+ this.cause = Cause.UNKNOWN; // Paper - } - - @Override -@@ -0,0 +0,0 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start -+ /** -+ * Gets the cause of the weather change. -+ * -+ * @return the weather change cause -+ */ -+ @NotNull -+ public Cause getCause() { -+ return this.cause; -+ } -+ -+ public enum Cause { -+ COMMAND, -+ NATURAL, -+ SLEEP, -+ PLUGIN, -+ UNKNOWN -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java -+++ b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java -@@ -0,0 +0,0 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean canceled; - private final boolean to; -+ // Paper start -+ private final Cause cause; - -+ public WeatherChangeEvent(@NotNull final World world, final boolean to, @NotNull Cause cause) { -+ super(world); -+ this.to = to; -+ this.cause = cause; -+ } -+ -+ @Deprecated // Paper end - public WeatherChangeEvent(@NotNull final World world, final boolean to) { - super(world); - this.to = to; -+ this.cause = Cause.UNKNOWN; // Paper - } - - @Override -@@ -0,0 +0,0 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start -+ /** -+ * Gets the cause of the weather change. -+ * -+ * @return the weather change cause -+ */ -+ @NotNull -+ public Cause getCause() { -+ return cause; -+ } -+ -+ public enum Cause { -+ COMMAND, -+ NATURAL, -+ SLEEP, -+ PLUGIN, -+ UNKNOWN -+ } -+ // Paper end - } diff --git a/patches/api/Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/api/Add-command-line-option-to-load-extra-plugin-jars-no.patch deleted file mode 100644 index b7f88bd3af..0000000000 --- a/patches/api/Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Tue, 18 May 2021 14:42:26 -0700 -Subject: [PATCH] Add command line option to load extra plugin jars not in the - plugins folder - -ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - return server; - } - -+ /** -+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded, -+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}. -+ * -+ *

Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this -+ * directory manually when determining the location in which to store their data and configuration files.

-+ * -+ * @return plugins directory -+ */ -+ @NotNull -+ public static File getPluginsFolder() { -+ return server.getPluginsFolder(); -+ } -+ - /** - * Attempts to set the {@link Server} singleton. - *

-diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - */ - public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper - -+ /** -+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded, -+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}. -+ * -+ *

Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this -+ * directory manually when determining the location in which to store their data and configuration files.

-+ * -+ * @return plugins directory -+ */ -+ @NotNull -+ File getPluginsFolder(); -+ - /** - * Used for all administrative messages, such as an operator using a - * command. -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager { - @Override - @NotNull - public Plugin[] loadPlugins(@NotNull File directory) { -+ // Paper start - extra jars -+ return this.loadPlugins(directory, java.util.Collections.emptyList()); -+ } -+ @NotNull -+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List extraPluginJars) { -+ // Paper end - if (true) { - List pluginList = new ArrayList<>(); - java.util.Collections.addAll(pluginList, this.paperPluginManager.loadPlugins(directory)); -+ for (File file : extraPluginJars) { -+ try { -+ pluginList.add(this.paperPluginManager.loadPlugin(file)); -+ } catch (Exception e) { -+ this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e); -+ } -+ } - return pluginList.toArray(new Plugin[0]); - } - Preconditions.checkArgument(directory != null, "Directory cannot be null"); -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader { - throw new InvalidPluginException(ex); - } - -- final File parentFile = file.getParentFile(); -+ final File parentFile = this.server.getPluginsFolder(); // Paper - final File dataFolder = new File(parentFile, description.getName()); - @SuppressWarnings("deprecation") - final File oldDataFolder = new File(parentFile, description.getRawName()); diff --git a/patches/api/Add-command-to-reload-permissions.yml-and-require-co.patch b/patches/api/Add-command-to-reload-permissions.yml-and-require-co.patch deleted file mode 100644 index 7addea4a6c..0000000000 --- a/patches/api/Add-command-to-reload-permissions.yml-and-require-co.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William -Date: Fri, 18 Mar 2016 03:28:07 -0400 -Subject: [PATCH] Add command to reload permissions.yml and require confirm to - reload - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - public static org.bukkit.command.CommandMap getCommandMap() { - return server.getCommandMap(); - } -+ -+ /** -+ * Reload the Permissions in permissions.yml -+ */ -+ public static void reloadPermissions() { -+ server.reloadPermissions(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - Spigot spigot(); - // Spigot end -+ -+ void reloadPermissions(); // Paper - } -diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java -@@ -0,0 +0,0 @@ public class ReloadCommand extends BukkitCommand { - public ReloadCommand(@NotNull String name) { - super(name); - this.description = "Reloads the server configuration and plugins"; -- this.usageMessage = "/reload"; -+ this.usageMessage = "/reload [permissions]"; // Paper - this.setPermission("bukkit.command.reload"); - this.setAliases(Arrays.asList("rl")); - } - - @Override -- public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { -+ public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { // Paper - if (!testPermission(sender)) return true; - -+ // Paper start - Reload permissions.yml & require confirm -+ boolean confirmed = System.getProperty("LetMeReload") != null; -+ if (args.length == 1) { -+ if (args[0].equalsIgnoreCase("permissions")) { -+ Bukkit.getServer().reloadPermissions(); -+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Permissions successfully reloaded.", net.kyori.adventure.text.format.NamedTextColor.GREEN)); -+ return true; -+ } else if ("confirm".equalsIgnoreCase(args[0])) { -+ confirmed = true; -+ } else { -+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Usage: " + usageMessage, net.kyori.adventure.text.format.NamedTextColor.RED)); -+ return true; -+ } -+ } -+ if (!confirmed) { -+ Command.broadcastCommandMessage(sender, net.kyori.adventure.text.Component.text("Are you sure you wish to reload your server? Doing so may cause bugs and memory leaks. It is recommended to restart instead of using /reload. To confirm, please type ", net.kyori.adventure.text.format.NamedTextColor.RED).append(net.kyori.adventure.text.Component.text("/reload confirm", net.kyori.adventure.text.format.NamedTextColor.YELLOW))); -+ return true; -+ } -+ // Paper end -+ - Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues when using some plugins."); - Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server."); - Bukkit.reload(); -@@ -0,0 +0,0 @@ public class ReloadCommand extends BukkitCommand { - @NotNull - @Override - public List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { -- return Collections.emptyList(); -+ return java.util.Collections.singletonList("permissions"); // Paper - } - } diff --git a/patches/api/Add-configuration-option-to-prevent-player-names-fro.patch b/patches/api/Add-configuration-option-to-prevent-player-names-fro.patch deleted file mode 100644 index 65995b5c52..0000000000 --- a/patches/api/Add-configuration-option-to-prevent-player-names-fro.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Fri, 9 Jun 2017 07:24:24 -0700 -Subject: [PATCH] Add configuration option to prevent player names from being - suggested - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - public static boolean reloadCommandAliases() { - return server.reloadCommandAliases(); - } -+ -+ /** -+ * Checks if player names should be suggested when a command returns {@code null} as -+ * their tab completion result. -+ * -+ * @return true if player names should be suggested -+ */ -+ public static boolean suggestPlayerNamesWhenNullTabCompletions() { -+ return server.suggestPlayerNamesWhenNullTabCompletions(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - void reloadPermissions(); // Paper - - boolean reloadCommandAliases(); // Paper -+ -+ // Paper start - allow preventing player name suggestions by default -+ /** -+ * Checks if player names should be suggested when a command returns {@code null} as -+ * their tab completion result. -+ * -+ * @return true if player names should be suggested -+ */ -+ boolean suggestPlayerNamesWhenNullTabCompletions(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/Command.java -+++ b/src/main/java/org/bukkit/command/Command.java -@@ -0,0 +0,0 @@ public abstract class Command { - Preconditions.checkArgument(args != null, "Arguments cannot be null"); - Preconditions.checkArgument(alias != null, "Alias cannot be null"); - -- if (args.length == 0) { -+ if (args.length == 0 || !sender.getServer().suggestPlayerNamesWhenNullTabCompletions()) { // Paper - allow preventing player name suggestions by default) { - return ImmutableList.of(); - } - diff --git a/patches/api/Add-critical-damage-API.patch b/patches/api/Add-critical-damage-API.patch deleted file mode 100644 index 9d55a43b31..0000000000 --- a/patches/api/Add-critical-damage-API.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dodison -Date: Mon, 26 Jul 2021 17:35:20 +0200 -Subject: [PATCH] Add critical damage API - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -@@ -0,0 +0,0 @@ import java.util.Map; - import org.bukkit.damage.DamageSource; - import org.bukkit.damage.DamageType; - import org.bukkit.entity.Entity; -+import org.jetbrains.annotations.ApiStatus; - import org.jetbrains.annotations.NotNull; - - /** -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - */ - public class EntityDamageByEntityEvent extends EntityDamageEvent { - private final Entity damager; -+ private final boolean critical; // Paper - - @Deprecated(since = "1.20.4", forRemoval = true) - public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) { - this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).withCausingEntity(damager).withDirectEntity(damager).build(), damage); - } - -+ @Deprecated - public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage) { - super(damagee, cause, damageSource, damage); - this.damager = damager; -+ this.critical = false; // Paper - add critical damage API - } - - @Deprecated(since = "1.20.4", forRemoval = true) -@@ -0,0 +0,0 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent { - this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).withCausingEntity(damager).withDirectEntity(damager).build(), modifiers, modifierFunctions); - } - -+ @Deprecated - public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions) { - super(damagee, cause, damageSource, modifiers, modifierFunctions); - this.damager = damager; -+ // Paper start -+ this.critical = false; - } - -+ @ApiStatus.Internal -+ public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions, boolean critical) { -+ super(damagee, cause, damageSource, modifiers, modifierFunctions); -+ this.damager = damager; -+ this.critical = critical; -+ } -+ -+ /** -+ * Shows this damage instance was critical. -+ * The damage instance can be critical if the attacking player met the respective conditions. -+ * Furthermore, arrows may also cause a critical damage event if the arrow {@link org.bukkit.entity.AbstractArrow#isCritical()}. -+ * -+ * @return if the hit was critical. -+ * @see https://minecraft.wiki/wiki/Damage#Critical_hit -+ */ -+ public boolean isCritical() { -+ return this.critical; -+ } -+ // Paper end -+ - /** - * Returns the entity that damaged the defender. - * diff --git a/patches/api/Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/api/Add-dropLeash-variable-to-EntityUnleashEvent.patch deleted file mode 100644 index 67353e687c..0000000000 --- a/patches/api/Add-dropLeash-variable-to-EntityUnleashEvent.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Fri, 29 Jan 2021 15:13:04 +0100 -Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - public class EntityUnleashEvent extends EntityEvent { - private static final HandlerList handlers = new HandlerList(); - private final UnleashReason reason; -+ private boolean dropLeash; // Paper - -+ // Paper start - drop leash variable -+ @Deprecated - public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason) { -+ this(entity, reason, false); -+ } -+ -+ public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason, boolean dropLeash) { - super(entity); -+ // Paper end - this.reason = reason; -+ this.dropLeash = dropLeash; // Paper - } - - /** -@@ -0,0 +0,0 @@ public class EntityUnleashEvent extends EntityEvent { - return reason; - } - -+ // Paper start -+ /** -+ * Returns whether a leash item will be dropped. -+ * -+ * @return Whether the leash item will be dropped -+ */ -+ public boolean isDropLeash() { -+ return dropLeash; -+ } -+ -+ /** -+ * Sets whether a leash item should be dropped. -+ * -+ * @param dropLeash Whether the leash item should be dropped -+ */ -+ public void setDropLeash(boolean dropLeash) { -+ this.dropLeash = dropLeash; -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { -diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java -@@ -0,0 +0,0 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc - private final Player player; - private final EquipmentSlot hand; - -+ // Paper start - drop leash variable -+ @Deprecated - public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand) { -- super(entity, UnleashReason.PLAYER_UNLEASH); -+ this(entity, player, hand, false); -+ } -+ -+ public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand, boolean dropLeash) { -+ super(entity, UnleashReason.PLAYER_UNLEASH, dropLeash); -+ // Paper end - this.player = player; - this.hand = hand; - } diff --git a/patches/api/Add-drops-to-shear-events.patch b/patches/api/Add-drops-to-shear-events.patch deleted file mode 100644 index 12c8d8bef4..0000000000 --- a/patches/api/Add-drops-to-shear-events.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 18 May 2021 12:31:54 -0700 -Subject: [PATCH] Add drops to shear events - - -diff --git a/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java b/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java -@@ -0,0 +0,0 @@ public class BlockShearEntityEvent extends BlockEvent implements Cancellable { - private final Entity sheared; - private final ItemStack tool; - private boolean cancelled; -+ private java.util.List drops; // Paper - -- public BlockShearEntityEvent(@NotNull Block dispenser, @NotNull Entity sheared, @NotNull ItemStack tool) { -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper -+ public BlockShearEntityEvent(@NotNull Block dispenser, @NotNull Entity sheared, @NotNull ItemStack tool, final @NotNull java.util.List drops) { // Paper - custom shear drops - super(dispenser); - this.sheared = sheared; - this.tool = tool; -+ this.drops = drops; // Paper - } - - /** -@@ -0,0 +0,0 @@ public class BlockShearEntityEvent extends BlockEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start - custom shear drops -+ /** -+ * Get an immutable list of drops for this shearing. -+ * -+ * @return the shearing drops -+ * @see #setDrops(java.util.List) -+ */ -+ public java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getDrops() { -+ return java.util.Collections.unmodifiableList(this.drops); -+ } -+ -+ /** -+ * Sets the drops for the shearing. -+ * -+ * @param drops the shear drops -+ */ -+ public void setDrops(final java.util.@NotNull List drops) { -+ this.drops = java.util.List.copyOf(drops); -+ } -+ // Paper end - custom shear drops - } -diff --git a/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java -@@ -0,0 +0,0 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable { - private final Entity what; - private final ItemStack item; - private final EquipmentSlot hand; -+ private java.util.List drops; // Paper - custom shear drops - -- public PlayerShearEntityEvent(@NotNull Player who, @NotNull Entity what, @NotNull ItemStack item, @NotNull EquipmentSlot hand) { -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper -+ public PlayerShearEntityEvent(@NotNull Player who, @NotNull Entity what, @NotNull ItemStack item, @NotNull EquipmentSlot hand, final java.util.@NotNull List drops) { // Paper - custom shear drops - super(who); - this.what = what; - this.item = item; - this.hand = hand; -+ this.drops = drops; // Paper - custom shear drops - } - - @Deprecated(since = "1.15.2") - public PlayerShearEntityEvent(@NotNull final Player who, @NotNull final Entity what) { -- this(who, what, new ItemStack(Material.SHEARS), EquipmentSlot.HAND); -+ this(who, what, new ItemStack(Material.SHEARS), EquipmentSlot.HAND, java.util.Collections.emptyList()); // Paper - custom shear drops - } - - @Override -@@ -0,0 +0,0 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable { - return handlers; - } - -+ // Paper start - custom shear drops -+ /** -+ * Get an immutable list of drops for this shearing. -+ * -+ * @return the shearing drops -+ * @see #setDrops(java.util.List) -+ */ -+ public java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getDrops() { -+ return this.drops; -+ } -+ -+ /** -+ * Sets the drops for the shearing. -+ * -+ * @param drops the shear drops -+ */ -+ public void setDrops(final java.util.@NotNull List drops) { -+ this.drops = java.util.List.copyOf(drops); -+ } -+ // Paper end - custom shear drops - } diff --git a/patches/api/Add-enchantWithLevels-API.patch b/patches/api/Add-enchantWithLevels-API.patch deleted file mode 100644 index eead698243..0000000000 --- a/patches/api/Add-enchantWithLevels-API.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Wed, 16 Mar 2022 20:35:13 -0700 -Subject: [PATCH] Add enchantWithLevels API - -Deprecate upstream's newer and poorly implemented similar -API. - -diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemFactory.java -+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java -@@ -0,0 +0,0 @@ public interface ItemFactory { - * @param level the level to use, which is the level in the enchantment table - * @param allowTreasures allows treasure enchants, e.g. mending, if true. - * @return a new ItemStack containing the result of the Enchantment -+ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly -+ * designed and was originally broken. - */ - @NotNull -+ @Deprecated(since = "1.19.3") // Paper - ItemStack enchantItem(@NotNull final Entity entity, @NotNull final ItemStack item, final int level, final boolean allowTreasures); - - /** -@@ -0,0 +0,0 @@ public interface ItemFactory { - * @param level the level to use, which is the level in the enchantment table - * @param allowTreasures allow the treasure enchants, e.g. mending, if true. - * @return a new ItemStack containing the result of the Enchantment -+ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly -+ * designed and was originally broken. - */ - @NotNull -+ @Deprecated(since = "1.19.3") // Paper - ItemStack enchantItem(@NotNull final World world, @NotNull final ItemStack item, final int level, final boolean allowTreasures); - - /** -@@ -0,0 +0,0 @@ public interface ItemFactory { - * @param level the level to use, which is the level in the enchantment table - * @param allowTreasures allow treasure enchantments, e.g. mending, if true. - * @return a new ItemStack containing the result of the Enchantment -+ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly -+ * designed and was originally broken. - */ - @NotNull -+ @Deprecated(since = "1.19.3") // Paper - ItemStack enchantItem(@NotNull final ItemStack item, final int level, final boolean allowTreasures); - - // Paper start - Adventure -@@ -0,0 +0,0 @@ public interface ItemFactory { - @Deprecated - net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName); - // Paper end - bungee hover events -+ -+ // Paper start - enchantWithLevels API -+ /** -+ * Randomly enchants a copy of the provided {@link ItemStack} using the given experience levels. -+ * -+ *

If the provided ItemStack is already enchanted, the existing enchants will be removed before enchanting.

-+ * -+ *

Levels must be in range {@code [1, 30]}.

-+ * -+ * @param itemStack ItemStack to enchant -+ * @param levels levels to use for enchanting -+ * @param allowTreasure whether to allow enchantments where {@link org.bukkit.enchantments.Enchantment#isTreasure()} returns true -+ * @param random {@link java.util.Random} instance to use for enchanting -+ * @return enchanted copy of the provided ItemStack -+ * @throws IllegalArgumentException on bad arguments -+ */ -+ @NotNull ItemStack enchantWithLevels(@NotNull ItemStack itemStack, @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, boolean allowTreasure, @NotNull java.util.Random random); -+ // Paper end - enchantWithLevels API - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - } - - // Paper start -+ /** -+ * Randomly enchants a copy of this {@link ItemStack} using the given experience levels. -+ * -+ *

If this ItemStack is already enchanted, the existing enchants will be removed before enchanting.

-+ * -+ *

Levels must be in range {@code [1, 30]}.

-+ * -+ * @param levels levels to use for enchanting -+ * @param allowTreasure whether to allow enchantments where {@link org.bukkit.enchantments.Enchantment#isTreasure()} returns true -+ * @param random {@link java.util.Random} instance to use for enchanting -+ * @return enchanted copy of the provided ItemStack -+ * @throws IllegalArgumentException on bad arguments -+ */ -+ @NotNull -+ public ItemStack enchantWithLevels(final @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, final boolean allowTreasure, final @NotNull java.util.Random random) { -+ return Bukkit.getServer().getItemFactory().enchantWithLevels(this, levels, allowTreasure, random); -+ } -+ - @NotNull - @Override - public net.kyori.adventure.text.event.HoverEvent asHoverEvent(final @NotNull java.util.function.UnaryOperator op) { diff --git a/patches/api/Add-enchantWithLevels-with-enchantment-registry-set.patch b/patches/api/Add-enchantWithLevels-with-enchantment-registry-set.patch deleted file mode 100644 index db372e5f74..0000000000 --- a/patches/api/Add-enchantWithLevels-with-enchantment-registry-set.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: masmc05 -Date: Wed, 25 Sep 2024 16:26:04 +0300 -Subject: [PATCH] Add enchantWithLevels with enchantment registry set - - -diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemFactory.java -+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java -@@ -0,0 +0,0 @@ public interface ItemFactory { - */ - @NotNull ItemStack enchantWithLevels(@NotNull ItemStack itemStack, @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, boolean allowTreasure, @NotNull java.util.Random random); - // Paper end - enchantWithLevels API -+ // Paper start - enchantWithLevels with tag specification -+ /** -+ * Randomly enchants a copy of the provided {@link ItemStack} using the given experience levels. -+ * -+ *

If the provided ItemStack is already enchanted, the existing enchants will be removed before enchanting.

-+ * -+ *

Levels must be in range {@code [1, 30]}.

-+ * -+ * @param itemStack ItemStack to enchant -+ * @param levels levels to use for enchanting -+ * @param keySet registry key set defining the set of possible enchantments, e.g. {@link io.papermc.paper.registry.keys.tags.EnchantmentTagKeys#IN_ENCHANTING_TABLE}. -+ * @param random {@link java.util.Random} instance to use for enchanting -+ * @return enchanted copy of the provided ItemStack -+ * @throws IllegalArgumentException on bad arguments -+ */ -+ @NotNull ItemStack enchantWithLevels(@NotNull ItemStack itemStack, @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, @NotNull io.papermc.paper.registry.set.RegistryKeySet<@NotNull Enchantment> keySet, @NotNull java.util.Random random); -+ // Paper end - enchantWithLevels with tag specification - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - return Bukkit.getServer().getItemFactory().enchantWithLevels(this, levels, allowTreasure, random); - } - -+ /** -+ * Randomly enchants a copy of this {@link ItemStack} using the given experience levels. -+ * -+ *

If the provided ItemStack is already enchanted, the existing enchants will be removed before enchanting.

-+ * -+ *

Levels must be in range {@code [1, 30]}.

-+ * -+ * @param levels levels to use for enchanting -+ * @param keySet registry key set defining the set of possible enchantments, e.g. {@link io.papermc.paper.registry.keys.tags.EnchantmentTagKeys#IN_ENCHANTING_TABLE}. -+ * @param random {@link java.util.Random} instance to use for enchanting -+ * @return enchanted copy of the provided ItemStack -+ * @throws IllegalArgumentException on bad arguments -+ */ -+ public @NotNull ItemStack enchantWithLevels(final @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, final @NotNull io.papermc.paper.registry.set.RegistryKeySet<@NotNull Enchantment> keySet, final @NotNull java.util.Random random) { -+ return Bukkit.getItemFactory().enchantWithLevels(this, levels, keySet, random); -+ } -+ - @NotNull - @Override - public net.kyori.adventure.text.event.HoverEvent asHoverEvent(final @NotNull java.util.function.UnaryOperator op) { diff --git a/patches/api/Add-enchantment-seed-update-API.patch b/patches/api/Add-enchantment-seed-update-API.patch deleted file mode 100644 index 56a195a6fa..0000000000 --- a/patches/api/Add-enchantment-seed-update-API.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: okx-code -Date: Sat, 17 Aug 2024 13:02:56 +0100 -Subject: [PATCH] Add enchantment seed update API - - -diff --git a/src/main/java/org/bukkit/inventory/view/EnchantmentView.java b/src/main/java/org/bukkit/inventory/view/EnchantmentView.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/view/EnchantmentView.java -+++ b/src/main/java/org/bukkit/inventory/view/EnchantmentView.java -@@ -0,0 +0,0 @@ public interface EnchantmentView extends InventoryView { - */ - int getEnchantmentSeed(); - -+ // Paper start - add enchantment seed update API -+ /** -+ * Sets the random enchantment seed used in this view. Loses its effect once the view is closed. -+ * -+ * @param seed the random seed to use -+ */ -+ void setEnchantmentSeed(int seed); -+ // Paper end - add enchantment seed update API -+ - /** - * Gets the offers of this EnchantmentView - * diff --git a/patches/api/Add-entity-knockback-API.patch b/patches/api/Add-entity-knockback-API.patch deleted file mode 100644 index 93e72e93a7..0000000000 --- a/patches/api/Add-entity-knockback-API.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MelnCat -Date: Sun, 16 Oct 2022 12:10:00 -0700 -Subject: [PATCH] Add entity knockback API - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - } - } - // Paper end - swing hand API -+ -+ // Paper start - knockback API -+ /** -+ * Knocks back this entity from a specific direction with a specified strength. Mechanics such -+ * as knockback resistance will be factored in. -+ * -+ * The direction specified in this method will be the direction of the source of the knockback, -+ * so the entity will be pushed in the opposite direction. -+ * @param strength The strength of the knockback. Must be greater than 0. -+ * @param directionX The relative x position of the knockback source direction -+ * @param directionZ The relative z position of the knockback source direction -+ */ -+ void knockback(double strength, double directionX, double directionZ); -+ // Paper end - knockback API - } diff --git a/patches/api/Add-entity-knockback-events.patch b/patches/api/Add-entity-knockback-events.patch deleted file mode 100644 index 512c4ade60..0000000000 --- a/patches/api/Add-entity-knockback-events.patch +++ /dev/null @@ -1,296 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brokkonaut -Date: Mon, 18 Jun 2018 15:40:39 +0200 -Subject: [PATCH] Add entity knockback events - -- EntityKnockbackEvent -- EntityPushedByEntityAttackEvent -- EntityKnockbackByEntityEvent - -Co-authored-by: aerulion -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import io.papermc.paper.event.entity.EntityKnockbackEvent; -+import io.papermc.paper.event.entity.EntityPushedByEntityAttackEvent; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired when an Entity is knocked back by the hit of another Entity. The acceleration -+ * vector can be modified. If this event is cancelled, the entity is not knocked back. -+ */ -+@NullMarked -+public class EntityKnockbackByEntityEvent extends EntityPushedByEntityAttackEvent { -+ -+ private final float knockbackStrength; -+ -+ @ApiStatus.Internal -+ public EntityKnockbackByEntityEvent(final LivingEntity entity, final Entity hitBy, final EntityKnockbackEvent.Cause cause, final float knockbackStrength, final Vector knockback) { -+ super(entity, cause, hitBy, knockback); -+ this.knockbackStrength = knockbackStrength; -+ } -+ -+ /** -+ * @return the entity which was knocked back -+ */ -+ @Override -+ public LivingEntity getEntity() { -+ return (LivingEntity) super.getEntity(); -+ } -+ -+ /** -+ * @return the original knockback strength. -+ * @apiNote this value doesn't necessarily relate to {@link #getKnockback()}. -+ */ -+ @ApiStatus.Obsolete(since = "1.20.6") -+ public float getKnockbackStrength() { -+ return this.knockbackStrength; -+ } -+ -+ /** -+ * Gets the causing entity. Same as {@link #getPushedBy()}. -+ * -+ * @return the Entity which hit -+ */ -+ public Entity getHitBy() { -+ return super.getPushedBy(); -+ } -+ -+} -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityKnockbackEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityKnockbackEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityKnockbackEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when an entity receives knockback. -+ * @see EntityPushedByEntityAttackEvent -+ * @see com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent -+ */ -+@NullMarked -+public class EntityKnockbackEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Cause cause; -+ protected Vector knockback; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityKnockbackEvent(final Entity entity, final EntityKnockbackEvent.Cause cause, final Vector knockback) { -+ super(entity); -+ this.cause = cause; -+ this.knockback = knockback; -+ } -+ -+ /** -+ * Gets the cause of the knockback. -+ * -+ * @return the cause of the knockback -+ */ -+ public EntityKnockbackEvent.Cause getCause() { -+ return this.cause; -+ } -+ -+ /** -+ * Gets the knockback force that will be applied to the entity.
-+ * This value is read-only, changes made to it will not have any -+ * effect on the final knockback received. Use {@link #setKnockback(Vector)} -+ * to make changes. -+ * -+ * @return the knockback -+ */ -+ public Vector getKnockback() { -+ return this.knockback.clone(); -+ } -+ -+ /** -+ * Sets the knockback force that will be applied to the entity. -+ * -+ * @param knockback the knockback -+ */ -+ public void setKnockback(final Vector knockback) { -+ Preconditions.checkArgument(knockback != null, "knockback"); -+ this.knockback = knockback.clone(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * An enum to specify the cause of the knockback. -+ */ -+ public enum Cause { -+ -+ /** -+ * Knockback caused by non-entity damage. -+ */ -+ DAMAGE, -+ /** -+ * Knockback caused by an attacking entity. -+ */ -+ ENTITY_ATTACK, -+ /** -+ * Knockback caused by an explosion. -+ */ -+ EXPLOSION, -+ /** -+ * Knockback caused by the target blocking with a shield. -+ */ -+ SHIELD_BLOCK, -+ /** -+ * Knockback caused by a sweeping attack. -+ */ -+ SWEEP_ATTACK, -+ /** -+ * A generic push. -+ */ -+ PUSH, -+ /** -+ * Knockback with an unknown cause. -+ */ -+ UNKNOWN -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityPushedByEntityAttackEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired when an entity is pushed by another entity's attack. The acceleration vector can be -+ * modified. If this event is cancelled, the entity will not get pushed. -+ *

-+ * Note: Some entities might trigger this multiple times on the same entity -+ * as multiple acceleration calculations are done. -+ */ -+@NullMarked -+public class EntityPushedByEntityAttackEvent extends EntityKnockbackEvent implements Cancellable { -+ -+ private final Entity pushedBy; -+ -+ @ApiStatus.Internal -+ public EntityPushedByEntityAttackEvent(final Entity entity, final EntityKnockbackEvent.Cause cause, final Entity pushedBy, final Vector knockback) { -+ super(entity, cause, knockback); -+ this.pushedBy = pushedBy; -+ } -+ -+ /** -+ * Gets the entity which pushed the affected entity. -+ * -+ * @return the pushing entity -+ */ -+ public Entity getPushedBy() { -+ return this.pushedBy; -+ } -+ -+ /** -+ * Gets the acceleration that will be applied to the affected entity. -+ * -+ * @return the acceleration vector -+ * @deprecated use {@link #getKnockback()} -+ */ -+ @Deprecated(since = "1.20.6", forRemoval = true) -+ public Vector getAcceleration() { -+ return this.knockback; // TODO Clone in 1.21 to not instantly break what was technically already modifiable (call super.getKnockback()) -+ } -+ -+ /** -+ * Sets the relative acceleration that will be applied to the affected entity. -+ * -+ * @param acceleration the new acceleration vector -+ * @deprecated use {@link #setKnockback(Vector)} -+ */ -+ @Deprecated(since = "1.20.6", forRemoval = true) -+ public void setAcceleration(final Vector acceleration) { -+ super.setKnockback(acceleration); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return super.isCancelled(); -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ super.setCancelled(cancel); -+ } -+} -diff --git a/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - - /** - * Called when an entity receives knockback from another entity. -+ * -+ * @deprecated use {@link com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent} - */ -+@Deprecated(forRemoval = true) // Paper - public class EntityKnockbackByEntityEvent extends EntityKnockbackEvent { - - private final Entity source; -diff --git a/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java b/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - - /** - * Called when a living entity receives knockback. -+ * -+ * @deprecated use {@link io.papermc.paper.event.entity.EntityKnockbackEvent} - */ -+@Deprecated(forRemoval = true) // Paper - public class EntityKnockbackEvent extends EntityEvent implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/Add-entity-liquid-API.patch b/patches/api/Add-entity-liquid-API.patch deleted file mode 100644 index 6aa0146405..0000000000 --- a/patches/api/Add-entity-liquid-API.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Thu, 2 Jul 2020 18:11:33 -0500 -Subject: [PATCH] Add entity liquid API - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - @NotNull - org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason(); -+ -+ /** -+ * Check if entity is underwater -+ */ -+ boolean isUnderWater(); -+ -+ /** -+ * Check if entity is in rain -+ */ -+ boolean isInRain(); -+ -+ /** -+ * Check if entity is in bubble column -+ */ -+ boolean isInBubbleColumn(); -+ -+ /** -+ * Check if entity is in water or rain -+ */ -+ boolean isInWaterOrRain(); -+ -+ /** -+ * Check if entity is in water or bubble column -+ */ -+ boolean isInWaterOrBubbleColumn(); -+ -+ /** -+ * Check if entity is in water or rain or bubble column -+ */ -+ boolean isInWaterOrRainOrBubbleColumn(); -+ -+ /** -+ * Check if entity is in lava -+ */ -+ boolean isInLava(); - // Paper end - } diff --git a/patches/api/Add-even-more-Enchantment-API.patch b/patches/api/Add-even-more-Enchantment-API.patch deleted file mode 100644 index 90b448d058..0000000000 --- a/patches/api/Add-even-more-Enchantment-API.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 19 Jul 2024 08:43:01 -0700 -Subject: [PATCH] Add even more Enchantment API - -In a separate patch because it uses RegistryKeySet which -is after the previous "more enchant api" patch. - -diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/enchantments/Enchantment.java -+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve - public abstract java.util.Set getActiveSlotGroups(); - // Paper end - more Enchantment API - -+ // Paper start - even more Enchantment API -+ /** -+ * Provides the description of this enchantment entry as displayed to the client, e.g. "Sharpness" for the sharpness -+ * enchantment. -+ * -+ * @return the description component. -+ */ -+ public abstract net.kyori.adventure.text.@NotNull Component description(); -+ -+ /** -+ * Provides the registry key set referencing the items this enchantment is supported on. -+ * -+ * @return the registry key set. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ public abstract io.papermc.paper.registry.set.@NotNull RegistryKeySet getSupportedItems(); -+ -+ /** -+ * Provides the registry key set referencing the item types this enchantment can be applied to when -+ * enchanting in an enchantment table. -+ *

-+ * If this value is {@code null}, {@link #getSupportedItems()} will be sourced instead in the context of an enchantment table. -+ * Additionally, the tag {@link io.papermc.paper.registry.keys.tags.EnchantmentTagKeys#IN_ENCHANTING_TABLE} defines -+ * which enchantments can even show up in an enchantment table. -+ * -+ * @return the registry key set. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ public abstract io.papermc.paper.registry.set.@Nullable RegistryKeySet getPrimaryItems(); -+ -+ /** -+ * Provides the weight of this enchantment used by the weighted random when selecting enchantments. -+ * -+ * @return the weight value. -+ * @see https://minecraft.wiki/w/Enchanting for examplary weights. -+ */ -+ public abstract int getWeight(); -+ -+ /** -+ * Provides the registry key set of enchantments that this enchantment is exclusive with. -+ *

-+ * Exclusive enchantments prohibit the application of this enchantment to an item if they are already present on -+ * said item. -+ * -+ * @return a registry set of enchantments exclusive to this one. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ public abstract io.papermc.paper.registry.set.@NotNull RegistryKeySet getExclusiveWith(); -+ // Paper end - even more Enchantment API -+ - // Paper start - mark translation key as deprecated - /** - * @deprecated this method assumes that the enchantments description diff --git a/patches/api/Add-event-for-player-editing-sign.patch b/patches/api/Add-event-for-player-editing-sign.patch deleted file mode 100644 index a498062b6e..0000000000 --- a/patches/api/Add-event-for-player-editing-sign.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: by77er -Date: Sat, 10 Jun 2023 19:06:24 -0400 -Subject: [PATCH] Add event for player editing sign - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Sign; -+import org.bukkit.block.sign.Side; -+import org.bukkit.entity.HumanEntity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a player begins editing a sign's text. -+ *

-+ * Cancelling this event stops the sign editing menu from opening. -+ */ -+@NullMarked -+public class PlayerOpenSignEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Sign sign; -+ private final Side side; -+ private final Cause cause; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerOpenSignEvent(final Player editor, final Sign sign, final Side side, final Cause cause) { -+ super(editor); -+ this.sign = sign; -+ this.side = side; -+ this.cause = cause; -+ } -+ -+ /** -+ * Gets the sign that was clicked. -+ * -+ * @return {@link Sign} that was clicked -+ */ -+ public Sign getSign() { -+ return this.sign; -+ } -+ -+ /** -+ * Gets which side of the sign was clicked. -+ * -+ * @return {@link Side} that was clicked -+ * @see Sign#getSide(Side) -+ */ -+ public Side getSide() { -+ return this.side; -+ } -+ -+ /** -+ * The cause of this sign open. -+ * -+ * @return the cause -+ */ -+ public Cause getCause() { -+ return this.cause; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * The cause of the {@link PlayerOpenSignEvent}. -+ */ -+ public enum Cause { -+ /** -+ * The event was triggered by the placement of a sign. -+ */ -+ PLACE, -+ /** -+ * The event was triggered by an interaction with a sign. -+ */ -+ INTERACT, -+ /** -+ * The event was triggered via a plugin with {@link HumanEntity#openSign(Sign, Side)} -+ */ -+ PLUGIN, -+ /** -+ * Fallback cause for any unknown cause. -+ */ -+ UNKNOWN, -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java b/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - - /** - * This event is fired when a sign is opened by the player. -+ * @deprecated use {@link io.papermc.paper.event.player.PlayerOpenSignEvent} - */ -+@Deprecated(forRemoval = true) // Paper -+@org.bukkit.Warning(false) // Paper - public class PlayerSignOpenEvent extends PlayerEvent implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/Add-exception-reporting-event.patch b/patches/api/Add-exception-reporting-event.patch deleted file mode 100644 index 7e603c4576..0000000000 --- a/patches/api/Add-exception-reporting-event.patch +++ /dev/null @@ -1,581 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Mon, 29 Feb 2016 20:24:35 -0600 -Subject: [PATCH] Add exception reporting event - - -diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.server; -+ -+import com.destroystokyo.paper.exception.ServerException; -+import org.bukkit.Bukkit; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called whenever an exception is thrown in a recoverable section of the server. -+ */ -+@NullMarked -+public class ServerExceptionEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ServerException exception; -+ -+ @ApiStatus.Internal -+ public ServerExceptionEvent(final ServerException exception) { -+ super(!Bukkit.isPrimaryThread()); -+ this.exception = exception; -+ } -+ -+ /** -+ * Gets the wrapped exception that was thrown. -+ * -+ * @return Exception thrown -+ */ -+ public ServerException getException() { -+ return this.exception; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+import org.bukkit.command.Command; -+import org.bukkit.command.CommandSender; -+ -+import static com.google.common.base.Preconditions.checkNotNull; -+ -+/** -+ * Thrown when a command throws an exception -+ */ -+public class ServerCommandException extends ServerException { -+ -+ private final Command command; -+ private final CommandSender commandSender; -+ private final String[] arguments; -+ -+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) { -+ super(message, cause); -+ this.commandSender = checkNotNull(commandSender, "commandSender"); -+ this.arguments = checkNotNull(arguments, "arguments"); -+ this.command = checkNotNull(command, "command"); -+ } -+ -+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) { -+ super(cause); -+ this.commandSender = checkNotNull(commandSender, "commandSender"); -+ this.arguments = checkNotNull(arguments, "arguments"); -+ this.command = checkNotNull(command, "command"); -+ } -+ -+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) { -+ super(message, cause, enableSuppression, writableStackTrace); -+ this.commandSender = checkNotNull(commandSender, "commandSender"); -+ this.arguments = checkNotNull(arguments, "arguments"); -+ this.command = checkNotNull(command, "command"); -+ } -+ -+ /** -+ * Gets the command which threw the exception -+ * -+ * @return exception throwing command -+ */ -+ public Command getCommand() { -+ return command; -+ } -+ -+ /** -+ * Gets the command sender which executed the command request -+ * -+ * @return command sender of exception thrown command request -+ */ -+ public CommandSender getCommandSender() { -+ return commandSender; -+ } -+ -+ /** -+ * Gets the arguments which threw the exception for the command -+ * -+ * @return arguments of exception thrown command request -+ */ -+ public String[] getArguments() { -+ return arguments; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+import org.bukkit.event.Event; -+import org.bukkit.event.Listener; -+import org.bukkit.plugin.Plugin; -+ -+import static com.google.common.base.Preconditions.*; -+ -+/** -+ * Exception thrown when a server event listener throws an exception -+ */ -+public class ServerEventException extends ServerPluginException { -+ -+ private final Listener listener; -+ private final Event event; -+ -+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) { -+ super(message, cause, responsiblePlugin); -+ this.listener = checkNotNull(listener, "listener"); -+ this.event = checkNotNull(event, "event"); -+ } -+ -+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) { -+ super(cause, responsiblePlugin); -+ this.listener = checkNotNull(listener, "listener"); -+ this.event = checkNotNull(event, "event"); -+ } -+ -+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) { -+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); -+ this.listener = checkNotNull(listener, "listener"); -+ this.event = checkNotNull(event, "event"); -+ } -+ -+ /** -+ * Gets the listener which threw the exception -+ * -+ * @return event listener -+ */ -+ public Listener getListener() { -+ return listener; -+ } -+ -+ /** -+ * Gets the event which caused the exception -+ * -+ * @return event -+ */ -+ public Event getEvent() { -+ return event; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+/** -+ * Wrapper exception for all exceptions that are thrown by the server. -+ */ -+public class ServerException extends Exception { -+ -+ public ServerException(String message) { -+ super(message); -+ } -+ -+ public ServerException(String message, Throwable cause) { -+ super(message, cause); -+ } -+ -+ public ServerException(Throwable cause) { -+ super(cause); -+ } -+ -+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { -+ super(message, cause, enableSuppression, writableStackTrace); -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+import java.util.logging.Level; -+import org.bukkit.Bukkit; -+import com.destroystokyo.paper.event.server.ServerExceptionEvent; -+ -+/** -+ * Thrown when the internal server throws a recoverable exception. -+ */ -+public class ServerInternalException extends ServerException { -+ -+ public ServerInternalException(String message) { -+ super(message); -+ } -+ -+ public ServerInternalException(String message, Throwable cause) { -+ super(message, cause); -+ } -+ -+ public ServerInternalException(Throwable cause) { -+ super(cause); -+ } -+ -+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { -+ super(message, cause, enableSuppression, writableStackTrace); -+ } -+ -+ public static void reportInternalException(Throwable cause) { -+ try { -+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause))); -+ ; -+ } catch (Throwable t) { -+ Bukkit.getLogger().log(Level.WARNING, "Exception posting ServerExceptionEvent", t); // Don't want to rethrow! -+ } -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+import org.bukkit.plugin.Plugin; -+ -+/** -+ * Thrown whenever there is an exception with any enabling or disabling of plugins. -+ */ -+public class ServerPluginEnableDisableException extends ServerPluginException { -+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) { -+ super(message, cause, responsiblePlugin); -+ } -+ -+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) { -+ super(cause, responsiblePlugin); -+ } -+ -+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) { -+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); -+ } -+} -\ No newline at end of file -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+import org.bukkit.plugin.Plugin; -+ -+import static com.google.common.base.Preconditions.checkNotNull; -+ -+/** -+ * Wrapper exception for all cases to which a plugin can be immediately blamed for -+ */ -+public class ServerPluginException extends ServerException { -+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) { -+ super(message, cause); -+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); -+ } -+ -+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) { -+ super(cause); -+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); -+ } -+ -+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) { -+ super(message, cause, enableSuppression, writableStackTrace); -+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); -+ } -+ -+ private final Plugin responsiblePlugin; -+ -+ /** -+ * Gets the plugin which is directly responsible for the exception being thrown -+ * -+ * @return plugin which is responsible for the exception throw -+ */ -+ public Plugin getResponsiblePlugin() { -+ return responsiblePlugin; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.plugin.Plugin; -+ -+import static com.google.common.base.Preconditions.*; -+ -+/** -+ * Thrown when an incoming plugin message channel throws an exception -+ */ -+public class ServerPluginMessageException extends ServerPluginException { -+ -+ private final Player player; -+ private final String channel; -+ private final byte[] data; -+ -+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) { -+ super(message, cause, responsiblePlugin); -+ this.player = checkNotNull(player, "player"); -+ this.channel = checkNotNull(channel, "channel"); -+ this.data = checkNotNull(data, "data"); -+ } -+ -+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) { -+ super(cause, responsiblePlugin); -+ this.player = checkNotNull(player, "player"); -+ this.channel = checkNotNull(channel, "channel"); -+ this.data = checkNotNull(data, "data"); -+ } -+ -+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) { -+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); -+ this.player = checkNotNull(player, "player"); -+ this.channel = checkNotNull(channel, "channel"); -+ this.data = checkNotNull(data, "data"); -+ } -+ -+ /** -+ * Gets the channel to which the error occurred from receiving data from -+ * -+ * @return exception channel -+ */ -+ public String getChannel() { -+ return channel; -+ } -+ -+ /** -+ * Gets the data to which the error occurred from -+ * -+ * @return exception data -+ */ -+ public byte[] getData() { -+ return data; -+ } -+ -+ /** -+ * Gets the player which the plugin message causing the exception originated from -+ * -+ * @return exception player -+ */ -+ public Player getPlayer() { -+ return player; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+import org.bukkit.scheduler.BukkitTask; -+ -+import static com.google.common.base.Preconditions.checkNotNull; -+ -+/** -+ * Thrown when a plugin's scheduler fails with an exception -+ */ -+public class ServerSchedulerException extends ServerPluginException { -+ -+ private final BukkitTask task; -+ -+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) { -+ super(message, cause, task.getOwner()); -+ this.task = checkNotNull(task, "task"); -+ } -+ -+ public ServerSchedulerException(Throwable cause, BukkitTask task) { -+ super(cause, task.getOwner()); -+ this.task = checkNotNull(task, "task"); -+ } -+ -+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) { -+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner()); -+ this.task = checkNotNull(task, "task"); -+ } -+ -+ /** -+ * Gets the task which threw the exception -+ * -+ * @return exception throwing task -+ */ -+ public BukkitTask getTask() { -+ return task; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.exception; -+ -+import org.bukkit.command.Command; -+import org.bukkit.command.CommandSender; -+ -+/** -+ * Called when a tab-complete request throws an exception -+ */ -+public class ServerTabCompleteException extends ServerCommandException { -+ -+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) { -+ super(message, cause, command, commandSender, arguments); -+ } -+ -+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) { -+ super(cause, command, commandSender, arguments); -+ } -+ -+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) { -+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments); -+ } -+} -diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/SimpleCommandMap.java -+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap { - target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); - } // target.timings.stopTiming(); // Spigot // Paper - } catch (CommandException ex) { -+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper - //target.timings.stopTiming(); // Spigot // Paper - throw ex; - } catch (Throwable ex) { - //target.timings.stopTiming(); // Spigot // Paper -- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); -+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target; -+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper -+ throw new CommandException(msg, ex); - } - - // return true as command was handled -@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap { - } catch (CommandException ex) { - throw ex; - } catch (Throwable ex) { -- throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex); -+ String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target; -+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerTabCompleteException(msg, ex, target, sender, args))); // Paper -+ throw new CommandException(msg, ex); - } - } - -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager { - try { - plugin.getPluginLoader().enablePlugin(plugin); - } catch (Throwable ex) { -- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); -+ handlePluginException("Error occurred (in the plugin loader) while enabling " -+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); - } - - HandlerList.bakeAll(); -@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager { - try { - plugin.getPluginLoader().disablePlugin(plugin); - } catch (Throwable ex) { -- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); -+ handlePluginException("Error occurred (in the plugin loader) while disabling " -+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper - } - - try { - server.getScheduler().cancelTasks(plugin); - } catch (Throwable ex) { -- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); -+ handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for " -+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper - } - - try { - server.getServicesManager().unregisterAll(plugin); - } catch (Throwable ex) { -- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); -+ handlePluginException("Error occurred (in the plugin loader) while unregistering services for " -+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper - } - - try { - HandlerList.unregisterAll(plugin); - } catch (Throwable ex) { -- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); -+ handlePluginException("Error occurred (in the plugin loader) while unregistering events for " -+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper - } - - try { - server.getMessenger().unregisterIncomingPluginChannel(plugin); - server.getMessenger().unregisterOutgoingPluginChannel(plugin); - } catch (Throwable ex) { -- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); -+ handlePluginException("Error occurred (in the plugin loader) while unregistering plugin channels for " -+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper - } - - try { -@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager { - } - } - -+ // Paper start -+ private void handlePluginException(String msg, Throwable ex, Plugin plugin) { -+ server.getLogger().log(Level.SEVERE, msg, ex); -+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin))); -+ } -+ // Paper end -+ - @Override - public void clearPlugins() { - if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper -@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager { - )); - } - } catch (Throwable ex) { -- server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(), ex); -+ // Paper start - error reporting -+ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(); -+ server.getLogger().log(Level.SEVERE, msg, ex); -+ if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop -+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event))); -+ } -+ // Paper end - } - } - } diff --git a/patches/api/Add-experience-points-API.patch b/patches/api/Add-experience-points-API.patch deleted file mode 100644 index eec8dbe92a..0000000000 --- a/patches/api/Add-experience-points-API.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lukas Planz -Date: Tue, 5 Sep 2023 20:33:52 +0200 -Subject: [PATCH] Add experience points API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @param exp New total experience points - */ - public void setTotalExperience(int exp); -+ // Paper start -+ /** -+ * Gets the players total amount of experience points he collected to reach the current level and level progress. -+ * -+ *

This method differs from {@link #getTotalExperience()} in that this method always returns an -+ * up-to-date value that reflects the players{@link #getLevel() level} and {@link #getExp() level progress}

-+ * -+ * @return Current total experience points -+ * @see #getLevel() -+ * @see #getExp() -+ * @see #setExperienceLevelAndProgress(int) -+ */ -+ @org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int calculateTotalExperiencePoints(); -+ -+ /** -+ * Updates the players level and level progress to that what would be reached when the total amount of experience -+ * had been collected. -+ * -+ *

This method differs from {@link #setTotalExperience(int)} in that this method actually updates the -+ * {@link #getLevel() level} and {@link #getExp() level progress} so that a subsequent call of -+ * {@link #calculateTotalExperiencePoints()} yields the same amount of points that have been set

-+ * -+ * @param totalExperience New total experience points -+ * @see #setLevel(int) -+ * @see #setExp(float) -+ * @see #calculateTotalExperiencePoints() -+ */ -+ void setExperienceLevelAndProgress(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int totalExperience); -+ -+ /** -+ * Gets the total amount of experience points that are needed to reach the next level from zero progress towards it. -+ * -+ *

Can be used with {@link #getExp()} to calculate the current points for the current level and alike

-+ * -+ * @return The required experience points -+ * @see #getExp() -+ */ -+ int getExperiencePointsNeededForNextLevel(); -+ // Paper end - - /** - * Send an experience change. diff --git a/patches/api/Add-extended-PaperServerListPingEvent.patch b/patches/api/Add-extended-PaperServerListPingEvent.patch deleted file mode 100644 index 3f3c93394b..0000000000 --- a/patches/api/Add-extended-PaperServerListPingEvent.patch +++ /dev/null @@ -1,565 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Minecrell -Date: Wed, 11 Oct 2017 15:55:38 +0200 -Subject: [PATCH] Add extended PaperServerListPingEvent - -Add a new event that extends the original ServerListPingEvent -and allows full control of the response sent to the client. - -diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.server; -+ -+import static java.util.Objects.requireNonNull; -+ -+import com.destroystokyo.paper.network.StatusClient; -+import com.destroystokyo.paper.profile.PlayerProfile; -+import com.destroystokyo.paper.profile.ProfileProperty; -+import com.google.common.base.Preconditions; -+import io.papermc.paper.util.TransformingRandomAccessList; -+import java.util.Collection; -+import java.util.Map; -+import java.util.Set; -+import java.util.concurrent.CompletableFuture; -+import org.bukkit.Bukkit; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.server.ServerListPingEvent; -+import org.bukkit.profile.PlayerTextures; -+import org.bukkit.util.CachedServerIcon; -+ -+import java.util.ArrayList; -+import java.util.Iterator; -+import java.util.List; -+import java.util.NoSuchElementException; -+import java.util.UUID; -+ -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Extended version of {@link ServerListPingEvent} that allows full control -+ * of the response sent to the client. -+ */ -+public class PaperServerListPingEvent extends ServerListPingEvent implements Cancellable { -+ -+ @NotNull private final StatusClient client; -+ -+ private int numPlayers; -+ private boolean hidePlayers; -+ @NotNull private final List listedPlayers = new ArrayList<>(); -+ @NotNull private final TransformingRandomAccessList playerSample = new TransformingRandomAccessList<>( -+ listedPlayers, -+ info -> new UncheckedPlayerProfile(info.name(), info.id()), -+ profile -> new ListedPlayerInfo(profile.getName(), profile.getId()) -+ ); -+ -+ @NotNull private String version; -+ private int protocolVersion; -+ -+ @Nullable private CachedServerIcon favicon; -+ -+ private boolean cancelled; -+ -+ private boolean originalPlayerCount = true; -+ private Object[] players; -+ -+ @Deprecated -+ @ApiStatus.Internal -+ public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull String motd, int numPlayers, int maxPlayers, -+ @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) { -+ super("", client.getAddress().getAddress(), motd, numPlayers, maxPlayers); -+ this.client = client; -+ this.numPlayers = numPlayers; -+ this.version = version; -+ this.protocolVersion = protocolVersion; -+ setServerIcon(favicon); -+ } -+ -+ @ApiStatus.Internal -+ public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull net.kyori.adventure.text.Component motd, int numPlayers, int maxPlayers, -+ @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) { -+ super("", client.getAddress().getAddress(), motd, numPlayers, maxPlayers); -+ this.client = client; -+ this.numPlayers = numPlayers; -+ this.version = version; -+ this.protocolVersion = protocolVersion; -+ setServerIcon(favicon); -+ } -+ -+ /** -+ * Returns the {@link StatusClient} pinging the server. -+ * -+ * @return The client -+ */ -+ @NotNull -+ public StatusClient getClient() { -+ return this.client; -+ } -+ -+ /** -+ * {@inheritDoc} -+ * -+ *

Returns {@code -1} if players are hidden using -+ * {@link #shouldHidePlayers()}.

-+ */ -+ @Override -+ public int getNumPlayers() { -+ if (this.hidePlayers) { -+ return -1; -+ } -+ -+ return this.numPlayers; -+ } -+ -+ /** -+ * Sets the number of players displayed in the server list. -+ *

-+ * Note that this won't have any effect if {@link #shouldHidePlayers()} -+ * is enabled. -+ * -+ * @param numPlayers The number of online players -+ */ -+ public void setNumPlayers(int numPlayers) { -+ if (this.numPlayers != numPlayers) { -+ this.numPlayers = numPlayers; -+ this.originalPlayerCount = false; -+ } -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * Returns {@code -1} if players are hidden using -+ * {@link #shouldHidePlayers()}. -+ */ -+ @Override -+ public int getMaxPlayers() { -+ if (this.hidePlayers) { -+ return -1; -+ } -+ -+ return super.getMaxPlayers(); -+ } -+ -+ /** -+ * Returns whether all player related information is hidden in the server -+ * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()} -+ * and {@link #getPlayerSample()} to be skipped in the response. -+ *

-+ * The Vanilla Minecraft client will display the player count as {@code ???} -+ * when this option is enabled. -+ * -+ * @return {@code true} if the player count is hidden -+ */ -+ public boolean shouldHidePlayers() { -+ return this.hidePlayers; -+ } -+ -+ /** -+ * Sets whether all player related information is hidden in the server -+ * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()} -+ * and {@link #getPlayerSample()} to be skipped in the response. -+ *

-+ * The Vanilla Minecraft client will display the player count as {@code ???} -+ * when this option is enabled. -+ * -+ * @param hidePlayers {@code true} if the player count should be hidden -+ */ -+ public void setHidePlayers(boolean hidePlayers) { -+ this.hidePlayers = hidePlayers; -+ } -+ -+ /** -+ * Returns a mutable list of {@link ListedPlayerInfo} that will be displayed -+ * as online players on the client. -+ *

-+ * The Vanilla Minecraft client will display them when hovering the -+ * player count with the mouse. -+ * -+ * @return The mutable player sample list -+ */ -+ @NotNull -+ public List getListedPlayers() { -+ return this.listedPlayers; -+ } -+ -+ /** -+ * Returns a mutable list of {@link PlayerProfile} that will be displayed -+ * as online players on the client. -+ *

-+ * The Vanilla Minecraft client will display them when hovering the -+ * player count with the mouse. -+ * -+ * @return The mutable player sample list -+ * @deprecated Use {@link #getListedPlayers()}, as this does not contain real player profiles -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ public List getPlayerSample() { -+ return this.playerSample; -+ } -+ -+ /** -+ * Returns the version that will be sent as server version on the client. -+ * -+ * @return The server version -+ */ -+ @NotNull -+ public String getVersion() { -+ return this.version; -+ } -+ -+ /** -+ * Sets the version that will be sent as server version to the client. -+ * -+ * @param version The server version -+ */ -+ public void setVersion(@NotNull String version) { -+ this.version = requireNonNull(version, "version"); -+ } -+ -+ /** -+ * Returns the protocol version that will be sent as the protocol version -+ * of the server to the client. -+ * -+ * @return The protocol version of the server, or {@code -1} if the server -+ * has not finished initialization yet -+ */ -+ public int getProtocolVersion() { -+ return this.protocolVersion; -+ } -+ -+ /** -+ * Sets the protocol version that will be sent as the protocol version -+ * of the server to the client. -+ * -+ * @param protocolVersion The protocol version of the server -+ */ -+ public void setProtocolVersion(int protocolVersion) { -+ this.protocolVersion = protocolVersion; -+ } -+ -+ /** -+ * Gets the server icon sent to the client. -+ * -+ * @return The icon to send to the client, or {@code null} for none -+ */ -+ @Nullable -+ public CachedServerIcon getServerIcon() { -+ return this.favicon; -+ } -+ -+ /** -+ * Sets the server icon sent to the client. -+ * -+ * @param icon The icon to send to the client, or {@code null} for none -+ */ -+ @Override -+ public void setServerIcon(@Nullable CachedServerIcon icon) { -+ if (icon != null && icon.isEmpty()) { -+ // Represent empty icons as null -+ icon = null; -+ } -+ -+ this.favicon = icon; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * Cancelling this event will cause the connection to be closed immediately, -+ * without sending a response to the client. -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * Cancelling this event will cause the connection to be closed immediately, -+ * without sending a response to the client. -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * Note: For compatibility reasons, this method will return all -+ * online players, not just the ones referenced in {@link #getPlayerSample()}. -+ * Removing a player will: -+ * -+ *

    -+ *
  • Decrement the online player count (if and only if) the player -+ * count wasn't changed by another plugin before.
  • -+ *
  • Remove all entries from {@link #getPlayerSample()} that refer to -+ * the removed player (based on their {@link UUID}).
  • -+ *
-+ * @deprecated the Iterable interface will be removed at some point -+ */ -+ @NotNull -+ @Override -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ public Iterator iterator() { -+ if (this.players == null) { -+ this.players = getOnlinePlayers(); -+ } -+ -+ return new PlayerIterator(); -+ } -+ -+ @NotNull -+ protected Object[] getOnlinePlayers() { -+ return Bukkit.getOnlinePlayers().toArray(); -+ } -+ -+ @NotNull -+ protected Player getBukkitPlayer(@NotNull Object player) { -+ return (Player) player; -+ } -+ -+ @ApiStatus.Internal -+ private final class PlayerIterator implements Iterator { -+ -+ private int next; -+ private int current; -+ @Nullable private Player player; -+ -+ @Override -+ public boolean hasNext() { -+ for (; this.next < players.length; this.next++) { -+ if (players[this.next] != null) { -+ return true; -+ } -+ } -+ -+ return false; -+ } -+ -+ @NotNull -+ @Override -+ public Player next() { -+ if (!hasNext()) { -+ this.player = null; -+ throw new NoSuchElementException(); -+ } -+ -+ this.current = this.next++; -+ return this.player = getBukkitPlayer(players[this.current]); -+ } -+ -+ @Override -+ public void remove() { -+ if (this.player == null) { -+ throw new IllegalStateException(); -+ } -+ -+ UUID uniqueId = this.player.getUniqueId(); -+ this.player = null; -+ -+ // Remove player from iterator -+ players[this.current] = null; -+ -+ // Remove player from sample -+ getPlayerSample().removeIf(p -> uniqueId.equals(p.getId())); -+ -+ // Decrement player count -+ if (originalPlayerCount) { -+ numPlayers--; -+ } -+ } -+ } -+ -+ /** -+ * Represents a player that will be displayed in the player sample of the server list. -+ * -+ * @param name name of the listed player -+ * @param id UUID of the listed player -+ */ -+ public record ListedPlayerInfo(@NotNull String name, @NotNull UUID id) { -+ } -+ -+ @ApiStatus.Internal -+ private static final class UncheckedPlayerProfile implements PlayerProfile { -+ private String name; -+ private UUID uuid; -+ -+ public UncheckedPlayerProfile(final @NotNull String name, final @NotNull UUID uuid) { -+ Preconditions.checkNotNull(name, "name cannot be null"); -+ Preconditions.checkNotNull(uuid, "uuid cannot be null"); -+ this.name = name; -+ this.uuid = uuid; -+ } -+ -+ @Override -+ public @Nullable UUID getUniqueId() { -+ return uuid; -+ } -+ -+ @Override -+ public @Nullable String getName() { -+ return name; -+ } -+ -+ @Override -+ public @NotNull String setName(@Nullable final String name) { -+ Preconditions.checkNotNull(name, "name cannot be null"); -+ return this.name = name; -+ } -+ -+ @Override -+ public @Nullable UUID getId() { -+ return uuid; -+ } -+ -+ @Override -+ public @Nullable UUID setId(@Nullable final UUID uuid) { -+ Preconditions.checkNotNull(uuid, "uuid cannot be null"); -+ return this.uuid = uuid; -+ } -+ -+ @Override -+ public @NotNull PlayerTextures getTextures() { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public void setTextures(@Nullable final PlayerTextures textures) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public @NotNull Set getProperties() { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public boolean hasProperty(@Nullable final String property) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public void setProperty(@NotNull final ProfileProperty property) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public void setProperties(@NotNull final Collection properties) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public boolean removeProperty(@Nullable final String property) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public void clearProperties() { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public boolean isComplete() { -+ return false; -+ } -+ -+ @Override -+ public boolean completeFromCache() { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public boolean completeFromCache(final boolean onlineMode) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public boolean completeFromCache(final boolean lookupUUID, final boolean onlineMode) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public boolean complete(final boolean textures) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public boolean complete(final boolean textures, final boolean onlineMode) { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public @NotNull CompletableFuture update() { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public org.bukkit.profile.@NotNull PlayerProfile clone() { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public @NotNull Map serialize() { -+ throw new UnsupportedOperationException(); -+ } -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/network/StatusClient.java b/src/main/java/com/destroystokyo/paper/network/StatusClient.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/network/StatusClient.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.network; -+ -+import com.destroystokyo.paper.event.server.PaperServerListPingEvent; -+ -+/** -+ * Represents a client requesting the current status from the server (e.g. from -+ * the server list). -+ * -+ * @see PaperServerListPingEvent -+ */ -+public interface StatusClient extends NetworkClient { -+ -+} -diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -@@ -0,0 +0,0 @@ public class ServerListPingEvent extends ServerEvent implements Iterable - * - * @throws UnsupportedOperationException if the caller of this event does - * not support removing players -+ * @deprecated the Iterable interface will be removed at some point - */ - @NotNull - @Override -+ @Deprecated(forRemoval = true, since = "1.20.6") - public Iterator iterator() throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } -diff --git a/src/main/java/org/bukkit/util/CachedServerIcon.java b/src/main/java/org/bukkit/util/CachedServerIcon.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/util/CachedServerIcon.java -+++ b/src/main/java/org/bukkit/util/CachedServerIcon.java -@@ -0,0 +0,0 @@ public interface CachedServerIcon { - @Nullable - public String getData(); // Paper - -+ // Paper start -+ default boolean isEmpty() { -+ return getData() == null; -+ } -+ // Paper end - } diff --git a/patches/api/Add-getChunkSnapshot-includeLightData-parameter.patch b/patches/api/Add-getChunkSnapshot-includeLightData-parameter.patch deleted file mode 100644 index 359a1041fc..0000000000 --- a/patches/api/Add-getChunkSnapshot-includeLightData-parameter.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Warrior <50800980+Warriorrrr@users.noreply.github.com> -Date: Sat, 10 Feb 2024 10:05:59 +0100 -Subject: [PATCH] Add getChunkSnapshot includeLightData parameter - - -diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Chunk.java -+++ b/src/main/java/org/bukkit/Chunk.java -@@ -0,0 +0,0 @@ public interface Chunk extends PersistentDataHolder { - @NotNull - ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain); - -+ // Paper start - Add getChunkSnapshot includeLightData parameter -+ /** -+ * Capture thread-safe read-only snapshot of chunk data -+ * -+ * @param includeMaxblocky if true, snapshot includes per-coordinate -+ * maximum Y values -+ * @param includeBiome if true, snapshot includes per-coordinate biome -+ * type -+ * @param includeBiomeTempRain if true, snapshot includes per-coordinate -+ * raw biome temperature and rainfall -+ * @param includeLightData Whether to include per-coordinate light emitted by blocks and sky light data -+ * @return ChunkSnapshot -+ */ -+ @NotNull -+ ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain, boolean includeLightData); -+ // Paper end - Add getChunkSnapshot includeLightData parameter -+ - /** - * Checks if entities in this chunk are loaded. - * diff --git a/patches/api/Add-getComputedBiome-API.patch b/patches/api/Add-getComputedBiome-API.patch deleted file mode 100644 index c7d04fc9e5..0000000000 --- a/patches/api/Add-getComputedBiome-API.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Mon, 14 Mar 2022 22:45:32 -0700 -Subject: [PATCH] Add getComputedBiome API - - -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -0,0 +0,0 @@ public interface RegionAccessor extends Keyed { // Paper - * - * @param location the location of the biome - * @return Biome at the given location -+ * @see #getComputedBiome(int, int, int) - */ - @NotNull - Biome getBiome(@NotNull Location location); -@@ -0,0 +0,0 @@ public interface RegionAccessor extends Keyed { // Paper - * @param y Y-coordinate of the block - * @param z Z-coordinate of the block - * @return Biome at the given coordinates -+ * @see #getComputedBiome(int, int, int) - */ - @NotNull - Biome getBiome(int x, int y, int z); - -+ // Paper start -+ /** -+ * Gets the computed {@link Biome} at the given coordinates. -+ * -+ *

The computed Biome is the Biome as seen by clients for rendering -+ * purposes and in the "F3" debug menu. This is computed by looking at the noise biome -+ * at this and surrounding quarts and applying complex math operations.

-+ * -+ *

Most other Biome-related methods named getBiome, setBiome, and similar -+ * operate on the "noise biome", which is stored per-quart, or in other words, -+ * 1 Biome per 4x4x4 block region. This is how Biomes are currently generated and -+ * stored on disk.

-+ * -+ * @param x X-coordinate of the block -+ * @param y Y-coordinate of the block -+ * @param z Z-coordinate of the block -+ * @return Biome at the given coordinates -+ */ -+ @NotNull -+ Biome getComputedBiome(int x, int y, int z); -+ // Paper end -+ - /** - * Sets the {@link Biome} at the given {@link Location}. - * -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - * Returns the biome that this block resides in - * - * @return Biome type containing this block -+ * @see #getComputedBiome() - */ - @NotNull - Biome getBiome(); - -+ // Paper start -+ /** -+ * Gets the computed biome at the location of this Block. -+ * -+ * @return computed biome at the location of this Block. -+ * @see org.bukkit.RegionAccessor#getComputedBiome(int, int, int) -+ */ -+ @NotNull -+ Biome getComputedBiome(); -+ // Paper end -+ - /** - * Sets the biome that this block resides in - * diff --git a/patches/api/Add-getDrops-to-BlockState.patch b/patches/api/Add-getDrops-to-BlockState.patch deleted file mode 100644 index 4262842642..0000000000 --- a/patches/api/Add-getDrops-to-BlockState.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MelnCat -Date: Fri, 12 Aug 2022 23:24:53 -0700 -Subject: [PATCH] Add getDrops to BlockState - -Originally added isPreferredTool to BlockData but -upstream added that. - -diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/BlockState.java -+++ b/src/main/java/org/bukkit/block/BlockState.java -@@ -0,0 +0,0 @@ public interface BlockState extends Metadatable { - * @return true if collidable - */ - boolean isCollidable(); -+ -+ /** -+ * Returns an immutable list of items which would drop by destroying this block state. -+ * -+ * @return an immutable list of dropped items for the block state -+ * @throws IllegalStateException if this block state is not placed -+ */ -+ @NotNull -+ default java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops() { -+ return this.getDrops(null); -+ } -+ -+ /** -+ * Returns an immutable list of items which would drop by destroying this block state -+ * with a specific tool -+ * -+ * @param tool The tool or item in hand used for digging -+ * @return an immutable list of dropped items for the block state -+ * @throws IllegalStateException if this block state is not placed -+ */ -+ @NotNull -+ default java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops(@Nullable org.bukkit.inventory.ItemStack tool) { -+ return this.getDrops(tool, null); -+ } -+ -+ /** -+ * Returns an immutable list of items which would drop by the entity destroying this -+ * block state with a specific tool -+ * -+ * @param tool The tool or item in hand used for digging -+ * @param entity the entity destroying the block -+ * @return an immutable list of dropped items for the block state -+ * @throws IllegalStateException if this block state is not placed -+ */ -+ @NotNull -+ java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops(@Nullable org.bukkit.inventory.ItemStack tool, @Nullable org.bukkit.entity.Entity entity); - // Paper end - } diff --git a/patches/api/Add-getI18NDisplayName-API.patch b/patches/api/Add-getI18NDisplayName-API.patch deleted file mode 100644 index be7ab40234..0000000000 --- a/patches/api/Add-getI18NDisplayName-API.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 4 May 2016 23:55:48 -0400 -Subject: [PATCH] Add getI18NDisplayName API - -Gets the Display name as seen in the Client. -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemFactory.java -+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java -@@ -0,0 +0,0 @@ public interface ItemFactory { - @NotNull - net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack); - // Paper end - Adventure -+ -+ // Paper start - add getI18NDisplayName -+ /** -+ * Gets the Display name as seen in the Client. -+ * Currently, the server only supports the English language. To override this, -+ * You must replace the language file embedded in the server jar. -+ * -+ * @param item Item to return Display name of -+ * @return Display name of Item -+ * @deprecated {@link ItemStack} implements {@link net.kyori.adventure.translation.Translatable}; use that and -+ * {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)} instead. -+ */ -+ @Nullable -+ @Deprecated(since = "1.18.1", forRemoval = true) -+ String getI18NDisplayName(@Nullable ItemStack item); -+ // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - public net.kyori.adventure.text.@NotNull Component displayName() { - return Bukkit.getServer().getItemFactory().displayName(this); - } -+ -+ /** -+ * Gets the Display name as seen in the Client. -+ * Currently the server only supports the English language. To override this, -+ * You must replace the language file embedded in the server jar. -+ * -+ * @return Display name of Item -+ * @deprecated {@link ItemStack} implements {@link net.kyori.adventure.translation.Translatable}; use that and -+ * {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)} instead. -+ */ -+ @Nullable -+ @Deprecated -+ public String getI18NDisplayName() { -+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this); -+ } - // Paper end - } diff --git a/patches/api/Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/api/Add-getMainThreadExecutor-to-BukkitScheduler.patch deleted file mode 100644 index 2997e9db51..0000000000 --- a/patches/api/Add-getMainThreadExecutor-to-BukkitScheduler.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aleksander Jagiello -Date: Sun, 24 Jan 2021 22:17:29 +0100 -Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler - - -diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java -+++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java -@@ -0,0 +0,0 @@ public interface BukkitScheduler { - @Deprecated(since = "1.7.10") - @NotNull - public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException; -+ -+ // Paper start - add getMainThreadExecutor -+ /** -+ * Returns an executor that will run tasks on the next server tick. -+ * -+ * @param plugin the reference to the plugin scheduling tasks -+ * @return an executor associated with the given plugin -+ */ -+ @NotNull -+ public java.util.concurrent.Executor getMainThreadExecutor(@NotNull Plugin plugin); -+ // Paper end - } diff --git a/patches/api/Add-getNearbyXXX-methods-to-Location.patch b/patches/api/Add-getNearbyXXX-methods-to-Location.patch deleted file mode 100644 index 52f914acf0..0000000000 --- a/patches/api/Add-getNearbyXXX-methods-to-Location.patch +++ /dev/null @@ -1,258 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Mon, 18 Jun 2018 00:41:46 -0500 -Subject: [PATCH] Add "getNearbyXXX" methods to Location - - -diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Location.java -+++ b/src/main/java/org/bukkit/Location.java -@@ -0,0 +0,0 @@ import org.bukkit.util.Vector; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - -+// Paper start -+import java.util.Collection; -+import java.util.Collections; -+import java.util.function.Predicate; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.Player; -+// Paper end -+ - /** - * Represents a 3-dimensional position in a world. - *
-@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - } - // Paper end - expand Location API - -+ // Paper start - additional getNearbyEntities API -+ /** -+ * Returns a list of entities within a bounding box centered around a Location. -+ *

-+ * Some implementations may impose artificial restrictions on the size of the search bounding box. -+ * -+ * @param x 1/2 the size of the box along the x-axis -+ * @param y 1/2 the size of the box along the y-axis -+ * @param z 1/2 the size of the box along the z-axis -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyEntities(final double x, final double y, final double z) { -+ final World world = this.getWorld(); -+ if (world == null) { -+ throw new IllegalArgumentException("Location has no world"); -+ } -+ return world.getNearbyEntities(this, x, y, z); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param radius X Radius -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyLivingEntities(final double radius) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, radius, radius, radius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param xzRadius X/Z Radius -+ * @param yRadius Y Radius -+ * @return the collection of living entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyLivingEntities(final double xzRadius, final double yRadius) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, xzRadius, yRadius, xzRadius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z radius -+ * @return the collection of living entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyLivingEntities(final double xRadius, final double yRadius, final double zRadius) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, xRadius, yRadius, zRadius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param radius Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of living entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyLivingEntities(final double radius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, radius, radius, radius, predicate); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param xzRadius X/Z Radius -+ * @param yRadius Y Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of living entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyLivingEntities(final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, xzRadius, yRadius, xzRadius, predicate); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of living entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyLivingEntities(final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, xRadius, yRadius, zRadius, predicate); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param radius X/Y/Z Radius -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyPlayers(final double radius) { -+ return this.getNearbyEntitiesByType(Player.class, radius, radius, radius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param xzRadius X/Z Radius -+ * @param yRadius Y Radius -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyPlayers(final double xzRadius, final double yRadius) { -+ return this.getNearbyEntitiesByType(Player.class, xzRadius, yRadius, xzRadius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z Radius -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyPlayers(final double xRadius, final double yRadius, final double zRadius) { -+ return this.getNearbyEntitiesByType(Player.class, xRadius, yRadius, zRadius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param radius X/Y/Z Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyPlayers(final double radius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(Player.class, radius, radius, radius, predicate); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param xzRadius X/Z Radius -+ * @param yRadius Y Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyPlayers(final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(Player.class, xzRadius, yRadius, xzRadius, predicate); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyPlayers(final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(Player.class, xRadius, yRadius, zRadius, predicate); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius (bounding box) -+ * @param clazz Type to filter by -+ * @param radius X/Y/Z radius to search within -+ * @param the entity type -+ * @return the collection of entities of type clazz near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double radius) { -+ return this.getNearbyEntitiesByType(clazz, radius, radius, radius, null); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box) -+ * @param clazz Type to filter by -+ * @param xzRadius X/Z radius to search within -+ * @param yRadius Y radius to search within -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double xzRadius, final double yRadius) { -+ return this.getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, null); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius (bounding box) -+ * @param clazz Type to filter by -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z Radius -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double xRadius, final double yRadius, final double zRadius) { -+ return this.getNearbyEntitiesByType(clazz, xRadius, yRadius, zRadius, null); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius (bounding box) -+ * @param clazz Type to filter by -+ * @param radius X/Y/Z radius to search within -+ * @param predicate a predicate used to filter results -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double radius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(clazz, radius, radius, radius, predicate); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box) -+ * @param clazz Type to filter by -+ * @param xzRadius X/Z radius to search within -+ * @param yRadius Y radius to search within -+ * @param predicate a predicate used to filter results -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, predicate); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius (bounding box) -+ * @param clazz Type to filter by -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z Radius -+ * @param predicate a predicate used to filter results -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { -+ final World world = this.getWorld(); -+ if (world == null) { -+ throw new IllegalArgumentException("Location has no world"); -+ } -+ return world.getNearbyEntitiesByType(clazz, this, xRadius, yRadius, zRadius, predicate); -+ } -+ // Paper end - additional getNearbyEntities API -+ - @Override - public boolean equals(Object obj) { - if (obj == null) { diff --git a/patches/api/Add-getOfflinePlayerIfCached-String.patch b/patches/api/Add-getOfflinePlayerIfCached-String.patch deleted file mode 100644 index af66cd702b..0000000000 --- a/patches/api/Add-getOfflinePlayerIfCached-String.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: oxygencraft <21054297+oxygencraft@users.noreply.github.com> -Date: Sun, 25 Oct 2020 18:35:58 +1100 -Subject: [PATCH] Add getOfflinePlayerIfCached(String) - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.getOfflinePlayer(name); - } - -+ // Paper start -+ /** -+ * Gets the player by the given name, regardless if they are offline or -+ * online. -+ *

-+ * This will not make a web request to get the UUID for the given name, -+ * thus this method will not block. However this method will return -+ * {@code null} if the player is not cached. -+ *

-+ * -+ * @param name the name of the player to retrieve -+ * @return an offline player if cached, {@code null} otherwise -+ * @see #getOfflinePlayer(String) -+ * @see #getOfflinePlayer(java.util.UUID) -+ */ -+ @Nullable -+ public static OfflinePlayer getOfflinePlayerIfCached(@NotNull String name) { -+ return server.getOfflinePlayerIfCached(name); -+ } -+ // Paper end -+ - /** - * Gets the player by the given UUID, regardless if they are offline or - * online. -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public OfflinePlayer getOfflinePlayer(@NotNull String name); - -+ // Paper start -+ /** -+ * Gets the player by the given name, regardless if they are offline or -+ * online. -+ *

-+ * This will not make a web request to get the UUID for the given name, -+ * thus this method will not block. However this method will return -+ * {@code null} if the player is not cached. -+ *

-+ * -+ * @param name the name of the player to retrieve -+ * @return an offline player if cached, {@code null} otherwise -+ * @see #getOfflinePlayer(String) -+ * @see #getOfflinePlayer(java.util.UUID) -+ */ -+ @Nullable -+ public OfflinePlayer getOfflinePlayerIfCached(@NotNull String name); -+ // Paper end -+ - /** - * Gets the player by the given UUID, regardless if they are offline or - * online. diff --git a/patches/api/Add-getTPS-method.patch b/patches/api/Add-getTPS-method.patch deleted file mode 100644 index f8197fc296..0000000000 --- a/patches/api/Add-getTPS-method.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 29 Feb 2016 17:24:57 -0600 -Subject: [PATCH] Add getTPS method - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.getEntity(uuid); - } - -+ // Paper start -+ /** -+ * Gets the current server TPS -+ * @return current server TPS (1m, 5m, 15m in Paper-Server) -+ */ -+ @NotNull -+ public static double[] getTPS() { -+ return server.getTPS(); -+ } -+ // Paper end -+ - /** - * Get the advancement specified by this key. - * -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @Nullable - Entity getEntity(@NotNull UUID uuid); - -+ // Paper start -+ /** -+ * Gets the current server TPS -+ * -+ * @return current server TPS (1m, 5m, 15m in Paper-Server) -+ */ -+ @NotNull -+ public double[] getTPS(); -+ // Paper end -+ - /** - * Get the advancement specified by this key. - * diff --git a/patches/api/Add-hand-to-fish-event-for-all-player-interactions.patch b/patches/api/Add-hand-to-fish-event-for-all-player-interactions.patch deleted file mode 100644 index caa94e5a6f..0000000000 --- a/patches/api/Add-hand-to-fish-event-for-all-player-interactions.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: booky10 -Date: Mon, 3 Jul 2023 01:55:32 +0200 -Subject: [PATCH] Add hand to fish event for all player interactions - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -@@ -0,0 +0,0 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable { - /** - * Get the hand that was used in this event. - *

-- * The hand used is only present when the event state is {@link State#FISHING}. -- * In all other states, the hand is null. -+ * The hand used is only present for player interactions. -+ * This means it will be null if state is set -+ * to {@link State#BITE} or {@link State#FAILED_ATTEMPT}. - * - * @return the hand - */ diff --git a/patches/api/Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/api/Add-handshake-event-to-allow-plugins-to-handle-clien.patch deleted file mode 100644 index 672fd30293..0000000000 --- a/patches/api/Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ /dev/null @@ -1,270 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Wed, 13 Apr 2016 20:20:18 -0700 -Subject: [PATCH] Add handshake event to allow plugins to handle client - handshaking logic themselves - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import java.util.UUID; -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.format.NamedTextColor; -+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * This event is fired during a player handshake. -+ *

-+ * If there are no listeners listening to this event, the logic default -+ * to your server platform will be run. -+ * -+ *

WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS

-+ */ -+@NullMarked -+public class PlayerHandshakeEvent extends Event implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final String originalHandshake; -+ private final String originalSocketAddressHostname; -+ private @Nullable String serverHostname; -+ private @Nullable String socketAddressHostname; -+ private @Nullable UUID uniqueId; -+ private @Nullable String propertiesJson; -+ private boolean failed; -+ private Component failMessage = Component.text("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!", NamedTextColor.YELLOW); -+ -+ private boolean cancelled; -+ -+ @Deprecated -+ @ApiStatus.Internal -+ public PlayerHandshakeEvent(final String originalHandshake, final boolean cancelled) { -+ this(originalHandshake, "127.0.0.1", cancelled); -+ } -+ -+ @ApiStatus.Internal -+ public PlayerHandshakeEvent(final String originalHandshake, final String originalSocketAddressHostname, final boolean cancelled) { -+ super(true); -+ this.originalHandshake = originalHandshake; -+ this.originalSocketAddressHostname = originalSocketAddressHostname; -+ this.cancelled = cancelled; -+ } -+ -+ /** -+ * Determines if this event is cancelled. -+ *

-+ * When this event is cancelled, custom handshake logic will not -+ * be processed. -+ * -+ * @return {@code true} if this event is cancelled, {@code false} otherwise -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Sets if this event is cancelled. -+ *

-+ * When this event is cancelled, custom handshake logic will not -+ * be processed. -+ * -+ * @param cancel {@code true} if this event is cancelled, {@code false} otherwise -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ /** -+ * Gets the original handshake string. -+ * -+ * @return the original handshake string -+ */ -+ public String getOriginalHandshake() { -+ return this.originalHandshake; -+ } -+ -+ /** -+ * Gets the original socket address hostname. -+ * -+ *

This does not include the port.

-+ *

In cases where this event is manually fired and the plugin wasn't updated yet, the default is {@code "127.0.0.1"}.

-+ * -+ * @return the original socket address hostname -+ */ -+ public String getOriginalSocketAddressHostname() { -+ return this.originalSocketAddressHostname; -+ } -+ -+ /** -+ * Gets the server hostname string. -+ * -+ *

This should not include the port.

-+ * -+ * @return the server hostname string -+ */ -+ public @Nullable String getServerHostname() { -+ return this.serverHostname; -+ } -+ -+ /** -+ * Sets the server hostname string. -+ * -+ *

This should not include the port.

-+ * -+ * @param serverHostname the server hostname string -+ */ -+ public void setServerHostname(final String serverHostname) { -+ this.serverHostname = serverHostname; -+ } -+ -+ /** -+ * Gets the socket address hostname string. -+ * -+ *

This should not include the port.

-+ * -+ * @return the socket address hostname string -+ */ -+ public @Nullable String getSocketAddressHostname() { -+ return this.socketAddressHostname; -+ } -+ -+ /** -+ * Sets the socket address hostname string. -+ * -+ *

This should not include the port.

-+ * -+ * @param socketAddressHostname the socket address hostname string -+ */ -+ public void setSocketAddressHostname(final String socketAddressHostname) { -+ this.socketAddressHostname = socketAddressHostname; -+ } -+ -+ /** -+ * Gets the unique id. -+ * -+ * @return the unique id -+ */ -+ public @Nullable UUID getUniqueId() { -+ return this.uniqueId; -+ } -+ -+ /** -+ * Sets the unique id. -+ * -+ * @param uniqueId the unique id -+ */ -+ public void setUniqueId(final UUID uniqueId) { -+ this.uniqueId = uniqueId; -+ } -+ -+ /** -+ * Gets the profile properties. -+ * -+ *

This should be a valid JSON string.

-+ * -+ * @return the profile properties, as JSON -+ */ -+ public @Nullable String getPropertiesJson() { -+ return this.propertiesJson; -+ } -+ -+ /** -+ * Determines if authentication failed. -+ *

-+ * When {@code true}, the client connecting will be disconnected -+ * with the {@link #getFailMessage() fail message}. -+ * -+ * @return {@code true} if authentication failed, {@code false} otherwise -+ */ -+ public boolean isFailed() { -+ return this.failed; -+ } -+ -+ /** -+ * Sets if authentication failed and the client should be disconnected. -+ *

-+ * When {@code true}, the client connecting will be disconnected -+ * with the {@link #getFailMessage() fail message}. -+ * -+ * @param failed {@code true} if authentication failed, {@code false} otherwise -+ */ -+ public void setFailed(final boolean failed) { -+ this.failed = failed; -+ } -+ -+ /** -+ * Sets the profile properties. -+ * -+ *

This should be a valid JSON string.

-+ * -+ * @param propertiesJson the profile properties, as JSON -+ */ -+ public void setPropertiesJson(final String propertiesJson) { -+ this.propertiesJson = propertiesJson; -+ } -+ -+ /** -+ * Gets the message to display to the client when authentication fails. -+ * -+ * @return the message to display to the client -+ */ -+ public Component failMessage() { -+ return this.failMessage; -+ } -+ -+ /** -+ * Sets the message to display to the client when authentication fails. -+ * -+ * @param failMessage the message to display to the client -+ */ -+ public void failMessage(final Component failMessage) { -+ this.failMessage = failMessage; -+ } -+ -+ /** -+ * Gets the message to display to the client when authentication fails. -+ * -+ * @return the message to display to the client -+ * @deprecated use {@link #failMessage()} -+ */ -+ @Deprecated -+ public String getFailMessage() { -+ return LegacyComponentSerializer.legacySection().serialize(this.failMessage()); -+ } -+ -+ /** -+ * Sets the message to display to the client when authentication fails. -+ * -+ * @param failMessage the message to display to the client -+ * @deprecated use {@link #failMessage(Component)} -+ */ -+ @Deprecated -+ public void setFailMessage(final String failMessage) { -+ Preconditions.checkArgument(failMessage != null && !failMessage.isEmpty(), "fail message cannot be null or empty"); -+ this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage)); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-hasCollision-methods-to-various-places.patch b/patches/api/Add-hasCollision-methods-to-various-places.patch deleted file mode 100644 index 7b3778f389..0000000000 --- a/patches/api/Add-hasCollision-methods-to-various-places.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 4 Nov 2021 11:50:35 -0700 -Subject: [PATCH] Add hasCollision methods to various places - - -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - } - // Paper end - item default attributes API - -+ // Paper start - isCollidable API -+ /** -+ * Checks if this material is collidable. -+ * -+ * @return true if collidable -+ * @throws IllegalArgumentException if {@link #isBlock()} is false -+ */ -+ public boolean isCollidable() { -+ if (this.isBlock()) { -+ return this.asBlockType().hasCollision(); -+ } -+ throw new IllegalArgumentException(this + " isn't a block type"); -+ } -+ // Paper end - isCollidable API -+ - /** - * Do not use for any reason. - * -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - * @return true if block is solid - */ - boolean isSolid(); -+ -+ /** -+ * Checks if this block is collidable. -+ * -+ * @return true if collidable -+ */ -+ boolean isCollidable(); - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/BlockState.java -+++ b/src/main/java/org/bukkit/block/BlockState.java -@@ -0,0 +0,0 @@ public interface BlockState extends Metadatable { - * or 'virtual' (e.g. on an itemstack) - */ - boolean isPlaced(); -+ -+ // Paper start -+ /** -+ * Checks if this block state is collidable. -+ * -+ * @return true if collidable -+ */ -+ boolean isCollidable(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/BlockType.java -+++ b/src/main/java/org/bukkit/block/BlockType.java -@@ -0,0 +0,0 @@ public interface BlockType extends Keyed, Translatable, net.kyori.adventure.tran - @Override - @NotNull String getTranslationKey(); - // Paper end - add Translatable -+ -+ // Paper start - hasCollision API -+ /** -+ * Checks if this block type has collision. -+ *

-+ * @return false if this block never has collision, true if it might have collision -+ */ -+ boolean hasCollision(); -+ // Paper end - hasCollision API - } diff --git a/patches/api/Add-helpers-for-left-right-click-to-Action.patch b/patches/api/Add-helpers-for-left-right-click-to-Action.patch deleted file mode 100644 index 8f8638bb5c..0000000000 --- a/patches/api/Add-helpers-for-left-right-click-to-Action.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Madeline Miller -Date: Sun, 29 Aug 2021 17:00:56 +1000 -Subject: [PATCH] Add helpers for left/right click to Action - - -diff --git a/src/main/java/org/bukkit/event/block/Action.java b/src/main/java/org/bukkit/event/block/Action.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/block/Action.java -+++ b/src/main/java/org/bukkit/event/block/Action.java -@@ -0,0 +0,0 @@ public enum Action { - *

  • Triggering tripwire - * - */ -- PHYSICAL, -+ // Paper start -+ PHYSICAL; -+ -+ /** -+ * Gets whether this action is a result of a left click. -+ * -+ * @return Whether it's a left click -+ */ -+ public boolean isLeftClick() { -+ return this == LEFT_CLICK_AIR || this == LEFT_CLICK_BLOCK; -+ } -+ -+ /** -+ * Gets whether this action is a result of a right click. -+ * -+ * @return Whether it's a right click -+ */ -+ public boolean isRightClick() { -+ return this == RIGHT_CLICK_AIR || this == RIGHT_CLICK_BLOCK; -+ } -+ // Paper end - } diff --git a/patches/api/Add-hook-to-remap-library-jars.patch b/patches/api/Add-hook-to-remap-library-jars.patch deleted file mode 100644 index af92be8749..0000000000 --- a/patches/api/Add-hook-to-remap-library-jars.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Sun, 28 Apr 2024 13:51:08 -0700 -Subject: [PATCH] Add hook to remap library jars - - -diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -@@ -0,0 +0,0 @@ public class LibraryLoader - private final DefaultRepositorySystemSession session; - private final List repositories; - public static java.util.function.BiFunction LIBRARY_LOADER_FACTORY; // Paper - rewrite reflection in libraries -+ public static java.util.function.Function, List> REMAPPER; // Paper - remap libraries - - public LibraryLoader(@NotNull Logger logger) - { -@@ -0,0 +0,0 @@ public class LibraryLoader - } - - List jarFiles = new ArrayList<>(); -+ List jarPaths = new ArrayList<>(); // Paper - remap libraries - for ( ArtifactResult artifact : result.getArtifactResults() ) - { -- File file = artifact.getArtifact().getFile(); -+ // Paper start - remap libraries -+ jarPaths.add(artifact.getArtifact().getFile().toPath()); -+ } -+ if (REMAPPER != null) { -+ jarPaths = REMAPPER.apply(jarPaths); -+ } -+ for (java.nio.file.Path path : jarPaths) { -+ File file = path.toFile(); -+ // Paper end - remap libraries - - URL url; - try diff --git a/patches/api/Add-ignore-discounts-API.patch b/patches/api/Add-ignore-discounts-API.patch deleted file mode 100644 index 04e13d61c4..0000000000 --- a/patches/api/Add-ignore-discounts-API.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Mon, 9 Nov 2020 20:33:38 +0100 -Subject: [PATCH] Add ignore discounts API - - -diff --git a/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/src/main/java/org/bukkit/inventory/MerchantRecipe.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java -+++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java -@@ -0,0 +0,0 @@ public class MerchantRecipe implements Recipe { - private int demand; - private int villagerExperience; - private float priceMultiplier; -+ private boolean ignoreDiscounts; // Paper - - public MerchantRecipe(@NotNull ItemStack result, int maxUses) { - this(result, 0, maxUses, false); -@@ -0,0 +0,0 @@ public class MerchantRecipe implements Recipe { - } - - public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice) { -+ // Paper start - add ignoreDiscounts param -+ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, demand, specialPrice, false); -+ } -+ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, boolean ignoreDiscounts) { -+ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, 0, 0, ignoreDiscounts); -+ } -+ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice, boolean ignoreDiscounts) { -+ this.ignoreDiscounts = ignoreDiscounts; -+ // Paper end - this.result = result; - this.uses = uses; - this.maxUses = maxUses; -@@ -0,0 +0,0 @@ public class MerchantRecipe implements Recipe { - public void setPriceMultiplier(float priceMultiplier) { - this.priceMultiplier = priceMultiplier; - } -+ -+ // Paper start -+ /** -+ * @return Whether all discounts on this trade should be ignored. -+ */ -+ public boolean shouldIgnoreDiscounts() { -+ return ignoreDiscounts; -+ } -+ -+ /** -+ * @param ignoreDiscounts Whether all discounts on this trade should be ignored. -+ */ -+ public void setIgnoreDiscounts(boolean ignoreDiscounts) { -+ this.ignoreDiscounts = ignoreDiscounts; -+ } -+ // Paper end - } diff --git a/patches/api/Add-item-slot-convenience-methods.patch b/patches/api/Add-item-slot-convenience-methods.patch deleted file mode 100644 index 1750f0ef78..0000000000 --- a/patches/api/Add-item-slot-convenience-methods.patch +++ /dev/null @@ -1,330 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Sat, 25 Apr 2020 23:31:28 +0200 -Subject: [PATCH] Add item slot convenience methods - -Co-authored-by: Janet Blackquill - -diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/AnvilInventory.java -+++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java -@@ -0,0 +0,0 @@ public interface AnvilInventory extends Inventory { - */ - @Deprecated(forRemoval = true, since = "1.21") - void setMaximumRepairCost(int levels); -+ -+ // Paper start -+ /** -+ * Gets the item in the left input slot. -+ * -+ * @return item in the first slot -+ */ -+ @Nullable -+ default ItemStack getFirstItem() { -+ return getItem(0); -+ } -+ -+ /** -+ * Sets the item in the left input slot. -+ * -+ * @param firstItem item to set -+ */ -+ default void setFirstItem(@Nullable ItemStack firstItem) { -+ setItem(0, firstItem); -+ } -+ -+ /** -+ * Gets the item in the right input slot. -+ * -+ * @return item in the second slot -+ */ -+ @Nullable -+ default ItemStack getSecondItem() { -+ return getItem(1); -+ } -+ -+ /** -+ * Sets the item in the right input slot. -+ * -+ * @param secondItem item to set -+ */ -+ default void setSecondItem(@Nullable ItemStack secondItem) { -+ setItem(1, secondItem); -+ } -+ -+ /** -+ * Gets the item in the result slot. -+ * -+ * @return item in the result slot -+ */ -+ @Nullable -+ default ItemStack getResult() { -+ return getItem(2); -+ } -+ -+ /** -+ * Sets the item in the result slot. -+ * Note that the client might not be able to take out the item if it does not match the input items. -+ * -+ * @param result item to set -+ */ -+ default void setResult(@Nullable ItemStack result) { -+ setItem(2, result); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/CartographyInventory.java b/src/main/java/org/bukkit/inventory/CartographyInventory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/CartographyInventory.java -+++ b/src/main/java/org/bukkit/inventory/CartographyInventory.java -@@ -0,0 +0,0 @@ package org.bukkit.inventory; - /** - * Interface to the inventory of a Cartography table. - */ --public interface CartographyInventory extends Inventory { } -+public interface CartographyInventory extends Inventory { -+ // Paper begin - add getResult/setResult to CartographyInventory -+ /** -+ * Check what item is in the result slot of this smithing table. -+ * -+ * @return the result item -+ */ -+ @org.jetbrains.annotations.Nullable -+ default ItemStack getResult() { -+ return this.getItem(2); // net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT -+ } -+ -+ /** -+ * Set the item in the result slot of the smithing table -+ * -+ * @param newResult the new result item -+ */ -+ default void setResult(final @org.jetbrains.annotations.Nullable ItemStack newResult) { -+ this.setItem(2, newResult); // net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT -+ } -+ // Paper end - add getResult/setResult to CartographyInventory -+} -diff --git a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java -+++ b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java -@@ -0,0 +0,0 @@ - package org.bukkit.inventory; - -+import org.jetbrains.annotations.Nullable; // Paper -+ - /** - * Interface to the inventory of a Grindstone. - */ --public interface GrindstoneInventory extends Inventory { } -+public interface GrindstoneInventory extends Inventory { -+ -+ // Paper start -+ /** -+ * Gets the upper input item. -+ * -+ * @return upper input item -+ */ -+ @Nullable -+ default ItemStack getUpperItem() { -+ return getItem(0); -+ } -+ -+ /** -+ * Sets the upper input item. -+ * -+ * @param upperItem item to set -+ */ -+ default void setUpperItem(@Nullable ItemStack upperItem) { -+ setItem(0, upperItem); -+ } -+ -+ /** -+ * Gets the lower input item. -+ * -+ * @return lower input item -+ */ -+ @Nullable -+ default ItemStack getLowerItem() { -+ return getItem(1); -+ } -+ -+ /** -+ * Sets the lower input item. -+ * -+ * @param lowerItem item to set -+ */ -+ default void setLowerItem(@Nullable ItemStack lowerItem) { -+ setItem(1, lowerItem); -+ } -+ -+ /** -+ * Gets the result. -+ * -+ * @return result -+ */ -+ @Nullable -+ default ItemStack getResult() { -+ return getItem(2); -+ } -+ -+ /** -+ * Sets the result. -+ * -+ * @param result item to set -+ */ -+ default void setResult(@Nullable ItemStack result) { -+ setItem(2, result); -+ } -+ // Paper end -+} -diff --git a/src/main/java/org/bukkit/inventory/LecternInventory.java b/src/main/java/org/bukkit/inventory/LecternInventory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/LecternInventory.java -+++ b/src/main/java/org/bukkit/inventory/LecternInventory.java -@@ -0,0 +0,0 @@ public interface LecternInventory extends Inventory { - @Nullable - @Override - public Lectern getHolder(); -+ -+ // Paper start -+ /** -+ * Gets the lectern's held book. -+ * -+ * @return book set in the lectern -+ */ -+ @Nullable -+ default ItemStack getBook() { -+ return getItem(0); -+ } -+ -+ /** -+ * Sets the lectern's held book. -+ * -+ * @param book the new book -+ */ -+ default void setBook(@Nullable ItemStack book) { -+ setItem(0, book); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/SmithingInventory.java b/src/main/java/org/bukkit/inventory/SmithingInventory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/SmithingInventory.java -+++ b/src/main/java/org/bukkit/inventory/SmithingInventory.java -@@ -0,0 +0,0 @@ public interface SmithingInventory extends Inventory { - */ - @Nullable - Recipe getRecipe(); -+ -+ // Paper start -+ /** -+ * Gets the input template (first slot). -+ * -+ * @return input template item -+ */ -+ default @Nullable ItemStack getInputTemplate() { -+ return this.getItem(0); -+ } -+ -+ /** -+ * Sets the input template (first slot). -+ * -+ * @param itemStack item to set -+ */ -+ default void setInputTemplate(@Nullable ItemStack itemStack) { -+ this.setItem(0, itemStack); -+ } -+ /** -+ * Gets the input equipment (second slot). -+ * -+ * @return input equipment item -+ */ -+ default @Nullable ItemStack getInputEquipment() { -+ return this.getItem(1); -+ } -+ -+ /** -+ * Sets the input equipment (second slot). -+ * -+ * @param itemStack item to set -+ */ -+ default void setInputEquipment(@Nullable ItemStack itemStack) { -+ this.setItem(1, itemStack); -+ } -+ -+ /** -+ * Gets the input mineral (third slot). -+ * -+ * @return input mineral item -+ */ -+ default @Nullable ItemStack getInputMineral() { -+ return this.getItem(2); -+ } -+ -+ /** -+ * Sets the input mineral (third slot). -+ * -+ * @param itemStack item to set -+ */ -+ default void setInputMineral(@Nullable ItemStack itemStack) { -+ this.setItem(2, itemStack); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/StonecutterInventory.java b/src/main/java/org/bukkit/inventory/StonecutterInventory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/StonecutterInventory.java -+++ b/src/main/java/org/bukkit/inventory/StonecutterInventory.java -@@ -0,0 +0,0 @@ - package org.bukkit.inventory; - -+import org.jetbrains.annotations.Nullable; // Paper -+ - /** - * Interface to the inventory of a Stonecutter. - */ --public interface StonecutterInventory extends Inventory { } -+public interface StonecutterInventory extends Inventory { -+ -+ // Paper start -+ /** -+ * Gets the input item. -+ * -+ * @return input item -+ */ -+ @Nullable -+ default ItemStack getInputItem() { -+ return getItem(0); -+ } -+ -+ /** -+ * Sets the input item. -+ * -+ * @param itemStack item to set -+ */ -+ default void setInputItem(@Nullable ItemStack itemStack) { -+ setItem(0, itemStack); -+ } -+ -+ /** -+ * Gets the result item. -+ * -+ * @return result -+ */ -+ @Nullable -+ default ItemStack getResult() { -+ return getItem(1); -+ } -+ -+ /** -+ * Sets the result item. -+ * -+ * @param itemStack item to set -+ */ -+ default void setResult(@Nullable ItemStack itemStack) { -+ setItem(1, itemStack); -+ } -+ // Paper end -+} diff --git a/patches/api/Add-legacy-ping-support-to-PaperServerListPingEvent.patch b/patches/api/Add-legacy-ping-support-to-PaperServerListPingEvent.patch deleted file mode 100644 index 67d0480df5..0000000000 --- a/patches/api/Add-legacy-ping-support-to-PaperServerListPingEvent.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Minecrell -Date: Wed, 11 Oct 2017 19:30:20 +0200 -Subject: [PATCH] Add legacy ping support to PaperServerListPingEvent - -Add a new method to StatusClient check if the client is a legacy -client that does not support all of the features provided in the -event. - -diff --git a/src/main/java/com/destroystokyo/paper/network/StatusClient.java b/src/main/java/com/destroystokyo/paper/network/StatusClient.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/network/StatusClient.java -+++ b/src/main/java/com/destroystokyo/paper/network/StatusClient.java -@@ -0,0 +0,0 @@ import com.destroystokyo.paper.event.server.PaperServerListPingEvent; - */ - public interface StatusClient extends NetworkClient { - -+ /** -+ * Returns whether the client is using an older version that doesn't -+ * support all the features in {@link PaperServerListPingEvent}. -+ * -+ *

    For Vanilla, this returns {@code true} for all clients older than 1.7.

    -+ * -+ * @return {@code true} if the client is using legacy ping -+ */ -+ default boolean isLegacy() { -+ return false; -+ } -+ - } diff --git a/patches/api/Add-method-isTickingWorlds-to-Bukkit.patch b/patches/api/Add-method-isTickingWorlds-to-Bukkit.patch deleted file mode 100644 index 770793c464..0000000000 --- a/patches/api/Add-method-isTickingWorlds-to-Bukkit.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BuildTools <46540330+willkroboth@users.noreply.github.com> -Date: Fri, 19 Aug 2022 16:11:51 -0400 -Subject: [PATCH] Add method isTickingWorlds() to Bukkit. - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.getWorlds(); - } - -+ // Paper start -+ /** -+ * Gets whether the worlds are being ticked right now. -+ * -+ * @return true if the worlds are being ticked, false otherwise. -+ */ -+ public static boolean isTickingWorlds(){ -+ return server.isTickingWorlds(); -+ } -+ // Paper end -+ - /** - * Creates or loads a world with the given name using the specified - * options. - *

    - * If the world is already loaded, it will just return the equivalent of - * getWorld(creator.name()). -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param creator the options to use when creating the world - * @return newly created or loaded world -@@ -0,0 +0,0 @@ public final class Bukkit { - - /** - * Unloads a world with the given name. -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param name Name of the world to unload - * @param save whether to save the chunks before unloading -@@ -0,0 +0,0 @@ public final class Bukkit { - - /** - * Unloads the given world. -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param world the world to unload - * @param save whether to save the chunks before unloading -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public List getWorlds(); - -+ // Paper start -+ /** -+ * Gets whether the worlds are being ticked right now. -+ * -+ * @return true if the worlds are being ticked, false otherwise. -+ */ -+ public boolean isTickingWorlds(); -+ // Paper end -+ - /** - * Creates or loads a world with the given name using the specified - * options. - *

    - * If the world is already loaded, it will just return the equivalent of - * getWorld(creator.name()). -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param creator the options to use when creating the world - * @return newly created or loaded world -+ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true - */ - @Nullable - public World createWorld(@NotNull WorldCreator creator); - - /** - * Unloads a world with the given name. -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param name Name of the world to unload - * @param save whether to save the chunks before unloading - * @return true if successful, false otherwise -+ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true - */ - public boolean unloadWorld(@NotNull String name, boolean save); - - /** - * Unloads the given world. -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param world the world to unload - * @param save whether to save the chunks before unloading - * @return true if successful, false otherwise -+ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true - */ - public boolean unloadWorld(@NotNull World world, boolean save); - diff --git a/patches/api/Add-method-to-remove-all-active-potion-effects.patch b/patches/api/Add-method-to-remove-all-active-potion-effects.patch deleted file mode 100644 index 130329eba6..0000000000 --- a/patches/api/Add-method-to-remove-all-active-potion-effects.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 17 Jun 2023 13:17:20 -0700 -Subject: [PATCH] Add method to remove all active potion effects - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @NotNull - public Collection getActivePotionEffects(); - -+ // Paper start - LivingEntity#clearActivePotionEffects(); -+ /** -+ * Removes all active potion effects for this entity. -+ * -+ * @return true if any were removed -+ */ -+ boolean clearActivePotionEffects(); -+ // Paper end -+ - /** - * Checks whether the living entity has block line of sight to another. - *

    diff --git a/patches/api/Add-methods-for-working-with-arrows-stuck-in-living-.patch b/patches/api/Add-methods-for-working-with-arrows-stuck-in-living-.patch deleted file mode 100644 index af4c137487..0000000000 --- a/patches/api/Add-methods-for-working-with-arrows-stuck-in-living-.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: mrapple -Date: Sun, 25 Nov 2012 13:47:27 -0600 -Subject: [PATCH] Add methods for working with arrows stuck in living entities - -Upstream added methods for this so the original methods -are now deprecated - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - public int getArrowsInBody(); - -+ // Paper start -+ /** -+ * Set the amount of arrows in the entity's body. -+ *

    -+ * Does not fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent}. -+ * -+ * @param count amount of arrows in entity's body -+ */ -+ default void setArrowsInBody(final int count) { -+ this.setArrowsInBody(count, false); -+ } -+ // Paper end -+ - /** - * Set the amount of arrows in the entity's body. - * - * @param count amount of arrows in entity's body -+ * @param fireEvent whether to fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} event -+ */ -+ void setArrowsInBody(int count, boolean fireEvent); // Paper -+ -+ // Paper start - Add methods for working with arrows stuck in living entities -+ /** -+ * Sets the amount of ticks before the next arrow gets removed from the entities body. -+ *

    -+ * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick. -+ * -+ * @param ticks Amount of ticks - */ -- public void setArrowsInBody(int count); -+ void setNextArrowRemoval(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int ticks); -+ -+ /** -+ * Gets the amount of ticks before the next arrow gets removed from the entities body. -+ * -+ * @return ticks Amount of ticks -+ */ -+ int getNextArrowRemoval(); -+ // Paper end - Add methods for working with arrows stuck in living entities - - /** - * Returns the living entity's current maximum no damage ticks. -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @return Whether the entity is invisible - */ - public boolean isInvisible(); -+ -+ // Paper start -+ /** -+ * Get the number of arrows stuck in this entity -+ * @return Number of arrows stuck -+ * @deprecated use {@link #getArrowsInBody()} -+ */ -+ @Deprecated -+ int getArrowsStuck(); -+ -+ /** -+ * Set the number of arrows stuck in this entity -+ * -+ * @param arrows Number of arrows to stick in this entity -+ * @deprecated use {@link #setArrowsInBody(int, boolean)}. This method previously fired {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} so if -+ * you want to retain exact functionality, pass {@code true} for {@code fireEvent}. -+ */ -+ @Deprecated -+ void setArrowsStuck(int arrows); -+ // Paper end - } diff --git a/patches/api/Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/api/Add-methods-to-find-targets-for-lightning-strikes.patch deleted file mode 100644 index 0de797361e..0000000000 --- a/patches/api/Add-methods-to-find-targets-for-lightning-strikes.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jakub Zacek -Date: Mon, 4 Oct 2021 08:29:36 +0200 -Subject: [PATCH] Add methods to find targets for lightning strikes - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @NotNull - public LightningStrike strikeLightningEffect(@NotNull Location loc); - -+ // Paper start -+ /** -+ * Finds the location of the nearest unobstructed Lightning Rod in a 128-block -+ * radius around the given location. Returns {@code null} if no Lightning Rod is found. -+ * -+ *

    Note: To activate a Lightning Rod, the position one block above it must be struck by lightning.

    -+ * -+ * @param location {@link Location} to search for Lightning Rod around -+ * @return {@link Location} of Lightning Rod or {@code null} -+ */ -+ @Nullable -+ public Location findLightningRod(@NotNull Location location); -+ -+ /** -+ * Finds a target {@link Location} for lightning to strike. -+ *

    It selects from (in the following order):

    -+ *
      -+ *
    1. the block above the nearest Lightning Rod, found using {@link World#findLightningRod(Location)}
    2. -+ *
    3. a random {@link LivingEntity} that can see the sky in a 6x6 cuboid -+ * around input X/Z coordinates. Y ranges from the highest motion-blocking -+ * block at the input X/Z - 3 to the height limit + 3
    4. -+ *
    -+ *

    Returns {@code null} if no target is found.

    -+ * -+ * @param location {@link Location} to search for target around -+ * @return lightning target or {@code null} -+ */ -+ @Nullable -+ public Location findLightningTarget(@NotNull Location location); -+ // Paper end -+ - /** - * Get a list of all entities in this World - * diff --git a/patches/api/Add-methods-to-get-translation-keys.patch b/patches/api/Add-methods-to-get-translation-keys.patch deleted file mode 100644 index 3bf8821397..0000000000 --- a/patches/api/Add-methods-to-get-translation-keys.patch +++ /dev/null @@ -1,582 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 11 Aug 2020 19:17:46 +0200 -Subject: [PATCH] Add methods to get translation keys - -Co-authored-by: MeFisto94 - -diff --git a/src/main/java/org/bukkit/Difficulty.java b/src/main/java/org/bukkit/Difficulty.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Difficulty.java -+++ b/src/main/java/org/bukkit/Difficulty.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents the various difficulty levels that are available. - */ --public enum Difficulty { -+public enum Difficulty implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - /** - * Players regain health over time, hostile mobs don't spawn, the hunger - * bar does not deplete. -@@ -0,0 +0,0 @@ public enum Difficulty { - return value; - } - -+ // Paper start -+ @Override -+ public @org.jetbrains.annotations.NotNull String translationKey() { -+ return "options.difficulty." + this.name().toLowerCase(java.util.Locale.ENGLISH); -+ } -+ // Paper end - /** - * Gets the Difficulty represented by the specified value - * -diff --git a/src/main/java/org/bukkit/FireworkEffect.java b/src/main/java/org/bukkit/FireworkEffect.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/FireworkEffect.java -+++ b/src/main/java/org/bukkit/FireworkEffect.java -@@ -0,0 +0,0 @@ public final class FireworkEffect implements ConfigurationSerializable { - /** - * The type or shape of the effect. - */ -- public enum Type { -+ public enum Type implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - /** - * A small ball effect. - */ -- BALL, -+ BALL("small_ball"), // Paper - add name - /** - * A large ball effect. - */ -- BALL_LARGE, -+ BALL_LARGE("large_ball"), // Paper - add name - /** - * A star-shaped effect. - */ -- STAR, -+ STAR("star"), // Paper - add name - /** - * A burst effect. - */ -- BURST, -+ BURST("burst"), // Paper - add name - /** - * A creeper-face effect. - */ -- CREEPER, -+ CREEPER("creeper"), // Paper - add name - ; -+ // Paper start -+ /** -+ * The name map. -+ */ -+ public static final net.kyori.adventure.util.Index NAMES = net.kyori.adventure.util.Index.create(Type.class, type -> type.name); -+ private final String name; -+ -+ Type(final String name) { -+ this.name = name; -+ } -+ -+ @Override -+ public @NotNull String translationKey() { -+ return "item.minecraft.firework_star.shape." + this.name; -+ } -+ // Paper end - } - - /** -diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/GameMode.java -+++ b/src/main/java/org/bukkit/GameMode.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * Represents the various type of game modes that {@link HumanEntity}s may - * have - */ --public enum GameMode { -+public enum GameMode implements net.kyori.adventure.translation.Translatable { // Paper - implement Translatable - /** - * Creative mode may fly, build instantly, become invulnerable and create - * free items. -@@ -0,0 +0,0 @@ public enum GameMode { - - private final int value; - private static final Map BY_ID = Maps.newHashMap(); -+ // Paper start - translation keys -+ private final String translationKey; -+ -+ @Override -+ public @org.jetbrains.annotations.NotNull String translationKey() { -+ return this.translationKey; -+ } -+ // Paper end - - private GameMode(final int value) { - this.value = value; -+ this.translationKey = "gameMode." + this.name().toLowerCase(java.util.Locale.ENGLISH); // Paper - } - - /** -diff --git a/src/main/java/org/bukkit/GameRule.java b/src/main/java/org/bukkit/GameRule.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/GameRule.java -+++ b/src/main/java/org/bukkit/GameRule.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * - * @param type of rule (Boolean or Integer) - */ --public final class GameRule { -+public final class GameRule implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - - private static Map> gameRules = new HashMap<>(); - // Boolean rules -@@ -0,0 +0,0 @@ public final class GameRule { - public static GameRule[] values() { - return gameRules.values().toArray(new GameRule[gameRules.size()]); - } -+ -+ // Paper start -+ @Override -+ public @NotNull String translationKey() { -+ return "gamerule." + this.name; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * An enum of all material IDs accepted by the official server and client - */ - @SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper --public enum Material implements Keyed, Translatable { -+public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - // - AIR(9648, 0), - STONE(22948), -@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable { - } - // Paper end - -+ // Paper start - add Translatable -+ @Override -+ public @NotNull String translationKey() { -+ if (this.isItem()) { -+ return java.util.Objects.requireNonNull(this.asItemType()).translationKey(); -+ } else { -+ return java.util.Objects.requireNonNull(this.asBlockType()).translationKey(); -+ } -+ } -+ // Paper end - add Translatable -+ - /** - * Do not use for any reason. - * -@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable { - * material - * @see #getBlockTranslationKey() - * @see #getItemTranslationKey() -+ * @deprecated use {@link #translationKey()} - */ - @Override - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public String getTranslationKey() { - if (this.isItem()) { - return asItemType().getTranslationKey(); -diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/MusicInstrument.java -+++ b/src/main/java/org/bukkit/MusicInstrument.java -@@ -0,0 +0,0 @@ import java.util.Collections; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - --public abstract class MusicInstrument implements Keyed { -+public abstract class MusicInstrument implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translation keys - - public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn"); - public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn"); -@@ -0,0 +0,0 @@ public abstract class MusicInstrument implements Keyed { - private static MusicInstrument getInstrument(@NotNull String key) { - return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key)); - } -+ -+ // Paper start - mark translation key as deprecated -+ /** -+ * @deprecated this method assumes that the instrument description -+ * always be a translatable component which is not guaranteed. -+ */ -+ @Override -+ @Deprecated(forRemoval = true) -+ public abstract @NotNull String translationKey(); -+ // Paper end - mark translation key as deprecated - } -diff --git a/src/main/java/org/bukkit/Translatable.java b/src/main/java/org/bukkit/Translatable.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Translatable.java -+++ b/src/main/java/org/bukkit/Translatable.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents an object with a text representation that can be translated by the - * Minecraft client. -+ * @deprecated use {@link net.kyori.adventure.translation.Translatable} - */ -+@Deprecated(forRemoval = true) // Paper - public interface Translatable { - - /** - * Get the translation key, suitable for use in a translation component. - * - * @return the translation key -+ * @deprecated look for a {@code translationKey()} method instead - */ - @NotNull -+ @Deprecated(forRemoval = true) // Paper - String getTranslationKey(); - } -diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/attribute/Attribute.java -+++ b/src/main/java/org/bukkit/attribute/Attribute.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Types of attributes which may be present on an {@link Attributable}. - */ --public interface Attribute extends OldEnum, Keyed, Translatable { -+public interface Attribute extends OldEnum, Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - - /** - * Maximum health of an Entity. -diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Biome.java -+++ b/src/main/java/org/bukkit/block/Biome.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - * There may be additional biomes present in the server, for example from a {@link DataPack} - * which can be accessed via {@link Registry#BIOME}. - */ --public interface Biome extends OldEnum, Keyed { -+public interface Biome extends OldEnum, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - - Biome OCEAN = getBiome("ocean"); - Biome PLAINS = getBiome("plains"); -@@ -0,0 +0,0 @@ public interface Biome extends OldEnum, Keyed { - static Biome[] values() { - return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]); - } -+ -+ // Paper start -+ @Override -+ default @NotNull String translationKey() { -+ return "biome.minecraft." + this.getKey().getKey(); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * (i.e. lighting and power) may not be able to be safely accessed during world - * generation when used in cases like BlockPhysicsEvent!!!! - */ --public interface Block extends Metadatable, Translatable { -+public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable - - /** - * Gets the metadata for this block -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable { - * @return the sound group for this block - */ - @NotNull org.bukkit.SoundGroup getBlockSoundGroup(); -+ -+ /** -+ * @deprecated use {@link #translationKey()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ String getTranslationKey(); - // Paper end - } -diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/BlockType.java -+++ b/src/main/java/org/bukkit/block/BlockType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * changes may occur. Do not use this API in plugins. - */ - @ApiStatus.Internal --public interface BlockType extends Keyed, Translatable { -+public interface BlockType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add translatable - - /** - * Typed represents a subtype of {@link BlockType}s that have a known block -@@ -0,0 +0,0 @@ public interface BlockType extends Keyed, Translatable { - @Nullable - @Deprecated(since = "1.20.6") - Material asMaterial(); -+ -+ // Paper start - add Translatable -+ /** -+ * @deprecated use {@link #translationKey()} and {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Override -+ @NotNull String getTranslationKey(); -+ // Paper end - add Translatable - } -diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/enchantments/Enchantment.java -+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * The various type of enchantments that may be added to armour or weapons - */ --public abstract class Enchantment implements Keyed, Translatable { -+public abstract class Enchantment implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - /** - * Provides protection against environmental damage - */ -@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, Translatable { - public abstract net.kyori.adventure.text.@NotNull Component displayName(int level); - // Paper end - -+ // Paper start - mark translation key as deprecated -+ /** -+ * @deprecated this method assumes that the enchantments description -+ * always be a translatable component which is not guaranteed. -+ */ -+ @Override -+ @Deprecated(forRemoval = true) -+ public abstract @NotNull String translationKey(); -+ // Paper end - mark translation key as deprecated -+ - /** - * Gets the Enchantment at the specified key - * -diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -@@ -0,0 +0,0 @@ public abstract class EnchantmentWrapper extends Enchantment { - public net.kyori.adventure.text.Component displayName(int level) { - return getEnchantment().displayName(level); - } -+ -+ @Override -+ public @NotNull String translationKey() { -+ return getEnchantment().translationKey(); -+ } - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/EntityType.java -+++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Contract; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - --public enum EntityType implements Keyed, Translatable { -+public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable - - // These strings MUST match the strings in nms.EntityTypes and are case sensitive. - /** -@@ -0,0 +0,0 @@ public enum EntityType implements Keyed, Translatable { - - @Override - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public String getTranslationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); - } - -+ // Paper start -+ /** -+ * @throws IllegalArgumentException if the entity does not have a translation key (is probably a custom entity) -+ */ -+ @Override -+ public @NotNull String translationKey() { -+ Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys"); -+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); -+ } -+ // Paper end -+ - /** - * Gets if this EntityType is enabled by feature in a world. - * -diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Villager.java -+++ b/src/main/java/org/bukkit/entity/Villager.java -@@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager { - * Represents the various different Villager professions there may be. - * Villagers have different trading options depending on their profession, - */ -- interface Profession extends OldEnum, Keyed { -+ interface Profession extends OldEnum, Keyed, net.kyori.adventure.translation.Translatable { - - Profession NONE = getProfession("none"); - /** -@@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager { - static Profession[] values() { - return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]); - } -+ -+ // Paper start -+ @Override -+ default @NotNull String translationKey() { -+ return "entity.minecraft.villager." + this.getKey().getKey(); -+ } -+ // Paper end - } - - // Paper start - Add villager reputation API -diff --git a/src/main/java/org/bukkit/inventory/CreativeCategory.java b/src/main/java/org/bukkit/inventory/CreativeCategory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/CreativeCategory.java -+++ b/src/main/java/org/bukkit/inventory/CreativeCategory.java -@@ -0,0 +0,0 @@ package org.bukkit.inventory; - /** - * Represents a category in the creative inventory. - */ --public enum CreativeCategory { -+public enum CreativeCategory implements net.kyori.adventure.translation.Translatable { // Paper - - /** - * An assortment of building blocks including dirt, bricks, planks, ores - * slabs, etc. - */ -- BUILDING_BLOCKS, -+ BUILDING_BLOCKS("buildingBlocks"), // Paper - /** - * Blocks and items typically used for decorative purposes including - * candles, saplings, flora, fauna, fences, walls, carpets, etc. - */ -- DECORATIONS, -+ DECORATIONS("decorations"), // Paper - /** - * Blocks used and associated with redstone contraptions including buttons, - * levers, pressure plates, redstone components, pistons, etc. - */ -- REDSTONE, -+ REDSTONE("redstone"), // Paper - /** - * Items pertaining to transportation including minecarts, rails, boats, - * elytra, etc. - */ -- TRANSPORTATION, -+ TRANSPORTATION("transportation"), // Paper - /** - * Miscellaneous items and blocks that do not fit into other categories - * including gems, dyes, spawn eggs, discs, banner patterns, etc. - */ -- MISC, -+ MISC("misc"), // Paper - /** - * Food items consumable by the player including meats, berries, edible - * drops from creatures, etc. - */ -- FOOD, -+ FOOD("food"), // Paper - /** - * Equipment items meant for general utility including pickaxes, axes, hoes, - * flint and steel, and useful enchantment books for said tools. - */ -- TOOLS, -+ TOOLS("tools"), // Paper - /** - * Equipment items meant for combat including armor, swords, bows, tipped - * arrows, and useful enchantment books for said equipment. - */ -- COMBAT, -+ COMBAT("combat"), // Paper - /** - * All items related to brewing and potions including all types of potions, - * their variants, and ingredients to brew them. - */ -- BREWING; -+ BREWING("brewing"); // Paper -+ // Paper start -+ private final String translationKey; -+ -+ CreativeCategory(String translationKey) { -+ this.translationKey = "itemGroup." + translationKey; -+ } -+ -+ @Override -+ public @org.jetbrains.annotations.NotNull String translationKey() { -+ return this.translationKey; -+ } -+ // Paper end -+ - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * use this class to encapsulate Materials for which {@link Material#isItem()} - * returns false. - */ --public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource { // Paper -+public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource, net.kyori.adventure.translation.Translatable { // Paper - private Material type = Material.AIR; - private int amount = 0; - private MaterialData data = null; -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - - @Override - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public String getTranslationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); - } -@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - ItemMeta itemMeta = getItemMeta(); - return itemMeta != null && itemMeta.hasItemFlag(flag); - } -+ -+ /** -+ * {@inheritDoc} -+ *

    -+ * This is not the same as getting the translation key -+ * for the material of this itemstack. -+ */ -+ @Override -+ public @NotNull String translationKey() { -+ return Bukkit.getUnsafe().getTranslationKey(this); -+ } - // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/ItemType.java -+++ b/src/main/java/org/bukkit/inventory/ItemType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * changes may occur. Do not use this API in plugins. - */ - @ApiStatus.Internal --public interface ItemType extends Keyed, Translatable { -+public interface ItemType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add Translatable - - /** - * Typed represents a subtype of {@link ItemType}s that have a known item meta type -@@ -0,0 +0,0 @@ public interface ItemType extends Keyed, Translatable { - @Nullable - @Deprecated(since = "1.20.6") - Material asMaterial(); -+ -+ // Paper start - add Translatable -+ /** -+ * @deprecated use {@link #translationKey()} and {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Override -+ @NotNull String getTranslationKey(); -+ // Paper end - add Translatable - } diff --git a/patches/api/Add-missing-InventoryType.patch b/patches/api/Add-missing-InventoryType.patch deleted file mode 100644 index 917c7b26c9..0000000000 --- a/patches/api/Add-missing-InventoryType.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 27 Dec 2023 16:46:13 -0800 -Subject: [PATCH] Add missing InventoryType - -Upstream did not add a DECORATED_POT inventory type - -diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryType.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java -@@ -0,0 +0,0 @@ public enum InventoryType { - * Pseudo jukebox inventory with 1 slot of undefined type. - */ - JUKEBOX(1, "Jukebox", null, false), -+ // Paper start - add missing type -+ /** -+ * Pseudo decorated pot with 1 slot of undefined type. -+ */ -+ DECORATED_POT(1, "Decorated Pot", null, false), -+ // Paper end - add missing type - /** - * A crafter inventory, with 9 CRAFTING slots. - */ diff --git a/patches/api/Add-missing-block-data-API.patch b/patches/api/Add-missing-block-data-API.patch deleted file mode 100644 index ad2efad665..0000000000 --- a/patches/api/Add-missing-block-data-API.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 16 Oct 2021 22:57:10 -0700 -Subject: [PATCH] Add missing block data API - -General purpose patch adding missing getters/setters to BlockData and -its child types. - -Co-authored-by: SoSeDiK -Co-authored-by: Fabrizio La Rosa - -diff --git a/src/main/java/org/bukkit/block/data/Levelled.java b/src/main/java/org/bukkit/block/data/Levelled.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/Levelled.java -+++ b/src/main/java/org/bukkit/block/data/Levelled.java -@@ -0,0 +0,0 @@ public interface Levelled extends BlockData { - * @return the maximum 'level' value - */ - int getMaximumLevel(); -+ -+ // Paper start -+ /** -+ * Gets the minimum allowed value of the 'level' property. -+ * -+ * @return the minimum 'level' value -+ */ -+ int getMinimumLevel(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/data/type/Bed.java b/src/main/java/org/bukkit/block/data/type/Bed.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/type/Bed.java -+++ b/src/main/java/org/bukkit/block/data/type/Bed.java -@@ -0,0 +0,0 @@ public interface Bed extends Directional { - */ - boolean isOccupied(); - -+ // Paper start -+ /** -+ * Sets the value of the 'occupied' property. -+ * -+ * @param occupied the new 'occupied' value -+ */ -+ void setOccupied(boolean occupied); -+ // Paper end -+ - /** - * Horizontal half of a bed. - */ -diff --git a/src/main/java/org/bukkit/block/data/type/Candle.java b/src/main/java/org/bukkit/block/data/type/Candle.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/type/Candle.java -+++ b/src/main/java/org/bukkit/block/data/type/Candle.java -@@ -0,0 +0,0 @@ public interface Candle extends Lightable, Waterlogged { - * @return the maximum 'candles' value - */ - int getMaximumCandles(); -+ -+ // Paper start -+ /** -+ * Gets the minimum allowed value of the 'candles' property. -+ * -+ * @return the minimum 'candles' value -+ */ -+ int getMinimumCandles(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/data/type/DecoratedPot.java b/src/main/java/org/bukkit/block/data/type/DecoratedPot.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/type/DecoratedPot.java -+++ b/src/main/java/org/bukkit/block/data/type/DecoratedPot.java -@@ -0,0 +0,0 @@ import org.bukkit.block.data.Directional; - import org.bukkit.block.data.Waterlogged; - - public interface DecoratedPot extends Directional, Waterlogged { -+ // Paper start - add missing block data api -+ /** -+ * @return whether the pot is cracked -+ */ -+ public boolean isCracked(); -+ -+ /** -+ * Set whether the pot is cracked. -+ * -+ * @param cracked whether the pot is cracked -+ */ -+ public void setCracked(boolean cracked); -+ // Paper end - add missing block data api - } -diff --git a/src/main/java/org/bukkit/block/data/type/Leaves.java b/src/main/java/org/bukkit/block/data/type/Leaves.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/type/Leaves.java -+++ b/src/main/java/org/bukkit/block/data/type/Leaves.java -@@ -0,0 +0,0 @@ public interface Leaves extends Waterlogged { - * @param distance the new 'distance' value - */ - void setDistance(int distance); -+ -+ // Paper start -+ /** -+ * Gets the maximum allowed value of the 'distance' property. -+ * -+ * @return the maximum 'distance' value -+ */ -+ int getMaximumDistance(); -+ -+ /** -+ * Gets the minimum allowed value of the 'distance' property. -+ * -+ * @return the minimum 'distance' value -+ */ -+ int getMinimumDistance(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/data/type/PinkPetals.java b/src/main/java/org/bukkit/block/data/type/PinkPetals.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/data/type/PinkPetals.java -+++ b/src/main/java/org/bukkit/block/data/type/PinkPetals.java -@@ -0,0 +0,0 @@ public interface PinkPetals extends Directional { - */ - void setFlowerAmount(int flower_amount); - -+ // Paper start -+ /** -+ * Gets the minimum allowed value of the 'flower_amount' property. -+ * -+ * @return the minimum 'flower_amount' value -+ */ -+ int getMinimumFlowerAmount(); -+ // Paper end -+ - /** - * Gets the maximum allowed value of the 'flower_amount' property. - * diff --git a/patches/api/Add-missing-effects.patch b/patches/api/Add-missing-effects.patch deleted file mode 100644 index 9cf98fc7b7..0000000000 --- a/patches/api/Add-missing-effects.patch +++ /dev/null @@ -1,288 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ivan Pekov -Date: Tue, 5 Jan 2021 10:19:11 +0200 -Subject: [PATCH] Add missing effects - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Effect.java -+++ b/src/main/java/org/bukkit/Effect.java -@@ -0,0 +0,0 @@ public enum Effect { - */ - EXTINGUISH(1009, Type.SOUND), - /** -- * A song from a record. Needs the record item ID as additional info -+ * A song from a record. Needs the record {@link Material} as additional info. - */ - RECORD_PLAY(1010, Type.SOUND, Material.class), - /** -@@ -0,0 +0,0 @@ public enum Effect { - */ - ZOMBIE_DESTROY_DOOR(1021, Type.SOUND), - /** -- * A visual smoke effect. Needs direction as additional info. -+ * A visual smoke effect. Needs a {@link BlockFace} direction as additional info. - */ - SMOKE(2000, Type.VISUAL, BlockFace.class), - /** -- * Sound of a block breaking. Needs block ID as additional info. -+ * Sound of a block breaking. Needs {@link org.bukkit.block.data.BlockData} as additional info. - */ -- STEP_SOUND(2001, Type.SOUND, Material.class), -+ STEP_SOUND(2001, Type.SOUND, org.bukkit.block.data.BlockData.class, Material.class), // Paper - block data is more correct, but the impl of the mtehods will still work with Material - /** -- * Visual effect of a splash potion breaking. Needs potion data value as -+ * Visual effect of a splash potion breaking. Needs {@link Color} data value as - * additional info. - */ - POTION_BREAK(2002, Type.VISUAL, Color.class), - /** -- * Visual effect of an instant splash potion breaking. Needs color data -+ * Visual effect of an instant splash potion breaking. Needs {@link Color} data - * value as additional info. - */ - INSTANT_POTION_BREAK(2007, Type.VISUAL, Color.class), -@@ -0,0 +0,0 @@ public enum Effect { - PORTAL_TRAVEL(1032, Type.SOUND), - /** - * The sound played when launching an endereye -+ * @deprecated No longer exists - */ -+ @Deprecated(forRemoval = true, since = "1.21") // Paper - ENDEREYE_LAUNCH(1003, Type.SOUND), - /** - * The sound played when launching a firework -@@ -0,0 +0,0 @@ public enum Effect { - /** - * Particles displayed when a villager grows a plant, data - * is the number of particles -+ * @deprecated partially replaced by {@link #BEE_GROWTH} - */ -+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper - VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class), - /** - * The sound/particles used by the enderdragon's breath -@@ -0,0 +0,0 @@ public enum Effect { - * The particles shown when a lightning hits a lightning rod or oxidized - * copper. - * -- * Data is the axis at which the particle should be shown. If no data is -+ * Data is the {@link Axis} at which the particle should be shown. If no data is - * provided it will show the particles at the block faces. - */ - ELECTRIC_SPARK(3002, Type.VISUAL, Axis.class), -@@ -0,0 +0,0 @@ public enum Effect { - * block. - */ - OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL), -+ // Paper start - add missing effects -+ /** -+ * The sound of a wither spawning -+ */ -+ WITHER_SPAWNED(1023, Type.SOUND), -+ /** -+ * The sound of an ender dragon dying -+ */ -+ ENDER_DRAGON_DEATH(1028, Type.SOUND), -+ /** -+ * The sound of an ender portal being created in the overworld -+ */ -+ END_PORTAL_CREATED_IN_OVERWORLD(1038, Type.SOUND), -+ -+ SOUND_STOP_JUKEBOX_SONG(1011, Type.SOUND), -+ -+ CRAFTER_CRAFT(1049, Type.SOUND), -+ -+ CRAFTER_FAIL(1050, Type.SOUND), -+ -+ /** -+ * {@link BlockFace} param is the direction to shoot -+ */ -+ SHOOT_WHITE_SMOKE(2010, Type.VISUAL, BlockFace.class), -+ -+ /** -+ * {@link Integer} param is the number of particles -+ */ -+ BEE_GROWTH(2011, Type.VISUAL, Integer.class), -+ -+ /** -+ * {@link Integer} param is the number of particles -+ */ -+ TURTLE_EGG_PLACEMENT(2012, Type.VISUAL, Integer.class), -+ -+ /** -+ * {@link Integer} param is relative to the number of particles -+ */ -+ SMASH_ATTACK(2013, Type.VISUAL, Integer.class), -+ -+ PARTICLES_SCULK_CHARGE(3006, Type.VISUAL, Integer.class), -+ -+ PARTICLES_SCULK_SHRIEK(3007, Type.SOUND), -+ -+ /** -+ * Requires a {@link org.bukkit.block.data.BlockData} param -+ */ -+ PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE(3008, Type.VISUAL, org.bukkit.block.data.BlockData.class), -+ -+ PARTICLES_EGG_CRACK(3009, Type.VISUAL), -+ -+ @Deprecated(forRemoval = true, since = "1.20.5") -+ GUST_DUST(3010, Type.VISUAL), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL, Boolean.class), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ TRIAL_SPAWNER_SPAWN_MOB_AT(3012, Type.VISUAL, Boolean.class), -+ -+ /** -+ * {@link Integer} param is the number of players -+ */ -+ TRIAL_SPAWNER_DETECT_PLAYER(3013, Type.VISUAL, Integer.class), -+ -+ TRIAL_SPAWNER_EJECT_ITEM(3014, Type.VISUAL), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ VAULT_ACTIVATE(3015, Type.VISUAL, Boolean.class), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ VAULT_DEACTIVATE(3016, Type.VISUAL, Boolean.class), -+ -+ VAULT_EJECT_ITEM(3017, Type.VISUAL), -+ -+ SPAWN_COBWEB(3018, Type.VISUAL), -+ -+ /** -+ * {@link Integer} param is the number of players -+ */ -+ TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS(3019, Type.VISUAL, Integer.class), -+ -+ /** -+ * {@link Boolean} param is true for changing to "ominous" -+ */ -+ TRIAL_SPAWNER_BECOME_OMINOUS(3020, Type.VISUAL, Boolean.class), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ TRIAL_SPAWNER_SPAWN_ITEM(3021, Type.VISUAL, Boolean.class), -+ -+ SOUND_WITH_CHARGE_SHOT(1051, Type.SOUND), - ; -+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); -+ // Paper end - - private final int id; - private final Type type; -- private final Class data; -+ private final java.util.List> data; // Paper - support multiple data types - private static final Map BY_ID = Maps.newHashMap(); - - Effect(int id, /*@NotNull*/ Type type) { -- this(id, type, null); -+ this(id, type, (Class[]) null); // Paper - support multiple data types - } - -- Effect(int id, /*@NotNull*/ Type type, /*@Nullable*/ Class data) { -+ Effect(int id, /*@NotNull*/ Type type, /*@Nullable*/ Class...data) { // Paper - support multiple data types - this.id = id; - this.type = type; -- this.data = data; -+ this.data = data != null ? java.util.List.of(data) : null; // Paper - support multiple data types - } - - /** -@@ -0,0 +0,0 @@ public enum Effect { - - /** - * @return The type of the effect. -+ * @deprecated some effects can be both or neither - */ - @NotNull -+ @Deprecated // Paper - both - public Type getType() { - return this.type; - } -@@ -0,0 +0,0 @@ public enum Effect { - */ - @Nullable - public Class getData() { -- return this.data; -+ return this.data == null ? null : this.data.get(0); // Paper -+ } -+ -+ // Paper start - support deprecated data types -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public boolean isApplicable(Object obj) { -+ return this.data != null && com.google.common.collect.Iterables.any(this.data, aClass -> aClass.isAssignableFrom(obj.getClass())); - } -+ // Paper end - support deprecated data types - - /** - * Gets the Effect associated with the given ID. -@@ -0,0 +0,0 @@ public enum Effect { - - static { - for (Effect effect : values()) { -+ if (!isDeprecated(effect)) // Paper - BY_ID.put(effect.id, effect); - } - } - -+ // Paper start -+ private static boolean isDeprecated(Effect effect) { -+ try { -+ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class); -+ } catch (NoSuchFieldException e) { -+ LOGGER.error("Error getting effect enum field {}", effect.name(), e); -+ return false; -+ } -+ } -+ // Paper end -+ - /** - * Represents the type of an effect. -+ * @deprecated not representative of what Effect does - */ -+ @Deprecated // Paper - public enum Type { SOUND, VISUAL } - } -diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/test/java/org/bukkit/EffectTest.java -+++ b/src/test/java/org/bukkit/EffectTest.java -@@ -0,0 +0,0 @@ import static org.hamcrest.CoreMatchers.*; - import org.junit.jupiter.api.Test; - - public class EffectTest { -+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper -+ - @Test - public void getById() { - for (Effect effect : Effect.values()) { -+ if (!isDeprecated(effect)) // Paper - assertThat(Effect.getById(effect.getId()), is(effect)); - } - } -+ -+ // Paper start -+ private static boolean isDeprecated(Effect effect) { -+ try { -+ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class); -+ } catch (NoSuchFieldException e) { -+ LOGGER.error("Error getting effect enum field {}", effect.name(), e); -+ return false; -+ } -+ } -+ // Paper end - } diff --git a/patches/api/Add-missing-fishing-event-state.patch b/patches/api/Add-missing-fishing-event-state.patch deleted file mode 100644 index 4db6a84c8f..0000000000 --- a/patches/api/Add-missing-fishing-event-state.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Wed, 1 May 2024 07:44:50 +0300 -Subject: [PATCH] Add missing fishing event state - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -@@ -0,0 +0,0 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable { - * in. - */ - BITE -+ // Paper start - Add missing fishing event state -+ , -+ /** -+ * Called when a bobber was lured, and is now waiting to be hooked -+ * (when a "fish" starts to swim toward the bobber to bite it). -+ */ -+ LURED, -+ // Paper end - Add missing fishing event state - } - } diff --git a/patches/api/Add-missing-team-sidebar-display-slots.patch b/patches/api/Add-missing-team-sidebar-display-slots.patch deleted file mode 100644 index ec7568d1b0..0000000000 --- a/patches/api/Add-missing-team-sidebar-display-slots.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 1 Oct 2021 08:04:43 -0700 -Subject: [PATCH] Add missing team sidebar display slots - - -diff --git a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java -+++ b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java -@@ -0,0 +0,0 @@ - package org.bukkit.scoreboard; - -+import net.kyori.adventure.text.format.NamedTextColor; // Paper - /** - * Locations for displaying objectives to the player - */ - public enum DisplaySlot { -- BELOW_NAME, -- PLAYER_LIST, -- SIDEBAR, -- SIDEBAR_BLACK, -- SIDEBAR_DARK_BLUE, -- SIDEBAR_DARK_GREEN, -- SIDEBAR_DARK_AQUA, -- SIDEBAR_DARK_RED, -- SIDEBAR_DARK_PURPLE, -- SIDEBAR_GOLD, -- SIDEBAR_GRAY, -- SIDEBAR_DARK_GRAY, -- SIDEBAR_BLUE, -- SIDEBAR_GREEN, -- SIDEBAR_AQUA, -- SIDEBAR_RED, -- SIDEBAR_LIGHT_PURPLE, -- SIDEBAR_YELLOW, -- SIDEBAR_WHITE; -+ // Paper start -+ BELOW_NAME("below_name"), -+ PLAYER_LIST("list"), -+ SIDEBAR("sidebar"), -+ SIDEBAR_TEAM_BLACK(NamedTextColor.BLACK), -+ SIDEBAR_TEAM_DARK_BLUE(NamedTextColor.DARK_BLUE), -+ SIDEBAR_TEAM_DARK_GREEN(NamedTextColor.DARK_GREEN), -+ SIDEBAR_TEAM_DARK_AQUA(NamedTextColor.DARK_AQUA), -+ SIDEBAR_TEAM_DARK_RED(NamedTextColor.DARK_RED), -+ SIDEBAR_TEAM_DARK_PURPLE(NamedTextColor.DARK_PURPLE), -+ SIDEBAR_TEAM_GOLD(NamedTextColor.GOLD), -+ SIDEBAR_TEAM_GRAY(NamedTextColor.GRAY), -+ SIDEBAR_TEAM_DARK_GRAY(NamedTextColor.DARK_GRAY), -+ SIDEBAR_TEAM_BLUE(NamedTextColor.BLUE), -+ SIDEBAR_TEAM_GREEN(NamedTextColor.GREEN), -+ SIDEBAR_TEAM_AQUA(NamedTextColor.AQUA), -+ SIDEBAR_TEAM_RED(NamedTextColor.RED), -+ SIDEBAR_TEAM_LIGHT_PURPLE(NamedTextColor.LIGHT_PURPLE), -+ SIDEBAR_TEAM_YELLOW(NamedTextColor.YELLOW), -+ SIDEBAR_TEAM_WHITE(NamedTextColor.WHITE); -+ -+ public static final net.kyori.adventure.util.Index NAMES = net.kyori.adventure.util.Index.create(DisplaySlot.class, DisplaySlot::getId); -+ -+ private final String id; -+ -+ DisplaySlot(@org.jetbrains.annotations.NotNull String id) { -+ this.id = id; -+ } -+ -+ DisplaySlot(@org.jetbrains.annotations.NotNull NamedTextColor color) { -+ this.id = "sidebar.team." + color; -+ } -+ -+ /** -+ * Get the string id of this display slot. -+ * -+ * @return the string id -+ */ -+ public @org.jetbrains.annotations.NotNull String getId() { -+ return id; -+ } -+ -+ @Override -+ public String toString() { -+ return this.id; -+ } -+ // Paper end - } diff --git a/patches/api/Add-moon-phase-API.patch b/patches/api/Add-moon-phase-API.patch deleted file mode 100644 index a4d9c603be..0000000000 --- a/patches/api/Add-moon-phase-API.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 23 Aug 2020 16:32:03 +0200 -Subject: [PATCH] Add moon phase API - - -diff --git a/src/main/java/io/papermc/paper/world/MoonPhase.java b/src/main/java/io/papermc/paper/world/MoonPhase.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/world/MoonPhase.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.world; -+ -+import java.util.HashMap; -+import java.util.Map; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+public enum MoonPhase { -+ FULL_MOON(0L), -+ WANING_GIBBOUS(1L), -+ LAST_QUARTER(2L), -+ WANING_CRESCENT(3L), -+ NEW_MOON(4L), -+ WAXING_CRESCENT(5L), -+ FIRST_QUARTER(6L), -+ WAXING_GIBBOUS(7L); -+ -+ private final long day; -+ -+ MoonPhase(final long day) { -+ this.day = day; -+ } -+ -+ private static final Map BY_DAY = new HashMap<>(); -+ -+ static { -+ for (final MoonPhase phase : values()) { -+ BY_DAY.put(phase.day, phase); -+ } -+ } -+ -+ public static MoonPhase getPhase(final long day) { -+ return BY_DAY.get(day % 8L); -+ } -+} -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -0,0 +0,0 @@ public interface RegionAccessor { - */ - @NotNull - public T addEntity(@NotNull T entity); -+ -+ // Paper start -+ /** -+ * @return the current moon phase at the current time in the world -+ */ -+ @NotNull -+ io.papermc.paper.world.MoonPhase getMoonPhase(); -+ // Paper end - } diff --git a/patches/api/Add-more-Campfire-API.patch b/patches/api/Add-more-Campfire-API.patch deleted file mode 100644 index 9306a8e7b5..0000000000 --- a/patches/api/Add-more-Campfire-API.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: LemonCaramel -Date: Fri, 16 Jul 2021 00:38:52 +0900 -Subject: [PATCH] Add more Campfire API - - -diff --git a/src/main/java/org/bukkit/block/Campfire.java b/src/main/java/org/bukkit/block/Campfire.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Campfire.java -+++ b/src/main/java/org/bukkit/block/Campfire.java -@@ -0,0 +0,0 @@ public interface Campfire extends TileState { - * @param cookTimeTotal Cook time total - */ - void setCookTimeTotal(int index, int cookTimeTotal); -+ -+ // Paper start -+ /** -+ * Disable cooking in all slots. -+ */ -+ void stopCooking(); -+ -+ /** -+ * Re-enable cooking in all slots. -+ */ -+ void startCooking(); -+ -+ /** -+ * Disable cooking in the specified slot index. -+ * -+ * @param index item slot index -+ * @return whether the slot had cooking enabled before this call -+ */ -+ boolean stopCooking(int index); -+ -+ /** -+ * Re-enable cooking in the specified slot index. -+ * -+ * @param index item slot index -+ * @return whether the slot couldn't cook before this call -+ */ -+ boolean startCooking(int index); -+ -+ /** -+ * State of slot index. -+ * -+ * @param index item slot index -+ * @return {@code true} if the specified slot index cannot cook -+ */ -+ boolean isCookingDisabled(int index); -+ // Paper end - } diff --git a/patches/api/Add-more-Evoker-API.patch b/patches/api/Add-more-Evoker-API.patch deleted file mode 100644 index e7edffa835..0000000000 --- a/patches/api/Add-more-Evoker-API.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 23 Aug 2020 15:22:44 +0200 -Subject: [PATCH] Add more Evoker API - - -diff --git a/src/main/java/org/bukkit/entity/Evoker.java b/src/main/java/org/bukkit/entity/Evoker.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Evoker.java -+++ b/src/main/java/org/bukkit/entity/Evoker.java -@@ -0,0 +0,0 @@ public interface Evoker extends Spellcaster { - */ - @Deprecated(since = "1.11.2") - void setCurrentSpell(@Nullable Spell spell); -+ -+ // Paper start -+ /** -+ * @return the sheep being targeted by the {@link Spell#WOLOLO wololo spell}, or {@code null} if none -+ */ -+ @Nullable -+ Sheep getWololoTarget(); -+ -+ /** -+ * Set the sheep to be the target of the {@link Spell#WOLOLO wololo spell}, or {@code null} to clear. -+ * -+ * @param sheep new wololo target -+ */ -+ void setWololoTarget(@Nullable Sheep sheep); -+ // Paper end - } diff --git a/patches/api/Add-more-LimitedRegion-API.patch b/patches/api/Add-more-LimitedRegion-API.patch deleted file mode 100644 index ee47d82652..0000000000 --- a/patches/api/Add-more-LimitedRegion-API.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dfsek -Date: Sat, 19 Jun 2021 20:15:29 -0700 -Subject: [PATCH] Add more LimitedRegion API - - -diff --git a/src/main/java/org/bukkit/generator/LimitedRegion.java b/src/main/java/org/bukkit/generator/LimitedRegion.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/generator/LimitedRegion.java -+++ b/src/main/java/org/bukkit/generator/LimitedRegion.java -@@ -0,0 +0,0 @@ import java.util.List; - import org.bukkit.Location; - import org.bukkit.RegionAccessor; - import org.bukkit.block.BlockState; -+// Paper start -+import org.bukkit.World; -+import org.bukkit.block.BlockState; -+import org.bukkit.block.data.BlockData; -+import org.bukkit.util.Vector; -+// Paper end - import org.jetbrains.annotations.NotNull; - - /** -@@ -0,0 +0,0 @@ public interface LimitedRegion extends RegionAccessor { - */ - @NotNull - List getTileEntities(); -+ -+ -+ // Paper start -+ /** -+ * Sets the block at a vector location to the provided {@link BlockData}. -+ * -+ * @param vector {@link Vector} representing the position of the block to set. -+ * @param data {@link BlockData} to set the block at the provided coordinates to. -+ */ -+ default void setBlockData(@NotNull Vector vector, @NotNull BlockData data) { -+ setBlockData(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), data); -+ } -+ -+ /** -+ * Sets the {@link BlockState} at a location. -+ * -+ * @param x X coordinate. -+ * @param y Y coordinate. -+ * @param z Z coordinate. -+ * @param state The block state. -+ */ -+ void setBlockState(int x, int y, int z, @NotNull BlockState state); -+ -+ /** -+ * Sets the {@link BlockState} at a location. -+ * -+ * @param location Location to set block state. -+ * @param state The block state. -+ */ -+ default void setBlockState(@NotNull Vector location, @NotNull BlockState state) { -+ setBlockState(location.getBlockX(), location.getBlockY(), location.getBlockZ(), state); -+ } -+ -+ /** -+ * Gets the {@link BlockState} at a location. -+ * -+ * @param location Location to get block state from. -+ * @return The block state. -+ */ -+ @NotNull -+ default BlockState getBlockState(@NotNull Vector location) { -+ return getBlockState(location.getBlockX(), location.getBlockY(), location.getBlockZ()); -+ } -+ -+ /** -+ * Schedules a block update at (x, y, z). -+ * -+ * @param x X coordinate -+ * @param y Y coordinate -+ * @param z Z coordinate -+ */ -+ void scheduleBlockUpdate(int x, int y, int z); -+ -+ /** -+ * Schedules a block update at a vector location. -+ * -+ * @param location {@link Vector} representing the position of the block to update. -+ */ -+ default void scheduleBlockUpdate(@NotNull Vector location) { -+ scheduleBlockUpdate(location.getBlockX(), location.getBlockY(), location.getBlockZ()); -+ } -+ -+ /** -+ * Schedules a fluid update at (x, y, z). -+ * -+ * @param x X coordinate -+ * @param y Y coordinate -+ * @param z Z coordinate -+ */ -+ void scheduleFluidUpdate(int x, int y, int z); -+ -+ /** -+ * Schedules a fluid update at a vector location. -+ * -+ * @param location {@link Vector} representing the position of the block to update. -+ */ -+ default void scheduleFluidUpdate(@NotNull Vector location) { -+ scheduleFluidUpdate(location.getBlockX(), location.getBlockY(), location.getBlockZ()); -+ } -+ -+ /** -+ * Gets the {@link World} object this region represents. -+ *

    -+ * Do not attempt to read from/write to this world! Doing so during generation will cause a deadlock! -+ * -+ * @return The {@link World} object that this region represents. -+ */ -+ @NotNull -+ World getWorld(); -+ -+ /** -+ * Gets the {@link BlockData} of the block at the provided coordinates. -+ * -+ * @param vector {@link Vector} representing the position of the block to get. -+ * @return {@link BlockData} at the coordinates -+ */ -+ @NotNull -+ default BlockData getBlockData(@NotNull Vector vector) { -+ return getBlockData(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); -+ } -+ -+ /** -+ * Gets the X-coordinate of the chunk in the center of the region. -+ * -+ * @return The center chunk's X coordinate. -+ */ -+ int getCenterChunkX(); -+ -+ /** -+ * Gets the X-coordinate of the block in the center of the region. -+ * -+ * @return The center chunk's X coordinate. -+ */ -+ default int getCenterBlockX() { -+ return getCenterChunkX() << 4; -+ } -+ -+ /** -+ * Gets the Z-coordinate of the chunk in the center of the region. -+ * -+ * @return The center chunk's Z coordinate. -+ */ -+ int getCenterChunkZ(); -+ -+ /** -+ * Gets the Z-coordinate of the block in the center of the region. -+ * -+ * @return The center chunk's Z coordinate. -+ */ -+ default int getCenterBlockZ() { -+ return getCenterChunkZ() << 4; -+ } -+ // Paper end - } diff --git a/patches/api/Add-more-WanderingTrader-API.patch b/patches/api/Add-more-WanderingTrader-API.patch deleted file mode 100644 index 7a7ad059ec..0000000000 --- a/patches/api/Add-more-WanderingTrader-API.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: HexedHero <6012891+HexedHero@users.noreply.github.com> -Date: Thu, 6 May 2021 14:56:26 +0100 -Subject: [PATCH] Add more WanderingTrader API - - -diff --git a/src/main/java/org/bukkit/entity/WanderingTrader.java b/src/main/java/org/bukkit/entity/WanderingTrader.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/WanderingTrader.java -+++ b/src/main/java/org/bukkit/entity/WanderingTrader.java -@@ -0,0 +0,0 @@ public interface WanderingTrader extends AbstractVillager { - * {@link WanderingTrader} is forcibly despawned - */ - public void setDespawnDelay(int despawnDelay); -+ -+ // Paper start - Add more WanderingTrader API -+ /** -+ * Set if the Wandering Trader can and will drink an invisibility potion. -+ * @param bool whether the mob will drink -+ */ -+ public void setCanDrinkPotion(boolean bool); -+ -+ /** -+ * Get if the Wandering Trader can and will drink an invisibility potion. -+ * @return whether the mob will drink -+ */ -+ public boolean canDrinkPotion(); -+ -+ /** -+ * Set if the Wandering Trader can and will drink milk. -+ * @param bool whether the mob will drink -+ */ -+ public void setCanDrinkMilk(boolean bool); -+ -+ /** -+ * Get if the Wandering Trader can and will drink milk. -+ * @return whether the mob will drink -+ */ -+ public boolean canDrinkMilk(); -+ // Paper end - } diff --git a/patches/api/Add-more-Witch-API.patch b/patches/api/Add-more-Witch-API.patch deleted file mode 100644 index 30caec73a6..0000000000 --- a/patches/api/Add-more-Witch-API.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 12 Oct 2018 03:47:26 -0500 -Subject: [PATCH] Add more Witch API - - -diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Witch.java -+++ b/src/main/java/org/bukkit/entity/Witch.java -@@ -0,0 +0,0 @@ package org.bukkit.entity; - - import com.destroystokyo.paper.entity.RangedEntity; - -+// Paper start -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.Nullable; -+// Paper end -+ - /** - * Represents a Witch - */ -@@ -0,0 +0,0 @@ public interface Witch extends Raider, RangedEntity { // Paper - * @return whether the witch is drinking a potion - */ - boolean isDrinkingPotion(); -+ -+ // Paper start -+ /** -+ * Get time remaining (in ticks) the Witch is drinking a potion -+ * -+ * @return Time remaining (in ticks) -+ */ -+ int getPotionUseTimeLeft(); -+ -+ /** -+ * Set time remaining (in ticks) that the Witch is drinking a potion. -+ *

    -+ * This only has an effect while the Witch is drinking a potion. -+ * -+ * @param ticks Time in ticks remaining -+ * @see #isDrinkingPotion -+ */ -+ void setPotionUseTimeLeft(int ticks); -+ -+ /** -+ * Get the potion the Witch is drinking -+ * -+ * @return The potion the witch is drinking -+ */ -+ @org.jetbrains.annotations.NotNull -+ ItemStack getDrinkingPotion(); -+ -+ /** -+ * Set the potion the Witch should drink -+ * -+ * @param potion Potion to drink -+ */ -+ void setDrinkingPotion(@Nullable ItemStack potion); -+ // Paper end - } diff --git a/patches/api/Add-more-Zombie-API.patch b/patches/api/Add-more-Zombie-API.patch deleted file mode 100644 index 6037d91a68..0000000000 --- a/patches/api/Add-more-Zombie-API.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 7 Oct 2018 04:29:51 -0500 -Subject: [PATCH] Add more Zombie API - - -diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Zombie.java -+++ b/src/main/java/org/bukkit/entity/Zombie.java -@@ -0,0 +0,0 @@ public interface Zombie extends Monster, Ageable { - * @param flag Whether this zombie can break doors - */ - void setCanBreakDoors(boolean flag); -+ -+ // Paper start -+ /** -+ * Check if zombie is drowning -+ * -+ * @return True if zombie conversion process has begun -+ */ -+ boolean isDrowning(); -+ -+ /** -+ * Make zombie start drowning -+ * -+ * @param drownedConversionTime Amount of time until zombie converts from drowning -+ * -+ * @deprecated See {@link #setConversionTime(int)} -+ */ -+ @Deprecated -+ void startDrowning(int drownedConversionTime); -+ -+ /** -+ * Stop a zombie from starting the drowning conversion process -+ */ -+ void stopDrowning(); -+ -+ /** -+ * Set if zombie has its arms raised -+ * -+ * @param raised True to raise arms -+ * @deprecated use {{@link #setAggressive(boolean)}} -+ */ -+ @Deprecated -+ void setArmsRaised(boolean raised); -+ -+ /** -+ * Check if zombie has arms raised -+ * -+ * @return True if arms are raised -+ * @deprecated use {@link #isAggressive()} -+ */ -+ @Deprecated -+ boolean isArmsRaised(); -+ -+ /** -+ * Check if this zombie will burn in the sunlight -+ * -+ * @return True if zombie will burn in sunlight -+ */ -+ boolean shouldBurnInDay(); -+ -+ /** -+ * Set if this zombie should burn in the sunlight -+ * -+ * @param shouldBurnInDay True to burn in sunlight -+ */ -+ void setShouldBurnInDay(boolean shouldBurnInDay); -+ // Paper end - } diff --git a/patches/api/Add-more-advancement-API.patch b/patches/api/Add-more-advancement-API.patch deleted file mode 100644 index addad8cd42..0000000000 --- a/patches/api/Add-more-advancement-API.patch +++ /dev/null @@ -1,264 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: syldium -Date: Fri, 9 Jul 2021 18:49:40 +0200 -Subject: [PATCH] Add more advancement API - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.advancement; -+ -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.format.NamedTextColor; -+import net.kyori.adventure.text.format.TextColor; -+import net.kyori.adventure.translation.Translatable; -+import net.kyori.adventure.util.Index; -+import org.bukkit.NamespacedKey; -+import org.bukkit.inventory.ItemStack; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Describes the display of an advancement. -+ *

    -+ * The display is used in the chat, in the toast messages and the advancements -+ * screen. -+ */ -+@NullMarked -+public interface AdvancementDisplay { -+ -+ /** -+ * Gets the {@link Frame}. -+ *

    -+ * This defines the appearance of the tile in the advancements screen and -+ * the text when it's completed. -+ * -+ * @return the frame type -+ */ -+ Frame frame(); -+ -+ /** -+ * Gets the advancement title. -+ * -+ * @return the title -+ */ -+ Component title(); -+ -+ /** -+ * Gets the description. -+ * -+ * @return the description -+ */ -+ Component description(); -+ -+ /** -+ * Gets the icon shown in the frame in the advancements screen. -+ * -+ * @return a copy of the icon -+ */ -+ ItemStack icon(); -+ -+ /** -+ * Gets whether a toast should be displayed. -+ *

    -+ * A toast is a notification that will be displayed in the top right corner -+ * of the screen. -+ * -+ * @return {@code true} if a toast should be shown -+ */ -+ boolean doesShowToast(); -+ -+ /** -+ * Gets whether a message should be sent in the chat. -+ * -+ * @return {@code true} if a message should be sent -+ * @see org.bukkit.event.player.PlayerAdvancementDoneEvent#message() to edit -+ * the message -+ */ -+ boolean doesAnnounceToChat(); -+ -+ /** -+ * Gets whether this advancement is hidden. -+ *

    -+ * Hidden advancements cannot be viewed by the player until they have been -+ * unlocked. -+ * -+ * @return {@code true} if hidden -+ */ -+ boolean isHidden(); -+ -+ /** -+ * Gets the texture displayed behind the advancement tree when selected. -+ *

    -+ * This only affects root advancements without any parent. If the background -+ * is not specified or doesn't exist, the tab background will be the missing -+ * texture. -+ * -+ * @return the background texture path -+ */ -+ @Nullable NamespacedKey backgroundPath(); -+ -+ /** -+ * Gets the formatted display name for this display. This -+ * is a part of the component that would be shown in chat when a player -+ * completes the advancement. -+ * -+ * @return the display name -+ * @see org.bukkit.advancement.Advancement#displayName() -+ */ -+ Component displayName(); -+ -+ /** -+ * Defines how the {@link #icon()} appears in the advancements screen and -+ * the color used with the {@link #title() advancement name}. -+ */ -+ enum Frame implements Translatable { -+ -+ /** -+ * "Challenge complete" advancement. -+ *

    -+ * The client will play the {@code ui.toast.challenge_complete} sound -+ * when the challenge is completed and the toast is shown. -+ */ -+ CHALLENGE("challenge", NamedTextColor.DARK_PURPLE), -+ -+ /** -+ * "Goal reached" advancement. -+ */ -+ GOAL("goal", NamedTextColor.GREEN), -+ -+ /** -+ * "Advancement made" advancement. -+ */ -+ TASK("task", NamedTextColor.GREEN); -+ -+ /** -+ * The name map. -+ */ -+ public static final Index NAMES = Index.create(Frame.class, frame -> frame.name); -+ private final String name; -+ private final TextColor color; -+ -+ Frame(final String name, final TextColor color) { -+ this.name = name; -+ this.color = color; -+ } -+ -+ /** -+ * Gets the {@link TextColor} used for the advancement name. -+ * -+ * @return the text color -+ */ -+ public TextColor color() { -+ return this.color; -+ } -+ -+ /** -+ * Gets the translation key used when an advancement is completed. -+ *

    -+ * This is the first line of the toast displayed by the client. -+ * -+ * @return the toast message key -+ */ -+ @Override -+ public String translationKey() { -+ return "advancements.toast." + this.name; -+ } -+ } -+} -diff --git a/src/main/java/org/bukkit/advancement/Advancement.java b/src/main/java/org/bukkit/advancement/Advancement.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/advancement/Advancement.java -+++ b/src/main/java/org/bukkit/advancement/Advancement.java -@@ -0,0 +0,0 @@ public interface Advancement extends Keyed { - @NotNull - AdvancementRequirements getRequirements(); - -+ // Paper start - /** -- * Returns the display information for this advancement. -+ * Get the display info of this advancement. -+ *

    -+ * Will be {@code null} when totally hidden, for example with crafting -+ * recipes. - * -- * This includes it's name, description and other visible tags. -+ * @return the display info -+ */ -+ @Nullable -+ io.papermc.paper.advancement.AdvancementDisplay getDisplay(); -+ -+ /** -+ * Gets the formatted display name for this display. This -+ * is part of the component that would be shown in chat when a player -+ * completes the advancement. Will return the same as -+ * {@link io.papermc.paper.advancement.AdvancementDisplay#displayName()} when an -+ * {@link io.papermc.paper.advancement.AdvancementDisplay} is present. - * -- * @return a AdvancementDisplay object, or null if not set. -+ * @return the display name -+ * @see io.papermc.paper.advancement.AdvancementDisplay#displayName() -+ */ -+ @NotNull net.kyori.adventure.text.Component displayName(); -+ -+ /** -+ * Gets the parent advancement, if any. -+ * -+ * @return the parent advancement - */ - @Nullable -- AdvancementDisplay getDisplay(); -+ Advancement getParent(); -+ -+ /** -+ * Gets all the direct children advancements. -+ * -+ * @return the children advancements -+ */ -+ @NotNull -+ @org.jetbrains.annotations.Unmodifiable -+ Collection getChildren(); -+ -+ /** -+ * Gets the root advancement of the tree this is located in. -+ * -+ * @return the root advancement -+ */ -+ @NotNull -+ Advancement getRoot(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/advancement/AdvancementDisplay.java b/src/main/java/org/bukkit/advancement/AdvancementDisplay.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/advancement/AdvancementDisplay.java -+++ b/src/main/java/org/bukkit/advancement/AdvancementDisplay.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - - /** - * Holds information about how the advancement is displayed by the game. -+ * -+ * @deprecated use {@link io.papermc.paper.advancement.AdvancementDisplay} - */ -+@Deprecated(forRemoval = true) // Paper - public interface AdvancementDisplay { - - /** -diff --git a/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java b/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java -+++ b/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - * - * This enum contains information about these types and how they are - * represented. -+ * @deprecated use {@link io.papermc.paper.advancement.AdvancementDisplay.Frame} - */ -+@Deprecated(forRemoval = true) - public enum AdvancementDisplayType { - - /** diff --git a/patches/api/Add-more-fields-to-AsyncPreLoginEvent.patch b/patches/api/Add-more-fields-to-AsyncPreLoginEvent.patch deleted file mode 100644 index 80ae69a1f9..0000000000 --- a/patches/api/Add-more-fields-to-AsyncPreLoginEvent.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 18 Mar 2018 11:43:30 -0400 -Subject: [PATCH] Add more fields to AsyncPreLoginEvent - -Co-authored-by: Connor Linfoot -Co-authored-by: MCMDEV - -diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java -+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java -@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event { - private static final HandlerList handlers = new HandlerList(); - private Result result; - private net.kyori.adventure.text.Component message; // Paper -- private final String name; - private final InetAddress ipAddress; -- private final UUID uniqueId; -+ private com.destroystokyo.paper.profile.PlayerProfile profile; // Paper -+ private final InetAddress rawAddress; // Paper -+ private final String hostname; // Paper - private final boolean transferred; - - @Deprecated(since = "1.7.5") -@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event { - } - - public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, boolean transferred) { -+ // Paper start -+ this(name, ipAddress, uniqueId, transferred, org.bukkit.Bukkit.createProfile(uniqueId, name)); -+ } -+ -+ @Deprecated(forRemoval = true) -+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, boolean transferred, @NotNull com.destroystokyo.paper.profile.PlayerProfile profile) { -+ this(name, ipAddress, ipAddress, uniqueId, transferred, profile); -+ } -+ -+ @Deprecated(forRemoval = true) -+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, boolean transferred, @NotNull com.destroystokyo.paper.profile.PlayerProfile profile) { -+ this(name, ipAddress, rawAddress, uniqueId, transferred, profile, ""); -+ } -+ -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, boolean transferred, @NotNull com.destroystokyo.paper.profile.PlayerProfile profile, @NotNull String hostname) { -+ // Paper end - super(true); - this.result = Result.ALLOWED; - this.message = net.kyori.adventure.text.Component.empty(); // Paper -- this.name = name; -+ this.profile = profile; - this.ipAddress = ipAddress; -- this.uniqueId = uniqueId; -+ this.rawAddress = rawAddress; // Paper -+ this.hostname = hostname; // Paper - this.transferred = transferred; - } - -@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event { - */ - @NotNull - public String getName() { -- return name; -+ return profile.getName(); // Paper - } - - /** -@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event { - */ - @NotNull - public UUID getUniqueId() { -- return uniqueId; -+ return profile.getId(); // Paper -+ } -+ -+ // Paper start -+ /** -+ * Gets the PlayerProfile of the player logging in -+ * @return The Profile -+ */ -+ @NotNull -+ public com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile() { -+ return profile; -+ } -+ -+ /** -+ * Changes the PlayerProfile the player will login as -+ * @param profile The profile to use -+ */ -+ public void setPlayerProfile(@NotNull com.destroystokyo.paper.profile.PlayerProfile profile) { -+ this.profile = profile; -+ } -+ -+ /** -+ * Gets the raw address of the player logging in -+ * @return The address -+ */ -+ @NotNull -+ public InetAddress getRawAddress() { -+ return rawAddress; - } - -+ /** -+ * Gets the hostname that the player used to connect to the server, or -+ * blank if unknown -+ * -+ * @return The hostname -+ */ -+ @NotNull -+ public String getHostname() { -+ return hostname; -+ } -+ // Paper end -+ - /** - * Gets if this connection has been transferred from another server. - * diff --git a/patches/api/Add-more-line-of-sight-methods.patch b/patches/api/Add-more-line-of-sight-methods.patch deleted file mode 100644 index 70c1a71016..0000000000 --- a/patches/api/Add-more-line-of-sight-methods.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TwoLeggedCat <80929284+TwoLeggedCat@users.noreply.github.com> -Date: Sat, 29 May 2021 14:33:18 -0500 -Subject: [PATCH] Add more line of sight methods - - -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -0,0 +0,0 @@ public interface RegionAccessor extends Keyed { // Paper - @NotNull - @Override - NamespacedKey getKey(); -+ -+ /** -+ * Tell whether a line of sight exists between the given locations -+ * @param from Location to start at -+ * @param to target Location -+ * @return whether a line of sight exists between {@code from} and {@code to} -+ */ -+ public boolean lineOfSightExists(@NotNull Location from, @NotNull Location to); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - public boolean hasLineOfSight(@NotNull Entity other); - -+ // Paper start -+ /** -+ * Checks whether the living entity has block line of sight to the given block. -+ *

    -+ * This uses the same algorithm that hostile mobs use to find the closest -+ * player. -+ * -+ * @param location the location to determine line of sight to -+ * @return true if there is a line of sight, false if not -+ */ -+ public boolean hasLineOfSight(@NotNull Location location); -+ // Paper end -+ - /** - * Returns if the living entity despawns when away from players or not. - *

    diff --git a/patches/api/Add-more-scoreboard-API.patch b/patches/api/Add-more-scoreboard-API.patch deleted file mode 100644 index 6cbb3fb64b..0000000000 --- a/patches/api/Add-more-scoreboard-API.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 16 Dec 2023 14:45:46 -0800 -Subject: [PATCH] Add more scoreboard API - - -diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/scoreboard/Objective.java -+++ b/src/main/java/org/bukkit/scoreboard/Objective.java -@@ -0,0 +0,0 @@ public interface Objective { - */ - @NotNull Score getScoreFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException, IllegalStateException; - // Paper end - improve scoreboard entries -+ -+ // Paper start - add more score API -+ /** -+ * Gets if this objective will auto update score -+ * displays on changes. -+ * -+ * @return true if auto updating -+ * @throws IllegalStateException if this objective has been unregistered -+ */ -+ boolean willAutoUpdateDisplay(); -+ -+ /** -+ * Sets if this objective will auto update -+ * score displays on changes. -+ * -+ * @param autoUpdateDisplay true to auto update -+ * @throws IllegalStateException if this objective has been unregistered -+ */ -+ void setAutoUpdateDisplay(boolean autoUpdateDisplay); -+ // Paper end - add more score API - } -diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/scoreboard/Score.java -+++ b/src/main/java/org/bukkit/scoreboard/Score.java -@@ -0,0 +0,0 @@ public interface Score { - */ - void resetScore() throws IllegalStateException; - // Paper end -+ -+ // Paper start - add more score API -+ /** -+ * Gets if this score is triggerable and cannot -+ * be used by the {@code /trigger} command executed -+ * by the owner of this score. -+ * -+ * @return true if triggerable, false if not triggerable, score isn't set, or the objective isn't {@link Criteria#TRIGGER} -+ * @throws IllegalStateException if the associated objective has been unregistered -+ */ -+ boolean isTriggerable(); -+ -+ /** -+ * Sets if this score is triggerable and can -+ * be used by the {@code /trigger} command -+ * executed by the owner of this score. Can -+ * only be set on {@link Criteria#TRIGGER} objectives. -+ *

    -+ * If the score doesn't exist (aka {@link #isScoreSet()} returns false), -+ * this will create the score with a 0 value. -+ * -+ * @param triggerable true to enable trigger, false to disable -+ * @throws IllegalArgumentException if this objective isn't {@link Criteria#TRIGGER} -+ * @throws IllegalStateException if the associated objective has been unregistered -+ */ -+ void setTriggerable(boolean triggerable); -+ -+ /** -+ * Get the custom name for this entry. -+ * -+ * @return the custom name or null if not set (or score isn't set) -+ * @throws IllegalStateException if the associated objective has been unregistered -+ */ -+ @Nullable net.kyori.adventure.text.Component customName(); -+ -+ /** -+ * Sets the custom name for this entry. -+ *

    -+ * If the score doesn't exist (aka {@link #isScoreSet()} returns false), -+ * this will create the score with a 0 value. -+ * -+ * @param customName the custom name or null to reset -+ * @throws IllegalStateException if the associated objective has been unregistered -+ */ -+ void customName(net.kyori.adventure.text.@Nullable Component customName); -+ // Paper end - add more score API - } diff --git a/patches/api/Add-openSign-method-to-HumanEntity.patch b/patches/api/Add-openSign-method-to-HumanEntity.patch deleted file mode 100644 index acf78f4390..0000000000 --- a/patches/api/Add-openSign-method-to-HumanEntity.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Sun, 1 Apr 2018 02:28:43 +0300 -Subject: [PATCH] Add openSign method to HumanEntity - - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - */ - @Deprecated(since = "1.12") - public void setShoulderEntityRight(@Nullable Entity entity); -+ // Paper start - Add method to open already placed sign -+ /** -+ * Opens an editor window for the specified sign -+ * -+ * @param sign The sign to open -+ * @deprecated use {@link #openSign(org.bukkit.block.Sign, org.bukkit.block.sign.Side)} -+ */ -+ @Deprecated -+ default void openSign(@NotNull org.bukkit.block.Sign sign) { -+ this.openSign(sign, org.bukkit.block.sign.Side.FRONT); -+ } -+ -+ /** -+ * Opens an editor window for the specified sign -+ * -+ * @param sign The sign to open -+ * @param side The side of the sign to open -+ */ -+ void openSign(org.bukkit.block.@NotNull Sign sign, org.bukkit.block.sign.@NotNull Side side); -+ // Paper end - - /** - * Make the entity drop the item in their hand. -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - /** - * Open a Sign for editing by the Player. - * -- * The Sign must be placed in the same world as the player. -+ * The Sign must be in the same world as the player. - * - * @param sign The sign to edit -+ * @deprecated use {@link #openSign(Sign, Side)} - */ -+ @Deprecated - public void openSign(@NotNull Sign sign); - - /** diff --git a/patches/api/Add-paper-dumplisteners-command.patch b/patches/api/Add-paper-dumplisteners-command.patch deleted file mode 100644 index 0c484672a0..0000000000 --- a/patches/api/Add-paper-dumplisteners-command.patch +++ /dev/null @@ -1,175 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Warrior <50800980+Warriorrrr@users.noreply.github.com> -Date: Sat, 19 Nov 2022 19:46:44 +0100 -Subject: [PATCH] Add /paper dumplisteners command - - -diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/co/aikar/timings/TimedEventExecutor.java -+++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java -@@ -0,0 +0,0 @@ public class TimedEventExecutor implements EventExecutor { - executor.execute(listener, event); - } - } -+ -+ @Override -+ @NotNull -+ public String toString() { -+ return "TimedEventExecutor['" + this.executor.toString() + "']"; -+ } - } -diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java -+++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java -@@ -0,0 +0,0 @@ public class MethodHandleEventExecutor implements EventExecutor { - - private final Class eventClass; - private final MethodHandle handle; -+ private final @Nullable Method method; - - public MethodHandleEventExecutor(final Class eventClass, final MethodHandle handle) { - this.eventClass = eventClass; - this.handle = handle; -+ this.method = null; - } - - public MethodHandleEventExecutor(final Class eventClass, final Method m) { -@@ -0,0 +0,0 @@ public class MethodHandleEventExecutor implements EventExecutor { - } catch (final IllegalAccessException e) { - throw new AssertionError("Unable to set accessible", e); - } -+ this.method = m; - } - - @Override -@@ -0,0 +0,0 @@ public class MethodHandleEventExecutor implements EventExecutor { - SneakyThrow.sneaky(t); - } - } -+ -+ @Override -+ public String toString() { -+ return "MethodHandleEventExecutor['" + this.method + "']"; -+ } - } -diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java -+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java -@@ -0,0 +0,0 @@ public class StaticMethodHandleEventExecutor implements EventExecutor { - - private final Class eventClass; - private final MethodHandle handle; -+ private final Method method; - - public StaticMethodHandleEventExecutor(final Class eventClass, final Method m) { - Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m); -@@ -0,0 +0,0 @@ public class StaticMethodHandleEventExecutor implements EventExecutor { - } catch (final IllegalAccessException e) { - throw new AssertionError("Unable to set accessible", e); - } -+ this.method = m; - } - - @Override -@@ -0,0 +0,0 @@ public class StaticMethodHandleEventExecutor implements EventExecutor { - SneakyThrow.sneaky(throwable); - } - } -+ -+ @Override -+ public String toString() { -+ return "StaticMethodHandleEventExecutor['" + this.method + "']"; -+ } - } -diff --git a/src/main/java/org/bukkit/event/HandlerList.java b/src/main/java/org/bukkit/event/HandlerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/HandlerList.java -+++ b/src/main/java/org/bukkit/event/HandlerList.java -@@ -0,0 +0,0 @@ public class HandlerList { - */ - private static ArrayList allLists = new ArrayList(); - -+ // Paper start -+ /** -+ * Event types which have instantiated a {@link HandlerList}. -+ */ -+ private static final java.util.Set EVENT_TYPES = java.util.concurrent.ConcurrentHashMap.newKeySet(); -+ // Paper end -+ - /** - * Bake all handler lists. Best used just after all normal event - * registration is complete, ie just after all plugins are loaded if -@@ -0,0 +0,0 @@ public class HandlerList { - * The HandlerList is then added to meta-list for use in bakeAll() - */ - public HandlerList() { -+ // Paper start -+ java.lang.StackWalker.getInstance(java.util.EnumSet.of(java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE), 4) -+ .walk(s -> s.filter(f -> Event.class.isAssignableFrom(f.getDeclaringClass())).findFirst()) -+ .map(f -> f.getDeclaringClass().getName()) -+ .ifPresent(EVENT_TYPES::add); -+ // Paper end - handlerslots = new EnumMap>(EventPriority.class); - for (EventPriority o : EventPriority.values()) { - handlerslots.put(o, new ArrayList()); -diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/EventExecutor.java -+++ b/src/main/java/org/bukkit/plugin/EventExecutor.java -@@ -0,0 +0,0 @@ public interface EventExecutor { - try { - EventExecutor asmExecutor = executorClass.newInstance(); - // Define a wrapper to conform to bukkit stupidity (passing in events that don't match and wrapper exception) -- return (listener, event) -> { -- if (!eventClass.isInstance(event)) return; -- asmExecutor.execute(listener, event); -+ return new EventExecutor() { -+ @Override -+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { -+ if (!eventClass.isInstance(event)) return; -+ asmExecutor.execute(listener, event); -+ } -+ -+ @Override -+ @NotNull -+ public String toString() { -+ return "ASMEventExecutor['" + m + "']"; -+ } - }; - } catch (InstantiationException | IllegalAccessException e) { - throw new AssertionError("Unable to initialize generated event executor", e); -diff --git a/src/main/java/org/bukkit/plugin/RegisteredListener.java b/src/main/java/org/bukkit/plugin/RegisteredListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/RegisteredListener.java -+++ b/src/main/java/org/bukkit/plugin/RegisteredListener.java -@@ -0,0 +0,0 @@ public class RegisteredListener { - public boolean isIgnoringCancelled() { - return ignoreCancelled; - } -+ -+ // Paper start -+ /** -+ * Get the executor for this registration. -+ * -+ * @return executor -+ */ -+ @NotNull -+ public EventExecutor getExecutor() { -+ return this.executor; -+ } -+ -+ @Override -+ public String toString() { -+ return "RegisteredListener{" -+ + "plugin=\"" + this.plugin.getName() -+ + "\", listener=\"" + this.listener -+ + "\", executor=\"" + this.executor -+ + "\", priority=\"" + this.priority.name() + " (" + this.priority.getSlot() + ")" -+ + "\", ignoringCancelled=" + this.ignoreCancelled -+ + "}"; -+ } -+ // Paper end - } diff --git a/patches/api/Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/api/Add-playPickupItemAnimation-to-LivingEntity.patch deleted file mode 100644 index 6ba8e78cc6..0000000000 --- a/patches/api/Add-playPickupItemAnimation-to-LivingEntity.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 23 Aug 2020 19:36:08 +0200 -Subject: [PATCH] Add playPickupItemAnimation to LivingEntity - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - void setJumping(boolean jumping); - // Paper end - entity jump API -+ -+ // Paper start - pickup animation API -+ /** -+ * Plays pickup item animation towards this entity. -+ *

    -+ * This will remove the item on the client. -+ *

    -+ * Quantity is inferred to be that of the {@link Item}. -+ * -+ * @param item item to pickup -+ */ -+ default void playPickupItemAnimation(@NotNull Item item) { -+ playPickupItemAnimation(item, item.getItemStack().getAmount()); -+ } -+ -+ /** -+ * Plays pickup item animation towards this entity. -+ *

    -+ * This will remove the item on the client. -+ * -+ * @param item item to pickup -+ * @param quantity quantity of item -+ */ -+ void playPickupItemAnimation(@NotNull Item item, int quantity); -+ // Paper end - pickup animation API - } diff --git a/patches/api/Add-player-idle-duration-API.patch b/patches/api/Add-player-idle-duration-API.patch deleted file mode 100644 index c7f1f61650..0000000000 --- a/patches/api/Add-player-idle-duration-API.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: booky10 -Date: Sat, 14 Oct 2023 03:11:11 +0200 -Subject: [PATCH] Add player idle duration API - -Implements API for getting and resetting a player's idle duration. - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void increaseWardenWarningLevel(); - // Paper end - -+ // Paper start -+ /** -+ * The idle duration is reset when the player -+ * sends specific action packets. -+ *

    -+ * After the idle duration exceeds {@link org.bukkit.Bukkit#getIdleTimeout()}, the -+ * player will be kicked for {@link org.bukkit.event.player.PlayerKickEvent.Cause#IDLING}. -+ * -+ * @return the current idle duration of this player -+ */ -+ @NotNull Duration getIdleDuration(); -+ -+ /** -+ * Resets this player's idle duration. -+ *

    -+ * After the idle duration exceeds {@link org.bukkit.Bukkit#getIdleTimeout()}, the -+ * player will be kicked for {@link org.bukkit.event.player.PlayerKickEvent.Cause#IDLING}. -+ * -+ * @see #getIdleDuration() -+ */ -+ void resetIdleDuration(); -+ // Paper end -+ - @NotNull - @Override - Spigot spigot(); diff --git a/patches/api/Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch b/patches/api/Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch deleted file mode 100644 index ac671fb4f5..0000000000 --- a/patches/api/Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: HexedHero <6012891+HexedHero@users.noreply.github.com> -Date: Sun, 10 Apr 2022 06:21:19 +0100 -Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -@@ -0,0 +0,0 @@ public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private final ItemStack item; - private int damage; -+ private int originalDamage; // Paper - Add pre-reduction damage - private boolean cancelled = false; - -+ @Deprecated // Paper - Add pre-reduction damage - public PlayerItemDamageEvent(@NotNull Player player, @NotNull ItemStack what, int damage) { -+ // Paper start - Add pre-reduction damage -+ this(player, what, damage, damage); -+ } -+ -+ public PlayerItemDamageEvent(@NotNull Player player, @NotNull ItemStack what, int damage, int originalDamage) { - super(player); - this.item = what; - this.damage = damage; -+ this.originalDamage = originalDamage; -+ // Paper end - } - - /** -@@ -0,0 +0,0 @@ public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable { - return damage; - } - -+ // Paper start - Add pre-reduction damage -+ /** -+ * Gets the amount of durability damage this item would have taken before -+ * the Unbreaking reduction. If the item has no Unbreaking level then -+ * this value will be the same as the {@link #getDamage()} value. -+ * -+ * @return pre-reduction damage amount -+ */ -+ public int getOriginalDamage() { -+ return originalDamage; -+ } -+ // Paper end -+ - public void setDamage(int damage) { - this.damage = damage; - } diff --git a/patches/api/Add-predicate-for-blocks-when-raytracing.patch b/patches/api/Add-predicate-for-blocks-when-raytracing.patch deleted file mode 100644 index a3366b99f1..0000000000 --- a/patches/api/Add-predicate-for-blocks-when-raytracing.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TonytheMacaroni -Date: Wed, 6 Sep 2023 19:24:53 -0400 -Subject: [PATCH] Add predicate for blocks when raytracing - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @Nullable - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate filter); - -+ // Paper start -+ /** -+ * Performs a ray trace that checks for entity collisions. -+ *

    -+ * This may not consider entities in currently unloaded chunks. Some -+ * implementations may impose artificial restrictions on the maximum -+ * distance. -+ * -+ * @param start the start position -+ * @param direction the ray direction -+ * @param maxDistance the maximum distance -+ * @param raySize entity bounding boxes will be uniformly expanded (or -+ * shrinked) by this value before doing collision checks -+ * @param filter only entities that fulfill this predicate are considered, -+ * or null to consider all entities -+ * @return the closest ray trace hit result, or null if there -+ * is no hit -+ */ -+ @Nullable RayTraceResult rayTraceEntities(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate filter); -+ // Paper end -+ - /** - * Performs a ray trace that checks for block collisions using the blocks' - * precise collision shapes. -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @Nullable - public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks); - -+ // Paper start -+ /** -+ * Performs a ray trace that checks for block collisions using the blocks' -+ * precise collision shapes. -+ *

    -+ * If collisions with passable blocks are ignored, fluid collisions are -+ * ignored as well regardless of the fluid collision mode. -+ *

    -+ * Portal blocks are only considered passable if the ray starts within -+ * them. Apart from that collisions with portal blocks will be considered -+ * even if collisions with passable blocks are otherwise ignored. -+ *

    -+ * This may cause loading of chunks! Some implementations may impose -+ * artificial restrictions on the maximum distance. -+ * -+ * @param start the start position -+ * @param direction the ray direction -+ * @param maxDistance the maximum distance -+ * @param fluidCollisionMode the fluid collision mode -+ * @param ignorePassableBlocks whether to ignore passable but collidable -+ * blocks (ex. tall grass, signs, fluids, ..) -+ * @param canCollide predicate for blocks the ray can potentially collide -+ * with, or null to consider all blocks -+ * @return the ray trace hit result, or null if there is no hit -+ */ -+ @Nullable RayTraceResult rayTraceBlocks(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, @Nullable Predicate canCollide); -+ // Paper end -+ - /** - * Performs a ray trace that checks for both block and entity collisions. - *

    -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @Nullable - public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate filter); - -+ // Paper start -+ /** -+ * Performs a ray trace that checks for both block and entity collisions. -+ *

    -+ * Block collisions use the blocks' precise collision shapes. The -+ * raySize parameter is only taken into account for entity -+ * collision checks. -+ *

    -+ * If collisions with passable blocks are ignored, fluid collisions are -+ * ignored as well regardless of the fluid collision mode. -+ *

    -+ * Portal blocks are only considered passable if the ray starts within them. -+ * Apart from that collisions with portal blocks will be considered even if -+ * collisions with passable blocks are otherwise ignored. -+ *

    -+ * This may cause loading of chunks! Some implementations may impose -+ * artificial restrictions on the maximum distance. -+ * -+ * @param start the start position -+ * @param direction the ray direction -+ * @param maxDistance the maximum distance -+ * @param fluidCollisionMode the fluid collision mode -+ * @param ignorePassableBlocks whether to ignore passable but collidable -+ * blocks (ex. tall grass, signs, fluids, ..) -+ * @param raySize entity bounding boxes will be uniformly expanded (or -+ * shrinked) by this value before doing collision checks -+ * @param filter only entities that fulfill this predicate are considered, -+ * or null to consider all entities -+ * @param canCollide predicate for blocks the ray can potentially collide -+ * with, or null to consider all blocks -+ * @return the closest ray trace hit result with either a block or an -+ * entity, or null if there is no hit -+ */ -+ @Nullable RayTraceResult rayTrace(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate filter, @Nullable Predicate canCollide); -+ // Paper end -+ - /** - * Gets the default spawn {@link Location} of this world - * diff --git a/patches/api/Add-ray-tracing-methods-to-LivingEntity.patch b/patches/api/Add-ray-tracing-methods-to-LivingEntity.patch deleted file mode 100644 index 6bd2288653..0000000000 --- a/patches/api/Add-ray-tracing-methods-to-LivingEntity.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Mon, 3 Sep 2018 18:13:53 -0500 -Subject: [PATCH] Add ray tracing methods to LivingEntity - - -diff --git a/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java b/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.block; -+ -+import org.bukkit.FluidCollisionMode; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockFace; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents information about a targeted block -+ * @deprecated use {@link org.bukkit.util.RayTraceResult} -+ */ -+@Deprecated(forRemoval = true, since = "1.19.3") -+public class TargetBlockInfo { -+ private final Block block; -+ private final BlockFace blockFace; -+ -+ public TargetBlockInfo(@NotNull Block block, @NotNull BlockFace blockFace) { -+ this.block = block; -+ this.blockFace = blockFace; -+ } -+ -+ /** -+ * Get the block that is targeted -+ * -+ * @return Targeted block -+ */ -+ @NotNull -+ public Block getBlock() { -+ return block; -+ } -+ -+ /** -+ * Get the targeted BlockFace -+ * -+ * @return Targeted blockface -+ */ -+ @NotNull -+ public BlockFace getBlockFace() { -+ return blockFace; -+ } -+ -+ /** -+ * Get the relative Block to the targeted block on the side it is targeted at -+ * -+ * @return Block relative to targeted block -+ */ -+ @NotNull -+ public Block getRelativeBlock() { -+ return block.getRelative(blockFace); -+ } -+ -+ /** -+ * @deprecated use {@link org.bukkit.FluidCollisionMode} -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.3") -+ public enum FluidMode { -+ NEVER(FluidCollisionMode.NEVER), -+ SOURCE_ONLY(FluidCollisionMode.SOURCE_ONLY), -+ ALWAYS(FluidCollisionMode.ALWAYS); -+ -+ public final FluidCollisionMode bukkit; -+ -+ FluidMode(FluidCollisionMode bukkit) { -+ this.bukkit = bukkit; -+ } -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @NotNull - public Block getTargetBlock(@Nullable Set transparent, int maxDistance); - -+ // Paper start -+ /** -+ * Gets the block that the living entity has targeted, ignoring fluids -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return block that the living entity has targeted, -+ * or null if no block is within maxDistance -+ * @deprecated use {@link #getTargetBlockExact(int)} -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.3") -+ @Nullable -+ public default Block getTargetBlock(int maxDistance) { -+ return getTargetBlock(maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode.NEVER); -+ } -+ -+ /** -+ * Gets the block that the living entity has targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param fluidMode whether to check fluids or not -+ * @return block that the living entity has targeted, -+ * or null if no block is within maxDistance -+ * @deprecated use {@link #getTargetBlockExact(int, FluidCollisionMode)} -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.3") -+ @Nullable -+ public Block getTargetBlock(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); -+ -+ /** -+ * Gets the blockface of that block that the living entity has targeted, ignoring fluids -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return blockface of the block that the living entity has targeted, -+ * or null if no block is targeted -+ */ -+ @Nullable -+ public default org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance) { -+ return getTargetBlockFace(maxDistance, org.bukkit.FluidCollisionMode.NEVER); -+ } -+ -+ /** -+ * Gets the blockface of that block that the living entity has targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param fluidMode whether to check fluids or not -+ * @return blockface of the block that the living entity has targeted, -+ * or null if no block is targeted -+ * @deprecated use {@link #getTargetBlockFace(int, FluidCollisionMode)} -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.3") -+ @Nullable -+ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); -+ -+ /** -+ * Gets the blockface of that block that the living entity has targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param fluidMode whether to check fluids or not -+ * @return blockface of the block that the living entity has targeted, -+ * or null if no block is targeted -+ */ -+ @Nullable -+ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, @NotNull FluidCollisionMode fluidMode); -+ -+ /** -+ * Gets information about the block the living entity has targeted, ignoring fluids -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return TargetBlockInfo about the block the living entity has targeted, -+ * or null if no block is targeted -+ * @deprecated use {@link #rayTraceBlocks(double)} -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.3") -+ @Nullable -+ public default com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance) { -+ return getTargetBlockInfo(maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode.NEVER); -+ } -+ -+ /** -+ * Gets information about the block the living entity has targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param fluidMode whether to check fluids or not -+ * @return TargetBlockInfo about the block the living entity has targeted, -+ * or null if no block is targeted -+ * @deprecated use {@link #rayTraceBlocks(double, FluidCollisionMode)} -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.3") -+ @Nullable -+ public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); -+ // Paper end -+ - /** - * Gets the last two blocks along the living entity's line of sight. - *

    diff --git a/patches/api/Add-recipe-to-cook-events.patch b/patches/api/Add-recipe-to-cook-events.patch deleted file mode 100644 index d5e52be1a1..0000000000 --- a/patches/api/Add-recipe-to-cook-events.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> -Date: Wed, 6 Jan 2021 12:05:29 -0800 -Subject: [PATCH] Add recipe to cook events - - -diff --git a/src/main/java/org/bukkit/event/block/BlockCookEvent.java b/src/main/java/org/bukkit/event/block/BlockCookEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/block/BlockCookEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockCookEvent.java -@@ -0,0 +0,0 @@ public class BlockCookEvent extends BlockEvent implements Cancellable { - private final ItemStack source; - private ItemStack result; - private boolean cancelled; -+ private final org.bukkit.inventory.CookingRecipe recipe; // Paper - -+ @Deprecated // Paper - public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result) { -+ // Paper start -+ this(block, source, result, null); -+ } -+ -+ public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe recipe) { -+ // Paper end - super(block); - this.source = source; - this.result = result; - this.cancelled = false; -+ this.recipe = recipe; // Paper - } - - /** -@@ -0,0 +0,0 @@ public class BlockCookEvent extends BlockEvent implements Cancellable { - this.cancelled = cancel; - } - -+ // Paper start -+ /** -+ * Gets the cooking recipe associated with this event. -+ * -+ * @return the recipe -+ */ -+ @org.jetbrains.annotations.Nullable -+ public org.bukkit.inventory.CookingRecipe getRecipe() { -+ return recipe; -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { -diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - */ - public class FurnaceSmeltEvent extends BlockCookEvent { - -+ @Deprecated // Paper - public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result) { - super(furnace, source, result); - } -+ // Paper start -+ public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe recipe) { -+ super(furnace, source, result, recipe); -+ } -+ // Paper end - } diff --git a/patches/api/Add-recipeBrewTime.patch b/patches/api/Add-recipeBrewTime.patch deleted file mode 100644 index 5cffda2afc..0000000000 --- a/patches/api/Add-recipeBrewTime.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tamion <70228790+notTamion@users.noreply.github.com> -Date: Fri, 20 Sep 2024 17:39:22 +0200 -Subject: [PATCH] Add recipeBrewTime - - -diff --git a/src/main/java/org/bukkit/block/BrewingStand.java b/src/main/java/org/bukkit/block/BrewingStand.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/BrewingStand.java -+++ b/src/main/java/org/bukkit/block/BrewingStand.java -@@ -0,0 +0,0 @@ public interface BrewingStand extends Container { - */ - void setBrewingTime(int brewTime); - -+ // Paper start - Add recipeBrewTime -+ /** -+ * Sets the recipe time for the brewing process which is -+ * used to compute the progress of the brewing process with -+ * {@link #getBrewingTime()}. -+ * -+ * @param recipeBrewTime recipe brew time (in ticks) -+ * @throws IllegalArgumentException if the recipe brew time is non-positive -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ void setRecipeBrewTime(@org.jetbrains.annotations.Range(from = 1, to = Integer.MAX_VALUE) int recipeBrewTime); -+ -+ /** -+ * Gets the recipe time for the brewing process which is -+ * used to compute the progress of the brewing process with -+ * {@link #getBrewingTime()}. -+ * -+ * @return recipe brew time (in ticks) -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ @org.jetbrains.annotations.Range(from = 1, to = Integer.MAX_VALUE) int getRecipeBrewTime(); -+ // Paper end - Add recipeBrewTime -+ - /** - * Get the level of current fuel for brewing. - * -diff --git a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -+++ b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -@@ -0,0 +0,0 @@ public class BrewingStartEvent extends InventoryBlockStartEvent { - - // Paper - remove HandlerList - private int brewingTime; -+ private int recipeBrewTime = 400; // Paper - Add recipeBrewTime - -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public BrewingStartEvent(@NotNull final Block furnace, @NotNull ItemStack source, int brewingTime) { - super(furnace, source); - this.brewingTime = brewingTime; -@@ -0,0 +0,0 @@ public class BrewingStartEvent extends InventoryBlockStartEvent { - * Gets the total brew time associated with this event. - * - * @return the total brew time -+ * @deprecated use {@link #getBrewingTime()} instead - */ -+ @Deprecated(since = "1.21", forRemoval = true) // Paper - public int getTotalBrewTime() { - return brewingTime; - } -@@ -0,0 +0,0 @@ public class BrewingStartEvent extends InventoryBlockStartEvent { - * Sets the total brew time for this event. - * - * @param brewTime the new total brew time -+ * @deprecated use {@link #setBrewingTime(int)} instead - */ -+ @Deprecated(since = "1.21", forRemoval = true) // Paper - public void setTotalBrewTime(int brewTime) { -- this.brewingTime = brewTime; -+ this.setBrewingTime(brewTime); // Paper - delegate to new method - } - - // Paper - remove HandlerList -+ -+ // Paper start - add recipeBrewTime -+ /** -+ * Gets the recipe time for the brewing process which is -+ * used to compute the progress of the brewing process with -+ * {@link #getBrewingTime()}. -+ * -+ * @return recipe brew time (in ticks) -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ public @org.jetbrains.annotations.Range(from = 1, to = Integer.MAX_VALUE) int getRecipeBrewTime() { -+ return this.recipeBrewTime; -+ } -+ -+ /** -+ * Sets the recipe time for the brewing process which is -+ * used to compute the progress of the brewing process with -+ * {@link #getBrewingTime()}. -+ * -+ * @param recipeBrewTime recipe brew time (in ticks) -+ * @throws IllegalArgumentException if the recipe brew time is non-positive -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ public void setRecipeBrewTime(@org.jetbrains.annotations.Range(from = 1, to = Integer.MAX_VALUE) int recipeBrewTime) { -+ com.google.common.base.Preconditions.checkArgument(recipeBrewTime > 0, "recipeBrewTime must be positive"); -+ this.recipeBrewTime = recipeBrewTime; -+ } -+ -+ /** -+ * Gets the amount of brewing ticks left. -+ * -+ * @return The amount of ticks left for the brewing task -+ */ -+ public @org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int getBrewingTime() { -+ return this.brewingTime; -+ } -+ -+ /** -+ * Sets the brewing ticks left. -+ * -+ * @param brewTime the ticks left, which is no less than 0 -+ * @throws IllegalArgumentException if the ticks are less than 0 -+ */ -+ public void setBrewingTime(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int brewTime) { -+ com.google.common.base.Preconditions.checkArgument(brewTime >= 0, "brewTime must be non-negative"); -+ this.brewingTime = brewTime; -+ } -+ // Paper end - add recipeBrewTime - } -diff --git a/src/main/java/org/bukkit/inventory/view/BrewingStandView.java b/src/main/java/org/bukkit/inventory/view/BrewingStandView.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/view/BrewingStandView.java -+++ b/src/main/java/org/bukkit/inventory/view/BrewingStandView.java -@@ -0,0 +0,0 @@ public interface BrewingStandView extends InventoryView { - * @throws IllegalArgumentException if the ticks are less than 0 - */ - void setBrewingTicks(final int ticks) throws IllegalArgumentException; -+ -+ // Paper start - Add recipeBrewTime -+ /** -+ * Sets the recipe time for the brewing process which is -+ * used to compute the progress of the brewing process with -+ * {@link #getBrewingTicks()}. -+ * -+ * @param recipeBrewTime recipe brew time (in ticks) -+ * @throws IllegalArgumentException if the recipe brew time is non-positive -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ void setRecipeBrewTime(@org.jetbrains.annotations.Range(from = 1, to = Integer.MAX_VALUE) int recipeBrewTime); -+ -+ /** -+ * Gets the recipe time for the brewing process which is -+ * used to compute the progress of the brewing process with -+ * {@link #getBrewingTicks()}. -+ * -+ * @return recipe brew time (in ticks) -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ @org.jetbrains.annotations.Range(from = 1, to = Integer.MAX_VALUE) int getRecipeBrewTime(); -+ // Paper end - Add recipeBrewTime - } diff --git a/patches/api/Add-sendOpLevel-API.patch b/patches/api/Add-sendOpLevel-API.patch deleted file mode 100644 index 05d68a81d7..0000000000 --- a/patches/api/Add-sendOpLevel-API.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Tue, 29 Dec 2020 15:02:57 +0100 -Subject: [PATCH] Add sendOpLevel API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - } - // Paper end - elytra boost API - -+ // Paper start - sendOpLevel API -+ /** -+ * Send a packet to the player indicating its operator status level. -+ *

    -+ * Note: This will not persist across more than the current connection, and setting the player's operator -+ * status as a later point will override the effects of this. -+ * -+ * @param level The level to send to the player. Must be in {@code [0, 4]}. -+ * @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}). -+ */ -+ void sendOpLevel(byte level); -+ // Paper end - sendOpLevel API -+ - // Spigot start - public class Spigot extends Entity.Spigot { - diff --git a/patches/api/Add-sender-name-to-commands.yml-replacement.patch b/patches/api/Add-sender-name-to-commands.yml-replacement.patch deleted file mode 100644 index b0f8c58bd3..0000000000 --- a/patches/api/Add-sender-name-to-commands.yml-replacement.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 22 Jul 2015 18:50:41 -0400 -Subject: [PATCH] Add sender name to commands.yml replacement - -This allows you to use $sender in commands.yml definitions to make -commands that auto target self. - -diff --git a/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/src/main/java/org/bukkit/command/FormattedCommandAlias.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/FormattedCommandAlias.java -+++ b/src/main/java/org/bukkit/command/FormattedCommandAlias.java -@@ -0,0 +0,0 @@ - package org.bukkit.command; - - import java.util.ArrayList; -+import java.util.regex.Matcher; // Paper -+import java.util.regex.Pattern; // Paper -+ - import org.bukkit.Bukkit; - import org.jetbrains.annotations.NotNull; - -@@ -0,0 +0,0 @@ public class FormattedCommandAlias extends Command { - ArrayList commands = new ArrayList(); - for (String formatString : formatStrings) { - try { -- commands.add(buildCommand(formatString, args)); -+ commands.add(buildCommand(sender, formatString, args)); // Paper - } catch (Throwable throwable) { - if (throwable instanceof IllegalArgumentException) { - sender.sendMessage(throwable.getMessage()); -@@ -0,0 +0,0 @@ public class FormattedCommandAlias extends Command { - return result; - } - -- private String buildCommand(@NotNull String formatString, @NotNull String[] args) { -+ private String buildCommand(@NotNull CommandSender sender, @NotNull String formatString, @NotNull String[] args) { // Paper -+ if (formatString.contains("$sender")) { // Paper -+ formatString = formatString.replaceAll(Pattern.quote("$sender"), Matcher.quoteReplacement(sender.getName())); // Paper -+ } // Paper - int index = formatString.indexOf('$'); - while (index != -1) { - int start = index; diff --git a/patches/api/Add-setPlayerProfile-API-for-Skulls.patch b/patches/api/Add-setPlayerProfile-API-for-Skulls.patch deleted file mode 100644 index 81c1d29895..0000000000 --- a/patches/api/Add-setPlayerProfile-API-for-Skulls.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 19 Jan 2018 00:29:28 -0500 -Subject: [PATCH] Add setPlayerProfile API for Skulls - -This allows you to create already filled textures on Skulls to avoid texture lookups -which commonly cause rate limit issues with Mojang API - -diff --git a/src/main/java/org/bukkit/block/Skull.java b/src/main/java/org/bukkit/block/Skull.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Skull.java -+++ b/src/main/java/org/bukkit/block/Skull.java -@@ -0,0 +0,0 @@ public interface Skull extends TileState { - */ - public void setOwningPlayer(@NotNull OfflinePlayer player); - -+ // Paper start -+ /** -+ * Sets this skull to use the supplied Player Profile, which can include textures already prefilled. -+ * @param profile The profile to set this Skull to use, may not be null -+ */ -+ void setPlayerProfile(@NotNull com.destroystokyo.paper.profile.PlayerProfile profile); -+ -+ /** -+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link com.destroystokyo.paper.profile.PlayerProfile} -+ * @return The profile of the owner, if set -+ */ -+ @Nullable com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile(); -+ // Paper end -+ - /** - * Gets the profile of the player who owns the skull. This player profile - * may appear as the texture depending on skull type. -@@ -0,0 +0,0 @@ public interface Skull extends TileState { - * @return the profile of the owning player - */ - @Nullable -+ @Deprecated // Paper - PlayerProfile getOwnerProfile(); - - /** -@@ -0,0 +0,0 @@ public interface Skull extends TileState { - * @throws IllegalArgumentException if the profile does not contain the - * necessary information - */ -+ @Deprecated // Paper - void setOwnerProfile(@Nullable PlayerProfile profile); - - /** -diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java -@@ -0,0 +0,0 @@ public interface SkullMeta extends ItemMeta { - @Deprecated(since = "1.12.1") - boolean setOwner(@Nullable String owner); - -+ // Paper start -+ /** -+ * Sets this skull to use the supplied Player Profile, which can include textures already prefilled. -+ * @param profile The profile to set this Skull to use, or null to clear owner -+ */ -+ void setPlayerProfile(@Nullable com.destroystokyo.paper.profile.PlayerProfile profile); -+ -+ /** -+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link com.destroystokyo.paper.profile.PlayerProfile} -+ * @return The profile of the owner, if set -+ */ -+ @Nullable com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile(); -+ // Paper end -+ - /** - * Gets the owner of the skull. - * -@@ -0,0 +0,0 @@ public interface SkullMeta extends ItemMeta { - * @return the profile of the owning player - */ - @Nullable -+ @Deprecated // Paper - PlayerProfile getOwnerProfile(); - - /** -@@ -0,0 +0,0 @@ public interface SkullMeta extends ItemMeta { - * @throws IllegalArgumentException if the profile does not contain the - * necessary information - */ -+ @Deprecated // Paper - void setOwnerProfile(@Nullable PlayerProfile profile); - - /** diff --git a/patches/api/Add-source-block-constructor-and-getChangedBlockData.patch b/patches/api/Add-source-block-constructor-and-getChangedBlockData.patch deleted file mode 100644 index 790a6ca02b..0000000000 --- a/patches/api/Add-source-block-constructor-and-getChangedBlockData.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Sotr -Date: Thu, 23 Aug 2018 16:14:25 +0800 -Subject: [PATCH] Add source block constructor and getChangedBlockData() to - BlockPhysicsEvent - - -diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java -@@ -0,0 +0,0 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { - private final Block sourceBlock; - private boolean cancel = false; - -+ // Paper start - Legacy constructor, use #BlockPhysicsEvent(Block, BlockData, Block) -+ @Deprecated -+ public BlockPhysicsEvent(final Block block, final BlockData changed, final int sourceX, final int sourceY, final int sourceZ) { -+ this(block, changed, block.getWorld().getBlockAt(sourceX, sourceY, sourceZ)); -+ } -+ // Paper end -+ - public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed) { - this(block, changed, block); - } -@@ -0,0 +0,0 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { - } - - /** -- * Gets the type of block that changed, causing this event -+ * Gets the type of block that changed, causing this event. -+ * This is the type of {@link #getBlock()} at the time of the event. - * - * @return Changed block's type - */ -@@ -0,0 +0,0 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { - return changed.getMaterial(); - } - -+ // Paper start - Getter for the BlockData -+ /** -+ * Gets the BlockData of the block that changed, causing this event. -+ * This is the BlockData of {@link #getBlock()} at the time of the event. -+ * -+ * @return Changed block's BlockData -+ */ -+ @NotNull -+ public BlockData getChangedBlockData() { -+ return changed.clone(); -+ } -+ // Paper end -+ - @Override - public boolean isCancelled() { - return cancel; diff --git a/patches/api/Add-source-to-PlayerExpChangeEvent.patch b/patches/api/Add-source-to-PlayerExpChangeEvent.patch deleted file mode 100644 index 58152af711..0000000000 --- a/patches/api/Add-source-to-PlayerExpChangeEvent.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaBlend -Date: Thu, 8 Sep 2016 08:47:08 -0700 -Subject: [PATCH] Add source to PlayerExpChangeEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerExpChangeEvent.java -@@ -0,0 +0,0 @@ - package org.bukkit.event.player; - -+import org.bukkit.entity.Entity; // Paper - import org.bukkit.entity.Player; - import org.bukkit.event.HandlerList; - import org.jetbrains.annotations.NotNull; - -+import org.jetbrains.annotations.Nullable; // Paper -+ - /** - * Called when a players experience changes naturally - */ - public class PlayerExpChangeEvent extends PlayerEvent { - private static final HandlerList handlers = new HandlerList(); -+ // Paper start -+ @Nullable -+ private final Entity source; - private int exp; - - public PlayerExpChangeEvent(@NotNull final Player player, final int expAmount) { -+ this(player, null, expAmount); -+ } -+ -+ public PlayerExpChangeEvent(@NotNull final Player player, @Nullable final Entity sourceEntity, final int expAmount) { - super(player); -+ source = sourceEntity; - exp = expAmount; - } - -+ /** -+ * Get the source that provided the experience. -+ * -+ * @return The source of the experience -+ */ -+ @Nullable -+ public Entity getSource() { -+ return source; -+ } -+ // Paper end -+ - /** - * Get the amount of experience the player will receive - * diff --git a/patches/api/Add-spectator-target-events.patch b/patches/api/Add-spectator-target-events.patch deleted file mode 100644 index 46569f1a86..0000000000 --- a/patches/api/Add-spectator-target-events.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Caleb Bassham -Date: Fri, 28 Sep 2018 02:30:56 -0500 -Subject: [PATCH] Add spectator target events - -- PlayerStartSpectatingEntityEvent -- PlayerStopSpectatingEntityEvent - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Triggered when a player starts spectating an entity in spectator mode. -+ */ -+@NullMarked -+public class PlayerStartSpectatingEntityEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity currentSpectatorTarget; -+ private final Entity newSpectatorTarget; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerStartSpectatingEntityEvent(final Player player, final Entity currentSpectatorTarget, final Entity newSpectatorTarget) { -+ super(player); -+ this.currentSpectatorTarget = currentSpectatorTarget; -+ this.newSpectatorTarget = newSpectatorTarget; -+ } -+ -+ /** -+ * Gets the entity that the player is currently spectating or themselves if they weren't spectating anything -+ * -+ * @return The entity the player is currently spectating (before they start spectating the new target). -+ */ -+ public Entity getCurrentSpectatorTarget() { -+ return this.currentSpectatorTarget; -+ } -+ -+ /** -+ * Gets the new entity that the player will now be spectating -+ * -+ * @return The entity the player is now going to be spectating. -+ */ -+ public Entity getNewSpectatorTarget() { -+ return this.newSpectatorTarget; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -+ -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Triggered when a player stops spectating an entity in spectator mode. -+ */ -+@NullMarked -+public class PlayerStopSpectatingEntityEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity spectatorTarget; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerStopSpectatingEntityEvent(final Player player, final Entity spectatorTarget) { -+ super(player); -+ this.spectatorTarget = spectatorTarget; -+ } -+ -+ /** -+ * Gets the entity that the player is spectating -+ * -+ * @return The entity the player is currently spectating (before they will stop). -+ */ -+ public Entity getSpectatorTarget() { -+ return this.spectatorTarget; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Add-sun-related-API.patch b/patches/api/Add-sun-related-API.patch deleted file mode 100644 index 4674cf2fec..0000000000 --- a/patches/api/Add-sun-related-API.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 7 Oct 2018 00:54:15 -0500 -Subject: [PATCH] Add sun related API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - */ - public void setFullTime(long time); - -+ // Paper start -+ -+ /** -+ * Check if it is currently daytime in this world -+ * -+ * @return True if it is daytime -+ */ -+ public boolean isDayTime(); -+ // Paper end -+ - /** - * Gets the full in-game time on this world since the world generation - * -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -0,0 +0,0 @@ public interface Mob extends LivingEntity, Lootable { - */ - @NotNull - com.destroystokyo.paper.entity.Pathfinder getPathfinder(); -+ -+ /** -+ * Check if this mob is exposed to daylight -+ * -+ * @return True if mob is exposed to daylight -+ */ -+ boolean isInDaylight(); - // Paper end - /** - * Instructs this Mob to set the specified LivingEntity as its target. diff --git a/patches/api/Add-tick-times-API.patch b/patches/api/Add-tick-times-API.patch deleted file mode 100644 index db763554c9..0000000000 --- a/patches/api/Add-tick-times-API.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 5 Apr 2020 22:22:58 -0500 -Subject: [PATCH] Add tick times API - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - public static double[] getTPS() { - return server.getTPS(); - } -+ -+ /** -+ * Get a sample of the servers last tick times (in nanos) -+ * -+ * @return A sample of the servers last tick times (in nanos) -+ */ -+ @NotNull -+ public static long[] getTickTimes() { -+ return server.getTickTimes(); -+ } -+ -+ /** -+ * Get the average tick time (in millis) -+ * -+ * @return Average tick time (in millis) -+ */ -+ public static double getAverageTickTime() { -+ return server == null ? 0D : server.getAverageTickTime(); -+ } - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - @NotNull - public double[] getTPS(); -+ -+ /** -+ * Get a sample of the servers last tick times (in nanos) -+ * -+ * @return A sample of the servers last tick times (in nanos) -+ */ -+ @NotNull -+ long[] getTickTimes(); -+ -+ /** -+ * Get the average tick time (in millis) -+ * -+ * @return Average tick time (in millis) -+ */ -+ double getAverageTickTime(); - // Paper end - - // Paper start diff --git a/patches/api/Add-titleOverride-to-InventoryOpenEvent.patch b/patches/api/Add-titleOverride-to-InventoryOpenEvent.patch deleted file mode 100644 index b62c3e7df4..0000000000 --- a/patches/api/Add-titleOverride-to-InventoryOpenEvent.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 4 Mar 2022 12:45:21 -0800 -Subject: [PATCH] Add titleOverride to InventoryOpenEvent - - -diff --git a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - public class InventoryOpenEvent extends InventoryEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; -+ private net.kyori.adventure.text.Component titleOverride; // Paper - - public InventoryOpenEvent(@NotNull InventoryView transaction) { - super(transaction); -@@ -0,0 +0,0 @@ public class InventoryOpenEvent extends InventoryEvent implements Cancellable { - cancelled = cancel; - } - -+ // Paper start -+ /** -+ * Gets the title override set by another event or null -+ * if not set. -+ * -+ * @return the title override or null -+ */ -+ public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component titleOverride() { -+ return this.titleOverride; -+ } -+ -+ /** -+ * Sets the title override or clears the override. -+ *

    -+ * This is only the title sent to the client in the open packet, this doesn't change -+ * the title returned by {@link InventoryView#title()}, hence "override". -+ *

    -+ * NOTE: Horse inventories are a special case where setting this will -+ * have no effect. Horse inventory titles are set by the horse display name. -+ * -+ * @param titleOverride the title override or null -+ */ -+ public void titleOverride(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component titleOverride) { -+ this.titleOverride = titleOverride; -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { diff --git a/patches/api/Add-view-distance-API.patch b/patches/api/Add-view-distance-API.patch deleted file mode 100644 index d973537335..0000000000 --- a/patches/api/Add-view-distance-API.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Mon, 29 Feb 2016 18:05:37 -0600 -Subject: [PATCH] Add view distance API - -Add per player no-tick, tick, and send view distances. - -Also add send/no-tick view distance to World. - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @NotNull - public Set getFeatureFlags(); - -+ // Paper start - view distance api -+ /** -+ * Sets the view distance for this world. -+ * @param viewDistance view distance in [2, 32] -+ */ -+ void setViewDistance(int viewDistance); -+ -+ /** -+ * Sets the simulation distance for this world. -+ * @param simulationDistance simulation distance in [2, 32] -+ */ -+ void setSimulationDistance(int simulationDistance); -+ -+ /** -+ * Returns the no-tick view distance for this world. -+ *

    -+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not -+ * be set to tick. -+ *

    -+ * @return The no-tick view distance for this world. -+ * @deprecated Use {@link #getViewDistance()} -+ */ -+ @Deprecated -+ default int getNoTickViewDistance() { -+ return this.getViewDistance(); -+ } -+ -+ /** -+ * Sets the no-tick view distance for this world. -+ *

    -+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not -+ * be set to tick. -+ *

    -+ * @param viewDistance view distance in [2, 32] -+ * @deprecated Use {@link #setViewDistance(int)} -+ */ -+ @Deprecated -+ default void setNoTickViewDistance(int viewDistance) { -+ this.setViewDistance(viewDistance); -+ } -+ -+ /** -+ * Gets the sending view distance for this world. -+ *

    -+ * Sending view distance is the view distance where chunks will load in for players in this world. -+ *

    -+ * @return The sending view distance for this world. -+ */ -+ int getSendViewDistance(); -+ -+ /** -+ * Sets the sending view distance for this world. -+ *

    -+ * Sending view distance is the view distance where chunks will load in for players in this world. -+ *

    -+ * @param viewDistance view distance in [2, 32] or -1 -+ */ -+ void setSendViewDistance(int viewDistance); -+ // Paper end - view distance api -+ - /** - * Gets all generated structures that intersect the chunk at the given - * coordinates.
    -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @param affects Whether the player can affect mob spawning - */ - public void setAffectsSpawning(boolean affects); -+ -+ /** -+ * Gets the view distance for this player -+ * -+ * @return the player's view distance -+ * @see org.bukkit.World#getViewDistance() -+ */ -+ public int getViewDistance(); -+ -+ /** -+ * Sets the view distance for this player -+ * -+ * @param viewDistance the player's view distance -+ * @see org.bukkit.World#setViewDistance(int) -+ */ -+ public void setViewDistance(int viewDistance); -+ -+ /** -+ * Gets the simulation distance for this player -+ * -+ * @return the player's simulation distance -+ */ -+ public int getSimulationDistance(); -+ -+ /** -+ * Sets the simulation distance for this player -+ * -+ * @param simulationDistance the player's new simulation distance -+ */ -+ public void setSimulationDistance(int simulationDistance); -+ -+ /** -+ * Gets the no-ticking view distance for this player. -+ *

    -+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not -+ * be set to tick. -+ *

    -+ * @return The no-tick view distance for this player. -+ * @deprecated Use {@link #getViewDistance()} -+ */ -+ @Deprecated -+ default int getNoTickViewDistance() { -+ return this.getViewDistance(); -+ } -+ -+ /** -+ * Sets the no-ticking view distance for this player. -+ *

    -+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not -+ * be set to tick. -+ *

    -+ * @param viewDistance view distance in [2, 32] or -1 -+ * @deprecated Use {@link #setViewDistance(int)} -+ */ -+ @Deprecated -+ default void setNoTickViewDistance(int viewDistance) { -+ this.setViewDistance(viewDistance); -+ } -+ -+ /** -+ * Gets the sending view distance for this player. -+ *

    -+ * Sending view distance is the view distance where chunks will load in for players. -+ *

    -+ * @return The sending view distance for this player. -+ */ -+ public int getSendViewDistance(); -+ -+ /** -+ * Sets the sending view distance for this player. -+ *

    -+ * Sending view distance is the view distance where chunks will load in for players. -+ *

    -+ * @param viewDistance view distance in [2, 32] or -1 -+ */ -+ public void setSendViewDistance(int viewDistance); - // Paper end - - /** diff --git a/patches/api/Add-villager-reputation-API.patch b/patches/api/Add-villager-reputation-API.patch deleted file mode 100644 index 08d7e98863..0000000000 --- a/patches/api/Add-villager-reputation-API.patch +++ /dev/null @@ -1,174 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Wed, 22 Apr 2020 23:13:49 +0200 -Subject: [PATCH] Add villager reputation API - - -diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java b/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.entity.villager; -+ -+import com.google.common.base.Preconditions; -+import java.util.EnumMap; -+import java.util.Map; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A reputation score for a player on a villager. -+ */ -+@NullMarked -+public final class Reputation { -+ -+ private final Map reputation; -+ -+ public Reputation() { -+ this(new EnumMap<>(ReputationType.class)); -+ } -+ -+ public Reputation(final Map reputation) { -+ Preconditions.checkNotNull(reputation, "reputation cannot be null"); -+ this.reputation = reputation; -+ } -+ -+ /** -+ * Gets the reputation value for a specific {@link ReputationType}. -+ * -+ * @param type The {@link ReputationType type} of reputation to get. -+ * @return The value of the {@link ReputationType type}. -+ */ -+ public int getReputation(final ReputationType type) { -+ Preconditions.checkNotNull(type, "the reputation type cannot be null"); -+ return this.reputation.getOrDefault(type, 0); -+ } -+ -+ /** -+ * Sets the reputation value for a specific {@link ReputationType}. -+ * -+ * @param type The {@link ReputationType type} of reputation to set. -+ * @param value The value of the {@link ReputationType type}. -+ */ -+ public void setReputation(final ReputationType type, final int value) { -+ Preconditions.checkNotNull(type, "the reputation type cannot be null"); -+ this.reputation.put(type, value); -+ } -+ -+ /** -+ * Gets if a reputation value is currently set for a specific {@link ReputationType}. -+ * -+ * @param type The {@link ReputationType type} to check -+ * @return If there is a value for this {@link ReputationType type} set. -+ */ -+ public boolean hasReputationSet(final ReputationType type) { -+ return this.reputation.containsKey(type); -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.entity.villager; -+ -+/** -+ * A type of reputation gained with a {@link org.bukkit.entity.Villager Villager}. -+ *

    -+ * All types but {@link #MAJOR_POSITIVE} are shared to other villagers. -+ */ -+public enum ReputationType { -+ /** -+ * A gossip with a majorly negative effect. This is only gained through killing a nearby -+ * villager. -+ */ -+ MAJOR_NEGATIVE, -+ -+ /** -+ * A gossip with a minor negative effect. This is only gained through damaging a villager. -+ */ -+ MINOR_NEGATIVE, -+ -+ /** -+ * A gossip with a minor positive effect. This is only gained through curing a zombie -+ * villager. -+ */ -+ MINOR_POSITIVE, -+ -+ /** -+ * A gossip with a major positive effect. This is only gained through curing a zombie -+ * villager. -+ */ -+ MAJOR_POSITIVE, -+ -+ /** -+ * A gossip with a minor positive effect. This is only gained through trading with a villager. -+ */ -+ TRADING, -+} -diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Villager.java -+++ b/src/main/java/org/bukkit/entity/Villager.java -@@ -0,0 +0,0 @@ package org.bukkit.entity; - import com.google.common.base.Preconditions; - import com.google.common.collect.Lists; - import java.util.Locale; -+import java.util.Map; // Paper -+import java.util.UUID; // Paper - import org.bukkit.Keyed; - import org.bukkit.Location; - import org.bukkit.NamespacedKey; -@@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager { - return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]); - } - } -+ -+ // Paper start - Add villager reputation API -+ /** -+ * Get the {@link com.destroystokyo.paper.entity.villager.Reputation reputation} -+ * for a specific player by {@link UUID}. -+ * -+ * @param uniqueId The {@link UUID} of the player to get the reputation of. -+ * @return The player's copied reputation with this villager. -+ */ -+ @NotNull -+ public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId); -+ -+ /** -+ * Get all {@link com.destroystokyo.paper.entity.villager.Reputation reputations} -+ * for all players mapped by their {@link UUID unique IDs}. -+ * -+ * @return All {@link com.destroystokyo.paper.entity.villager.Reputation reputations} for all players -+ * in a copied map. -+ */ -+ @NotNull -+ public Map getReputations(); -+ -+ /** -+ * Set the {@link com.destroystokyo.paper.entity.villager.Reputation reputation} -+ * for a specific player by {@link UUID}. -+ * -+ * @param uniqueId The {@link UUID} of the player to set the reputation of. -+ * @param reputation The {@link com.destroystokyo.paper.entity.villager.Reputation reputation} to set. -+ */ -+ public void setReputation(@NotNull UUID uniqueId, @NotNull com.destroystokyo.paper.entity.villager.Reputation reputation); -+ -+ /** -+ * Set all {@link com.destroystokyo.paper.entity.villager.Reputation reputations} -+ * for all players mapped by their {@link UUID unique IDs}. -+ * -+ * @param reputations All {@link com.destroystokyo.paper.entity.villager.Reputation reputations} -+ * for all players mapped by their {@link UUID unique IDs}. -+ */ -+ public void setReputations(@NotNull Map reputations); -+ -+ /** -+ * Clear all reputations from this villager. This removes every single -+ * reputation regardless of its impact and the player associated. -+ */ -+ public void clearReputations(); -+ // Paper end - } diff --git a/patches/api/Add-whitelist-events.patch b/patches/api/Add-whitelist-events.patch deleted file mode 100644 index 489f26877b..0000000000 --- a/patches/api/Add-whitelist-events.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SageSphinx63920 -Date: Sun, 14 May 2023 12:56:15 +0200 -Subject: [PATCH] Add whitelist events - - -diff --git a/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java b/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.server; -+ -+import com.destroystokyo.paper.profile.PlayerProfile; -+import org.bukkit.Bukkit; -+import org.bukkit.OfflinePlayer; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * This event gets called when the whitelist status of a player is changed -+ */ -+@NullMarked -+public class WhitelistStateUpdateEvent extends Event implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final PlayerProfile playerProfile; -+ private final WhitelistStatus status; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WhitelistStateUpdateEvent(final PlayerProfile playerProfile, final WhitelistStatus status) { -+ this.playerProfile = playerProfile; -+ this.status = status; -+ } -+ -+ /** -+ * Gets the player whose whitelist status is being changed -+ * -+ * @return the player whose status is being changed -+ */ -+ public OfflinePlayer getPlayer() { -+ return Bukkit.getOfflinePlayer(this.playerProfile.getId()); -+ } -+ -+ /** -+ * Gets the player profile whose whitelist status is being changed -+ * -+ * @return the player profile whose status is being changed -+ */ -+ public PlayerProfile getPlayerProfile() { -+ return this.playerProfile; -+ } -+ -+ /** -+ * Gets the status change of the player profile -+ * -+ * @return the whitelist status -+ */ -+ public WhitelistStatus getStatus() { -+ return this.status; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * Enum for the whitelist status changes -+ */ -+ public enum WhitelistStatus { -+ ADDED, REMOVED -+ } -+} diff --git a/patches/api/Add-workaround-for-plugins-modifying-the-parent-of-t.patch b/patches/api/Add-workaround-for-plugins-modifying-the-parent-of-t.patch deleted file mode 100644 index eac8221ce2..0000000000 --- a/patches/api/Add-workaround-for-plugins-modifying-the-parent-of-t.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Minecrell -Date: Thu, 21 Sep 2017 19:41:20 +0200 -Subject: [PATCH] Add workaround for plugins modifying the parent of the plugin - logger - -Essentials uses a custom logger name ("Essentials") instead of the -plugin logger. Log messages are redirected to the plugin logger by -setting the parent of the "Essentials" logger to the plugin logger. - -With our changes, the plugin logger is now also called "Essentials", -resulting in an infinite loop. Make sure plugins can't change the -parent of the plugin logger to avoid this. - -diff --git a/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.utils; -+ -+import io.papermc.paper.plugin.configuration.PluginMeta; -+import java.util.logging.Level; -+import java.util.logging.LogManager; -+import java.util.logging.Logger; -+import org.bukkit.plugin.PluginDescriptionFile; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Prevents plugins (e.g. Essentials) from changing the parent of the plugin logger. -+ */ -+@NullMarked -+public class PaperPluginLogger extends Logger { -+ -+ @Deprecated(forRemoval = true) -+ public static Logger getLogger(final PluginDescriptionFile description) { -+ return getLogger((PluginMeta) description); -+ } -+ -+ public static Logger getLogger(final PluginMeta meta) { -+ Logger logger = new PaperPluginLogger(meta); -+ if (!LogManager.getLogManager().addLogger(logger)) { -+ // Disable this if it's going to happen across reloads anyways... -+ //logger.log(Level.WARNING, "Could not insert plugin logger - one was already found: {}", LogManager.getLogManager().getLogger(this.getName())); -+ logger = LogManager.getLogManager().getLogger(meta.getLoggerPrefix() != null ? meta.getLoggerPrefix() : meta.getName()); -+ } -+ -+ return logger; -+ } -+ -+ private PaperPluginLogger(final PluginMeta meta) { -+ super(meta.getLoggerPrefix() != null ? meta.getLoggerPrefix() : meta.getName(), null); -+ } -+ -+ @Override -+ public void setParent(final Logger parent) { -+ if (this.getParent() != null) { -+ this.warning("Ignoring attempt to change parent of plugin logger"); -+ } else { -+ this.log(Level.FINE, "Setting plugin logger parent to {0}", parent); -+ super.setParent(parent); -+ } -+ } -+ -+} -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase { - .orElseThrow(); - } - public final void init(@NotNull PluginLoader loader, @NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader) { -- init(server, description, dataFolder, file, classLoader, description); -+ init(server, description, dataFolder, file, classLoader, description, com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description)); - this.pluginMeta = description; - } -- public final void init(@NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader, @Nullable io.papermc.paper.plugin.configuration.PluginMeta configuration) { -+ public final void init(@NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader, @Nullable io.papermc.paper.plugin.configuration.PluginMeta configuration, @NotNull Logger logger) { - // Paper end - this.loader = DummyPluginLoaderImplHolder.INSTANCE; // Paper - this.server = server; -@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase { - this.classLoader = classLoader; - this.configFile = new File(dataFolder, "config.yml"); - this.pluginMeta = configuration; // Paper -- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); // Paper - Handle plugin prefix in implementation -+ this.logger = logger; // Paper - } - - /** -diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm - this.url = file.toURI().toURL(); - this.libraryLoader = libraryLoader; - -+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early - // Paper start - this.dependencyContext = dependencyContext; - this.classLoaderGroup = io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage.instance().registerSpigotGroup(this); -@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm - pluginState = new IllegalStateException("Initial initialization"); - this.pluginInit = javaPlugin; - -- javaPlugin.init(null, org.bukkit.Bukkit.getServer(), description, dataFolder, file, this); // Paper -+ javaPlugin.init(org.bukkit.Bukkit.getServer(), description, dataFolder, file, this, description, this.logger); // Paper - } - - // Paper start diff --git a/patches/api/Add-worldborder-events.patch b/patches/api/Add-worldborder-events.patch deleted file mode 100644 index 0d97a60a76..0000000000 --- a/patches/api/Add-worldborder-events.patch +++ /dev/null @@ -1,310 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 4 Jan 2021 22:40:26 -0800 -Subject: [PATCH] Add worldborder events - - -diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.world.border; -+ -+import org.bukkit.World; -+import org.bukkit.WorldBorder; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a world border changes its bounds, either over time, or instantly. -+ */ -+@NullMarked -+public class WorldBorderBoundsChangeEvent extends WorldBorderEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private Type type; -+ private final double oldSize; -+ private double newSize; -+ private long duration; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WorldBorderBoundsChangeEvent(final World world, final WorldBorder worldBorder, final Type type, final double oldSize, final double newSize, final long duration) { -+ super(world, worldBorder); -+ this.type = type; -+ this.oldSize = oldSize; -+ this.newSize = newSize; -+ this.duration = duration; -+ } -+ -+ /** -+ * Gets if this change is an instant change or over-time change. -+ * -+ * @return the change type -+ */ -+ public Type getType() { -+ return this.type; -+ } -+ -+ /** -+ * Gets the old size or the world border. -+ * -+ * @return the old size -+ */ -+ public double getOldSize() { -+ return this.oldSize; -+ } -+ -+ /** -+ * Gets the new size of the world border. -+ * -+ * @return the new size -+ */ -+ public double getNewSize() { -+ return this.newSize; -+ } -+ -+ /** -+ * Sets the new size of the world border. -+ * -+ * @param newSize the new size -+ */ -+ public void setNewSize(final double newSize) { -+ this.newSize = Math.min(this.worldBorder.getMaxSize(), Math.max(1.0D, newSize)); -+ } -+ -+ /** -+ * Gets the time in milliseconds for the change. Will be 0 if instant. -+ * -+ * @return the time in milliseconds for the change -+ */ -+ public long getDuration() { -+ return this.duration; -+ } -+ -+ /** -+ * Sets the time in milliseconds for the change. Will change {@link #getType()} to return -+ * {@link Type#STARTED_MOVE}. -+ * -+ * @param duration the time in milliseconds for the change -+ */ -+ public void setDuration(final long duration) { -+ // PAIL: TODO: Magic Values -+ this.duration = Math.min(9223372036854775L, Math.max(0L, duration)); -+ if (duration >= 0 && this.type == Type.INSTANT_MOVE) { -+ this.type = Type.STARTED_MOVE; -+ } -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum Type { -+ STARTED_MOVE, -+ INSTANT_MOVE -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.world.border; -+ -+import org.bukkit.World; -+import org.bukkit.WorldBorder; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a moving world border has finished its move. -+ */ -+@NullMarked -+public class WorldBorderBoundsChangeFinishEvent extends WorldBorderEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final double oldSize; -+ private final double newSize; -+ private final double duration; -+ -+ @ApiStatus.Internal -+ public WorldBorderBoundsChangeFinishEvent(final World world, final WorldBorder worldBorder, final double oldSize, final double newSize, final double duration) { -+ super(world, worldBorder); -+ this.oldSize = oldSize; -+ this.newSize = newSize; -+ this.duration = duration; -+ } -+ -+ /** -+ * Gets the old size of the worldborder. -+ * -+ * @return the old size -+ */ -+ public double getOldSize() { -+ return this.oldSize; -+ } -+ -+ /** -+ * Gets the new size of the worldborder. -+ * -+ * @return the new size -+ */ -+ public double getNewSize() { -+ return this.newSize; -+ } -+ -+ /** -+ * Gets the duration this worldborder took to make the change. -+ *

    -+ * Can be 0 if handlers for {@link WorldBorderCenterChangeEvent} set the duration to 0. -+ * -+ * @return the duration of the transition -+ */ -+ public double getDuration() { -+ return this.duration; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.world.border; -+ -+import org.bukkit.Location; -+import org.bukkit.World; -+import org.bukkit.WorldBorder; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a world border's center is changed. -+ */ -+@NullMarked -+public class WorldBorderCenterChangeEvent extends WorldBorderEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Location oldCenter; -+ private Location newCenter; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WorldBorderCenterChangeEvent(final World world, final WorldBorder worldBorder, final Location oldCenter, final Location newCenter) { -+ super(world, worldBorder); -+ this.oldCenter = oldCenter; -+ this.newCenter = newCenter; -+ } -+ -+ /** -+ * Gets the original center location of the world border. -+ * -+ * @return the old center -+ */ -+ public Location getOldCenter() { -+ return this.oldCenter.clone(); -+ } -+ -+ /** -+ * Gets the new center location for the world border. -+ * -+ * @return the new center -+ */ -+ public Location getNewCenter() { -+ return this.newCenter; -+ } -+ -+ /** -+ * Sets the new center location for the world border. Y coordinate is ignored. -+ * -+ * @param newCenter the new center -+ */ -+ public void setNewCenter(final Location newCenter) { -+ this.newCenter = newCenter; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.world.border; -+ -+import org.bukkit.World; -+import org.bukkit.WorldBorder; -+import org.bukkit.event.world.WorldEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+public abstract class WorldBorderEvent extends WorldEvent { -+ -+ protected final WorldBorder worldBorder; -+ -+ @ApiStatus.Internal -+ protected WorldBorderEvent(final World world, final WorldBorder worldBorder) { -+ super(world); -+ this.worldBorder = worldBorder; -+ } -+ -+ public WorldBorder getWorldBorder() { -+ return this.worldBorder; -+ } -+} diff --git a/patches/api/Added-API-to-get-player-ha-proxy-address.patch b/patches/api/Added-API-to-get-player-ha-proxy-address.patch deleted file mode 100644 index 33d4e9fe2e..0000000000 --- a/patches/api/Added-API-to-get-player-ha-proxy-address.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: nostalfinals -Date: Mon, 8 Apr 2024 23:24:38 +0800 -Subject: [PATCH] Added API to get player ha proxy address - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - @Nullable - public InetSocketAddress getAddress(); - -+ // Paper start - Add API to get player's proxy address -+ /** -+ * Gets the socket address of this player's proxy -+ * -+ * @return the player's proxy address, null if the server doesn't have Proxy Protocol enabled, or the player didn't connect to an HAProxy instance -+ */ -+ @Nullable -+ public InetSocketAddress getHAProxyAddress(); -+ // Paper end - Add API to get player's proxy address -+ - /** - * Gets if this connection has been transferred from another server. - * diff --git a/patches/api/Added-EntityDamageItemEvent.patch b/patches/api/Added-EntityDamageItemEvent.patch deleted file mode 100644 index 2e2fbeb831..0000000000 --- a/patches/api/Added-EntityDamageItemEvent.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 22 Dec 2020 13:51:06 -0800 -Subject: [PATCH] Added EntityDamageItemEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when an item on or used by an entity takes durability damage as a result of being hit/used. -+ *

    -+ * NOTE: default vanilla behaviour dictates that armor/tools picked up by -+ * mobs do not take damage (except via Thorns). -+ */ -+@NullMarked -+public class EntityDamageItemEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack item; -+ private int damage; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityDamageItemEvent(final Entity entity, final ItemStack item, final int damage) { -+ super(entity); -+ this.item = item; -+ this.damage = damage; -+ } -+ -+ /** -+ * Gets the item being damaged. -+ * -+ * @return the item -+ */ -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets the amount of durability damage this item will be taking. -+ * -+ * @return durability change -+ */ -+ public int getDamage() { -+ return this.damage; -+ } -+ -+ /** -+ * Sets the amount of durability damage this item will be taking. -+ * -+ * @param damage the damage amount to cause -+ */ -+ public void setDamage(final int damage) { -+ this.damage = damage; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Added-EntityToggleSitEvent.patch b/patches/api/Added-EntityToggleSitEvent.patch deleted file mode 100644 index c1dfde0d2c..0000000000 --- a/patches/api/Added-EntityToggleSitEvent.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: KyGuy2002 -Date: Fri, 11 Mar 2022 15:33:10 +0000 -Subject: [PATCH] Added EntityToggleSitEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Is called when an entity sits down or stands up. -+ */ -+@NullMarked -+public class EntityToggleSitEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final boolean isSitting; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityToggleSitEvent(final Entity entity, final boolean isSitting) { -+ super(entity); -+ this.isSitting = isSitting; -+ } -+ -+ /** -+ * Gets the new sitting state that the entity will change to. -+ * -+ * @return If it's going to sit or not. -+ */ -+ public boolean getSittingState() { -+ return this.isSitting; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Added-PlayerBedFailEnterEvent.patch b/patches/api/Added-PlayerBedFailEnterEvent.patch deleted file mode 100644 index 0761063aa6..0000000000 --- a/patches/api/Added-PlayerBedFailEnterEvent.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 24 Dec 2020 12:27:49 -0800 -Subject: [PATCH] Added PlayerBedFailEnterEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+@NullMarked -+public class PlayerBedFailEnterEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final FailReason failReason; -+ private final Block bed; -+ private boolean willExplode; -+ private @Nullable Component message; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerBedFailEnterEvent(final Player player, final FailReason failReason, final Block bed, final boolean willExplode, final @Nullable Component message) { -+ super(player); -+ this.failReason = failReason; -+ this.bed = bed; -+ this.willExplode = willExplode; -+ this.message = message; -+ } -+ -+ public FailReason getFailReason() { -+ return this.failReason; -+ } -+ -+ public Block getBed() { -+ return this.bed; -+ } -+ -+ public boolean getWillExplode() { -+ return this.willExplode; -+ } -+ -+ public void setWillExplode(final boolean willExplode) { -+ this.willExplode = willExplode; -+ } -+ -+ public @Nullable Component getMessage() { -+ return this.message; -+ } -+ -+ public void setMessage(final @Nullable Component message) { -+ this.message = message; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

    -+ * NOTE: This does not cancel the player getting in the bed, but any messages/explosions -+ * that may occur because of the interaction. -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum FailReason { -+ /** -+ * The world doesn't allow sleeping (ex. Nether or The End). Entering -+ * the bed is prevented and the bed explodes. -+ */ -+ NOT_POSSIBLE_HERE, -+ /** -+ * Entering the bed is prevented due to it not being night nor -+ * thundering currently. -+ *

    -+ * If the event is forcefully allowed during daytime, the player will -+ * enter the bed (and set its bed location), but might get immediately -+ * thrown out again. -+ */ -+ NOT_POSSIBLE_NOW, -+ /** -+ * Entering the bed is prevented due to the player being too far away. -+ */ -+ TOO_FAR_AWAY, -+ /** -+ * Bed is obstructed. -+ */ -+ OBSTRUCTED, -+ /** -+ * Entering the bed is prevented due to there being some other problem. -+ */ -+ OTHER_PROBLEM, -+ /** -+ * Entering the bed is prevented due to there being monsters nearby. -+ */ -+ NOT_SAFE -+ } -+} diff --git a/patches/api/Added-PlayerChangeBeaconEffectEvent.patch b/patches/api/Added-PlayerChangeBeaconEffectEvent.patch deleted file mode 100644 index 4aa79119ac..0000000000 --- a/patches/api/Added-PlayerChangeBeaconEffectEvent.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 24 Jun 2020 15:12:18 -0600 -Subject: [PATCH] Added PlayerChangeBeaconEffectEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.potion.PotionEffectType; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when a player sets the effect for a beacon -+ */ -+@NullMarked -+public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block beacon; -+ private @Nullable PotionEffectType primary; -+ private @Nullable PotionEffectType secondary; -+ private boolean consumeItem = true; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerChangeBeaconEffectEvent(final Player player, final @Nullable PotionEffectType primary, final @Nullable PotionEffectType secondary, final Block beacon) { -+ super(player); -+ this.primary = primary; -+ this.secondary = secondary; -+ this.beacon = beacon; -+ } -+ -+ /** -+ * @return the primary effect -+ */ -+ public @Nullable PotionEffectType getPrimary() { -+ return this.primary; -+ } -+ -+ /** -+ * Sets the primary effect -+ *

    -+ * NOTE: The primary effect still has to be one of the valid effects for a beacon. -+ * -+ * @param primary the primary effect -+ */ -+ public void setPrimary(final @Nullable PotionEffectType primary) { -+ this.primary = primary; -+ } -+ -+ /** -+ * @return the secondary effect -+ */ -+ public @Nullable PotionEffectType getSecondary() { -+ return this.secondary; -+ } -+ -+ /** -+ * Sets the secondary effect -+ *

    -+ * This only has an effect when the beacon is able to accept a secondary effect. -+ * NOTE: The secondary effect still has to be a valid effect for a beacon. -+ * -+ * @param secondary the secondary effect -+ */ -+ public void setSecondary(final @Nullable PotionEffectType secondary) { -+ this.secondary = secondary; -+ } -+ -+ /** -+ * @return the beacon block associated with this event -+ */ -+ public Block getBeacon() { -+ return this.beacon; -+ } -+ -+ /** -+ * Gets if the item used to change the beacon will be consumed. -+ *

    -+ * Independent of {@link #isCancelled()}. If the event is cancelled -+ * the item will NOT be consumed. -+ * -+ * @return {@code true} if item will be consumed -+ */ -+ public boolean willConsumeItem() { -+ return this.consumeItem; -+ } -+ -+ /** -+ * Sets if the item used to change the beacon should be consumed. -+ *

    -+ * Independent of {@link #isCancelled()}. If the event is cancelled -+ * the item will NOT be consumed. -+ * -+ * @param consumeItem {@code true} if item should be consumed -+ */ -+ public void setConsumeItem(final boolean consumeItem) { -+ this.consumeItem = consumeItem; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

    -+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will -+ * not take effect -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

    -+ * If cancelled, the item will NOT be consumed regardless of what {@link #willConsumeItem()} says -+ *

    -+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will not be applied -+ * or saved. -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Added-PlayerDeepSleepEvent.patch b/patches/api/Added-PlayerDeepSleepEvent.patch deleted file mode 100644 index 9899504cbe..0000000000 --- a/patches/api/Added-PlayerDeepSleepEvent.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 21 Apr 2021 15:58:25 -0700 -Subject: [PATCH] Added PlayerDeepSleepEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a player has slept long enough -+ * to count as passing the night/storm. -+ *

    -+ * Cancelling this event will prevent the player from being counted as deeply sleeping -+ * unless they exit and re-enter the bed. -+ */ -+@NullMarked -+public class PlayerDeepSleepEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerDeepSleepEvent(final Player player) { -+ super(player); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Added-PlayerLecternPageChangeEvent.patch b/patches/api/Added-PlayerLecternPageChangeEvent.patch deleted file mode 100644 index cc3e64f46f..0000000000 --- a/patches/api/Added-PlayerLecternPageChangeEvent.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 23 Nov 2020 12:58:16 -0800 -Subject: [PATCH] Added PlayerLecternPageChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Lectern; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+public class PlayerLecternPageChangeEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Lectern lectern; -+ private final ItemStack book; -+ private final PageChangeDirection pageChangeDirection; -+ private final int oldPage; -+ private int newPage; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerLecternPageChangeEvent(final Player player, final Lectern lectern, final ItemStack book, final PageChangeDirection pageChangeDirection, final int oldPage, final int newPage) { -+ super(player); -+ this.lectern = lectern; -+ this.book = book; -+ this.pageChangeDirection = pageChangeDirection; -+ this.oldPage = oldPage; -+ this.newPage = newPage; -+ } -+ -+ /** -+ * Gets the lectern involved. -+ * -+ * @return the Lectern -+ */ -+ public Lectern getLectern() { -+ return this.lectern; -+ } -+ -+ /** -+ * Gets the current ItemStack on the lectern. -+ * -+ * @return the ItemStack on the Lectern -+ */ -+ public ItemStack getBook() { -+ return this.book; -+ } -+ -+ /** -+ * Gets the page change direction. This is essentially returns which button the player clicked, left or right. -+ * -+ * @return the page change direction -+ */ -+ public PageChangeDirection getPageChangeDirection() { -+ return this.pageChangeDirection; -+ } -+ -+ /** -+ * Gets the page changed from. Pages are 0-indexed. -+ * -+ * @return the page changed from -+ */ -+ public int getOldPage() { -+ return this.oldPage; -+ } -+ -+ /** -+ * Gets the page changed to. Pages are 0-indexed. -+ * -+ * @return the page changed to -+ */ -+ public int getNewPage() { -+ return this.newPage; -+ } -+ -+ /** -+ * Sets the page changed to. Pages are 0-indexed. -+ * Page indices that are greater than the number of pages will show the last page. -+ * -+ * @param newPage the new paged changed to -+ */ -+ public void setNewPage(final int newPage) { -+ this.newPage = newPage; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum PageChangeDirection { -+ LEFT, -+ RIGHT, -+ } -+} diff --git a/patches/api/Added-PlayerLoomPatternSelectEvent.patch b/patches/api/Added-PlayerLoomPatternSelectEvent.patch deleted file mode 100644 index 1eb38f6dd3..0000000000 --- a/patches/api/Added-PlayerLoomPatternSelectEvent.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 25 Nov 2020 16:33:42 -0800 -Subject: [PATCH] Added PlayerLoomPatternSelectEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.banner.PatternType; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.LoomInventory; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a player selects a banner patten in a loom inventory. -+ */ -+@NullMarked -+public class PlayerLoomPatternSelectEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final LoomInventory loomInventory; -+ private PatternType patternType; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerLoomPatternSelectEvent(final Player player, final LoomInventory loomInventory, final PatternType patternType) { -+ super(player); -+ this.loomInventory = loomInventory; -+ this.patternType = patternType; -+ } -+ -+ /** -+ * Gets the loom inventory involved. -+ * -+ * @return the loom inventory -+ */ -+ public LoomInventory getLoomInventory() { -+ return this.loomInventory; -+ } -+ -+ /** -+ * Gets the pattern type selected. -+ * -+ * @return the pattern type -+ */ -+ public PatternType getPatternType() { -+ return this.patternType; -+ } -+ -+ /** -+ * Sets the pattern type selected. -+ * -+ * @param patternType the pattern type -+ */ -+ public void setPatternType(final PatternType patternType) { -+ this.patternType = patternType; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/api/Added-PlayerStonecutterRecipeSelectEvent.patch deleted file mode 100644 index c35b3d8d60..0000000000 --- a/patches/api/Added-PlayerStonecutterRecipeSelectEvent.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 27 Nov 2020 17:13:59 -0800 -Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.StonecutterInventory; -+import org.bukkit.inventory.StonecuttingRecipe; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+public class PlayerStonecutterRecipeSelectEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final StonecutterInventory stonecutterInventory; -+ private StonecuttingRecipe stonecuttingRecipe; -+ -+ private boolean cancelled; -+ -+ public PlayerStonecutterRecipeSelectEvent(final Player player, final StonecutterInventory stonecutterInventory, final StonecuttingRecipe stonecuttingRecipe) { -+ super(player); -+ this.stonecutterInventory = stonecutterInventory; -+ this.stonecuttingRecipe = stonecuttingRecipe; -+ } -+ -+ public StonecutterInventory getStonecutterInventory() { -+ return this.stonecutterInventory; -+ } -+ -+ public StonecuttingRecipe getStonecuttingRecipe() { -+ return this.stonecuttingRecipe; -+ } -+ -+ public void setStonecuttingRecipe(final StonecuttingRecipe stonecuttingRecipe) { -+ this.stonecuttingRecipe = stonecuttingRecipe; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Added-PlayerTradeEvent.patch b/patches/api/Added-PlayerTradeEvent.patch deleted file mode 100644 index 43ef567de9..0000000000 --- a/patches/api/Added-PlayerTradeEvent.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 2 Jul 2020 16:10:10 -0700 -Subject: [PATCH] Added PlayerTradeEvent - -[Amendment: Alexander ] -PlayerTradeEvent is used for player purchases from villagers and wandering -traders, but not custom merchants created via Bukkit.createMerchant(). During -discussions in Discord it was decided that it'd be better to add a new event -that PlayerTradeEvent inherits from than change getVillager()'s annotation to -@Nullable, especially since that'd also infringe on the implication of the -event being about villager trades. - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.MerchantRecipe; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a player trades with a standalone merchant GUI. -+ */ -+@NullMarked -+public class PlayerPurchaseEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean rewardExp; -+ private boolean increaseTradeUses; -+ private MerchantRecipe trade; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerPurchaseEvent(final Player player, final MerchantRecipe trade, final boolean rewardExp, final boolean increaseTradeUses) { -+ super(player); -+ this.trade = trade; -+ this.rewardExp = rewardExp; -+ this.increaseTradeUses = increaseTradeUses; -+ } -+ -+ /** -+ * Gets the associated trade with this event -+ * -+ * @return the trade -+ */ -+ public MerchantRecipe getTrade() { -+ return this.trade; -+ } -+ -+ /** -+ * Sets the trade. This is then used to determine the next prices -+ * -+ * @param trade the trade to use -+ */ -+ public void setTrade(final MerchantRecipe trade) { -+ Preconditions.checkArgument(trade != null, "Trade cannot be null!"); -+ this.trade = trade; -+ } -+ -+ /** -+ * @return will trade try to reward exp -+ */ -+ public boolean isRewardingExp() { -+ return this.rewardExp; -+ } -+ -+ /** -+ * Sets whether the trade will try to reward exp -+ * -+ * @param rewardExp try to reward exp -+ */ -+ public void setRewardExp(final boolean rewardExp) { -+ this.rewardExp = rewardExp; -+ } -+ -+ /** -+ * @return whether the trade will count as a use of the trade -+ */ -+ public boolean willIncreaseTradeUses() { -+ return this.increaseTradeUses; -+ } -+ -+ /** -+ * Sets whether the trade will count as a use -+ * -+ * @param increaseTradeUses {@code true} to count, {@code false} otherwise -+ */ -+ public void setIncreaseTradeUses(final boolean increaseTradeUses) { -+ this.increaseTradeUses = increaseTradeUses; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+} -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java -new file mode 100755 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.AbstractVillager; -+import org.bukkit.entity.Player; -+import org.bukkit.inventory.MerchantRecipe; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when a player trades with a villager or wandering trader -+ */ -+@NullMarked -+public class PlayerTradeEvent extends PlayerPurchaseEvent { -+ -+ private final AbstractVillager villager; -+ -+ @ApiStatus.Internal -+ public PlayerTradeEvent(final Player player, final AbstractVillager villager, final MerchantRecipe trade, final boolean rewardExp, final boolean increaseTradeUses) { -+ super(player, trade, rewardExp, increaseTradeUses); -+ this.villager = villager; -+ } -+ -+ /** -+ * Gets the Villager or Wandering trader associated with this event -+ * -+ * @return the villager or wandering trader -+ */ -+ public AbstractVillager getVillager() { -+ return this.villager; -+ } -+ -+} diff --git a/patches/api/Added-ServerResourcesReloadedEvent.patch b/patches/api/Added-ServerResourcesReloadedEvent.patch deleted file mode 100644 index b2dadd0ddc..0000000000 --- a/patches/api/Added-ServerResourcesReloadedEvent.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 2 Dec 2020 20:04:16 -0800 -Subject: [PATCH] Added ServerResourcesReloadedEvent - - -diff --git a/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.server; -+ -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.server.ServerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload) -+ *

    -+ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this. -+ */ -+@NullMarked -+public class ServerResourcesReloadedEvent extends ServerEvent { -+ -+ public static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Cause cause; -+ -+ @ApiStatus.Internal -+ public ServerResourcesReloadedEvent(final Cause cause) { -+ this.cause = cause; -+ } -+ -+ /** -+ * Gets the cause of the resource reload. -+ * -+ * @return the reload cause -+ */ -+ public Cause getCause() { -+ return this.cause; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public enum Cause { -+ COMMAND, -+ PLUGIN, -+ } -+} diff --git a/patches/api/Added-WorldGameRuleChangeEvent.patch b/patches/api/Added-WorldGameRuleChangeEvent.patch deleted file mode 100644 index 1f37fdbb45..0000000000 --- a/patches/api/Added-WorldGameRuleChangeEvent.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 20 Dec 2020 16:41:44 -0800 -Subject: [PATCH] Added WorldGameRuleChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java b/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.world; -+ -+import org.bukkit.GameRule; -+import org.bukkit.World; -+import org.bukkit.command.CommandSender; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.world.WorldEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Called when a world's gamerule is changed, either by command or by api. -+ */ -+@NullMarked -+public class WorldGameRuleChangeEvent extends WorldEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final @Nullable CommandSender commandSender; -+ private final GameRule gameRule; -+ private String value; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WorldGameRuleChangeEvent(final World world, final @Nullable CommandSender commandSender, final GameRule gameRule, final String value) { -+ super(world); -+ this.commandSender = commandSender; -+ this.gameRule = gameRule; -+ this.value = value; -+ } -+ -+ /** -+ * Gets the command sender associated with this event. -+ * -+ * @return {@code null} if the gamerule was changed via api, otherwise the {@link CommandSender}. -+ */ -+ public @Nullable CommandSender getCommandSender() { -+ return this.commandSender; -+ } -+ -+ /** -+ * Gets the game rule associated with this event. -+ * -+ * @return the gamerule being changed. -+ */ -+ public GameRule getGameRule() { -+ return this.gameRule; -+ } -+ -+ /** -+ * Gets the new value of the gamerule. -+ * -+ * @return the new value of the gamerule. -+ */ -+ public String getValue() { -+ return this.value; -+ } -+ -+ /** -+ * Sets the new value of this gamerule. -+ * -+ * @param value the new value of the gamerule. -+ */ -+ public void setValue(final String value) { -+ this.value = value; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/Added-byte-array-serialization-deserialization-for-P.patch b/patches/api/Added-byte-array-serialization-deserialization-for-P.patch deleted file mode 100644 index 648329c15b..0000000000 --- a/patches/api/Added-byte-array-serialization-deserialization-for-P.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nex -Date: Thu, 24 Feb 2022 16:28:08 +0100 -Subject: [PATCH] Added byte array serialization/deserialization for - PersistentDataContainers - - -diff --git a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java -+++ b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java -@@ -0,0 +0,0 @@ public interface PersistentDataContainer { - */ - @NotNull - PersistentDataAdapterContext getAdapterContext(); -+ -+ // Paper start - byte array serialization -+ /** -+ * Serialize this {@link PersistentDataContainer} instance to a -+ * byte array. -+ * -+ * @return a binary representation of this container -+ * @throws java.io.IOException if we fail to write this container to a byte array -+ */ -+ byte @NotNull [] serializeToBytes() throws java.io.IOException; -+ -+ /** -+ * Read values from a serialised byte array into this -+ * {@link PersistentDataContainer} instance. -+ * -+ * @param bytes the byte array to read from -+ * @param clear if true, this {@link PersistentDataContainer} instance -+ * will be cleared before reading -+ * @throws java.io.IOException if the byte array has an invalid format -+ */ -+ void readFromBytes(byte @NotNull [] bytes, boolean clear) throws java.io.IOException; -+ -+ /** -+ * Read values from a serialised byte array into this -+ * {@link PersistentDataContainer} instance. -+ * This method has the same effect as -+ * PersistentDataContainer#readFromBytes(bytes, true) -+ * -+ * @param bytes the byte array to read from -+ * @throws java.io.IOException if the byte array has an invalid format -+ */ -+ default void readFromBytes(final byte @NotNull [] bytes) throws java.io.IOException { -+ this.readFromBytes(bytes, true); -+ } -+ // Paper end - byte array serialization - } diff --git a/patches/api/Additional-Block-Material-API-s.patch b/patches/api/Additional-Block-Material-API-s.patch deleted file mode 100644 index 2439118514..0000000000 --- a/patches/api/Additional-Block-Material-API-s.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 30 Dec 2020 17:27:27 -0500 -Subject: [PATCH] Additional Block Material API's - -Faster version for isSolid() that utilizes NMS's state for isSolid instead of the slower -process to do this in the Bukkit API - -Adds API for buildable, replaceable, burnable too. - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - */ - boolean isLiquid(); - -+ // Paper start -+ /** -+ * Check if this block is solid -+ *

    -+ * Determined by Minecraft, typically a block a player can use to place a new block to build things. -+ * An example of a non buildable block would be liquids, flowers, or fire -+ * -+ * @return true if block is buildable -+ */ -+ boolean isBuildable(); -+ /** -+ * Check if this block is burnable -+ *

    -+ * Determined by Minecraft, typically a block that fire can destroy (Wool, Wood) -+ * -+ * @return true if block is burnable -+ */ -+ boolean isBurnable(); -+ /** -+ * Check if this block is replaceable -+ *

    -+ * Determined by Minecraft, representing a block that is not AIR that you can still place a new block at, such as flowers. -+ * @return true if block is replaceable -+ */ -+ boolean isReplaceable(); -+ /** -+ * Check if this block is solid -+ *

    -+ * Determined by Minecraft, typically a block a player can stand on and can't be passed through. -+ * -+ * This API is faster than accessing Material#isSolid as it avoids a material lookup and switch statement. -+ * @return true if block is solid -+ */ -+ boolean isSolid(); -+ // Paper end -+ - /** - * Gets the temperature of this block. - *

    diff --git a/patches/api/Additional-world.getNearbyEntities-API-s.patch b/patches/api/Additional-world.getNearbyEntities-API-s.patch deleted file mode 100644 index bdb80efe42..0000000000 --- a/patches/api/Additional-world.getNearbyEntities-API-s.patch +++ /dev/null @@ -1,260 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 30 Apr 2018 17:55:28 -0400 -Subject: [PATCH] Additional world.getNearbyEntities API's - -Provides more methods to get nearby entities, and filter by types and predicates - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ - package org.bukkit; - - import java.io.File; -+import org.bukkit.generator.ChunkGenerator; -+ -+import java.util.ArrayList; - import java.util.Collection; - import java.util.HashMap; - import java.util.List; -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @NotNull - public Collection getEntitiesByClasses(@NotNull Class... classes); - -+ // Paper start - additional getNearbyEntities API -+ /** -+ * Gets nearby LivingEntities within the specified radius (bounding box) -+ * @param loc Center location -+ * @param radius Radius -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double radius) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, radius, radius, radius); -+ } -+ -+ /** -+ * Gets nearby LivingEntities within the specified radius (bounding box) -+ * @param loc Center location -+ * @param xzRadius X/Z Radius -+ * @param yRadius Y Radius -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double xzRadius, final double yRadius) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xzRadius, yRadius, xzRadius); -+ } -+ -+ /** -+ * Gets nearby LivingEntities within the specified radius (bounding box) -+ * @param loc Center location -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z radius -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xRadius, yRadius, zRadius); -+ } -+ -+ /** -+ * Gets nearby LivingEntities within the specified radius (bounding box) -+ * @param loc Center location -+ * @param radius X Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of living entities near location. This will always be a non-null collection -+ */ -+ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double radius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, radius, radius, radius, predicate); -+ } -+ -+ /** -+ * Gets nearby LivingEntities within the specified radius (bounding box) -+ * @param loc Center location -+ * @param xzRadius X/Z Radius -+ * @param yRadius Y Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of living entities near location. This will always be a non-null collection -+ */ -+ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xzRadius, yRadius, xzRadius, predicate); -+ } -+ -+ /** -+ * Gets nearby LivingEntities within the specified radius (bounding box) -+ * @param loc Center location -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of living entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xRadius, yRadius, zRadius, predicate); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param loc Center location -+ * @param radius X/Y/Z Radius -+ * @return the collection of living entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double radius) { -+ return this.getNearbyEntitiesByType(Player.class, loc, radius, radius, radius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param loc Center location -+ * @param xzRadius X/Z Radius -+ * @param yRadius Y Radius -+ * @return the collection of living entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double xzRadius, final double yRadius) { -+ return this.getNearbyEntitiesByType(Player.class, loc, xzRadius, yRadius, xzRadius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param loc Center location -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z Radius -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) { -+ return this.getNearbyEntitiesByType(Player.class, loc, xRadius, yRadius, zRadius); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param loc Center location -+ * @param radius X/Y/Z Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double radius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(Player.class, loc, radius, radius, radius, predicate); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param loc Center location -+ * @param xzRadius X/Z Radius -+ * @param yRadius Y Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(Player.class, loc, xzRadius, yRadius, xzRadius, predicate); -+ } -+ -+ /** -+ * Gets nearby players within the specified radius (bounding box) -+ * @param loc Center location -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z Radius -+ * @param predicate a predicate used to filter results -+ * @return the collection of players near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(Player.class, loc, xRadius, yRadius, zRadius, predicate); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius (bounding box) -+ * @param clazz Type to filter by -+ * @param loc Center location -+ * @param radius X/Y/Z radius to search within -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double radius) { -+ return this.getNearbyEntitiesByType(clazz, loc, radius, radius, radius, null); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box) -+ * @param clazz Type to filter by -+ * @param loc Center location -+ * @param xzRadius X/Z radius to search within -+ * @param yRadius Y radius to search within -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double xzRadius, final double yRadius) { -+ return this.getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, null); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius (bounding box) -+ * @param clazz Type to filter by -+ * @param loc Center location -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z Radius -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) { -+ return this.getNearbyEntitiesByType(clazz, loc, xRadius, yRadius, zRadius, null); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius (bounding box) -+ * @param clazz Type to filter by -+ * @param loc Center location -+ * @param radius X/Y/Z radius to search within -+ * @param predicate a predicate used to filter results -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double radius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(clazz, loc, radius, radius, radius, predicate); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box) -+ * @param clazz Type to filter by -+ * @param loc Center location -+ * @param xzRadius X/Z radius to search within -+ * @param yRadius Y radius to search within -+ * @param predicate a predicate used to filter results -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { -+ return this.getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, predicate); -+ } -+ -+ /** -+ * Gets all nearby entities of the specified type, within the specified radius (bounding box) -+ * @param clazz Type to filter by -+ * @param loc Center location -+ * @param xRadius X Radius -+ * @param yRadius Y Radius -+ * @param zRadius Z Radius -+ * @param predicate a predicate used to filter results -+ * @param the entity type -+ * @return the collection of entities near location. This will always be a non-null collection. -+ */ -+ default @NotNull Collection getNearbyEntitiesByType(@Nullable Class clazz, final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { -+ if (clazz == null) { -+ clazz = Entity.class; -+ } -+ final List nearby = new ArrayList<>(); -+ for (final Entity bukkitEntity : this.getNearbyEntities(loc, xRadius, yRadius, zRadius)) { -+ //noinspection unchecked -+ if (clazz.isAssignableFrom(bukkitEntity.getClass()) && (predicate == null || predicate.test((T) bukkitEntity))) { -+ //noinspection unchecked -+ nearby.add((T) bukkitEntity); -+ } -+ } -+ return nearby; -+ } -+ // Paper end - additional getNearbyEntities API -+ - /** - * Get a list of all players in this World - * diff --git a/patches/api/Adds-PlayerArmSwingEvent.patch b/patches/api/Adds-PlayerArmSwingEvent.patch deleted file mode 100644 index 857f819198..0000000000 --- a/patches/api/Adds-PlayerArmSwingEvent.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 12 Mar 2021 19:20:03 -0800 -Subject: [PATCH] Adds PlayerArmSwingEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.player.PlayerAnimationEvent; -+import org.bukkit.event.player.PlayerAnimationType; -+import org.bukkit.inventory.EquipmentSlot; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+public class PlayerArmSwingEvent extends PlayerAnimationEvent { -+ -+ private final EquipmentSlot equipmentSlot; -+ -+ @ApiStatus.Internal -+ public PlayerArmSwingEvent(final Player player, final EquipmentSlot equipmentSlot) { -+ super(player, equipmentSlot == EquipmentSlot.HAND ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); -+ this.equipmentSlot = equipmentSlot; -+ } -+ -+ /** -+ * Returns the hand of the arm swing. -+ * -+ * @return the hand -+ */ -+ public EquipmentSlot getHand() { -+ return this.equipmentSlot; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - - /** - * Represents a player animation event -+ *
    Use {@link io.papermc.paper.event.player.PlayerArmSwingEvent} for determining which arm was swung. - */ - public class PlayerAnimationEvent extends PlayerEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch deleted file mode 100644 index 60ac07f447..0000000000 --- a/patches/api/Adventure.patch +++ /dev/null @@ -1,5660 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Fri, 29 Jan 2021 17:21:55 +0100 -Subject: [PATCH] Adventure - -Co-authored-by: zml -Co-authored-by: Jake Potrebic -Co-authored-by: Yannick Lamprecht - -diff --git a/build.gradle.kts b/build.gradle.kts -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/build.gradle.kts -+++ b/build.gradle.kts -@@ -0,0 +0,0 @@ java { - - val annotationsVersion = "24.1.0" - val bungeeCordChatVersion = "1.20-R0.2" -+val adventureVersion = "4.17.0" -+val apiAndDocs: Configuration by configurations.creating { -+ attributes { -+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION)) -+ attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL)) -+ attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType.SOURCES)) -+ attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) -+ } -+} -+configurations.api { -+ extendsFrom(apiAndDocs) -+} - - // Paper start - configure mockito agent that is needed in newer java versions - val mockitoAgent = configurations.register("mockitoAgent") -@@ -0,0 +0,0 @@ dependencies { - // api dependencies are listed transitively to API consumers - api("com.google.guava:guava:33.3.1-jre") - api("com.google.code.gson:gson:2.11.0") -- api("net.md-5:bungeecord-chat:$bungeeCordChatVersion") -+ // Paper start - adventure -+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.19") { -+ exclude("com.google.guava", "guava") -+ } -+ // Paper - adventure - api("org.yaml:snakeyaml:2.2") - api("org.joml:joml:1.10.8") { - isTransitive = false // https://github.com/JOML-CI/JOML/issues/352 -@@ -0,0 +0,0 @@ dependencies { - isTransitive = false // includes junit - } - api("it.unimi.dsi:fastutil:8.5.15") -+ apiAndDocs(platform("net.kyori:adventure-bom:$adventureVersion")) -+ apiAndDocs("net.kyori:adventure-api") -+ apiAndDocs("net.kyori:adventure-text-minimessage") -+ apiAndDocs("net.kyori:adventure-text-serializer-gson") -+ apiAndDocs("net.kyori:adventure-text-serializer-legacy") -+ apiAndDocs("net.kyori:adventure-text-serializer-plain") -+ apiAndDocs("net.kyori:adventure-text-logger-slf4j") - // Paper end - - compileOnly("org.apache.maven:maven-resolver-provider:3.9.6") -@@ -0,0 +0,0 @@ tasks.withType { - "https://guava.dev/releases/33.3.1-jre/api/docs/", - "https://javadoc.io/doc/org.yaml/snakeyaml/2.2/", - "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations -- "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", -+ // "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", // Paper - don't link to bungee chat - // Paper start - add missing javadoc links - "https://javadoc.io/doc/org.joml/joml/1.10.8/index.html", - "https://www.javadoc.io/doc/com.google.code.gson/gson/2.11.0", - "https://jspecify.dev/docs/api/", - // Paper end -+ // Paper start -+ "https://jd.advntr.dev/api/$adventureVersion/", -+ "https://jd.advntr.dev/key/$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:") - -+ inputs.files(apiAndDocs).ignoreEmptyDirectories().withPropertyName(apiAndDocs.name + "-configuration") -+ doFirst { -+ options.addStringOption( -+ "sourcepath", -+ apiAndDocs.elements.get().map { it.asFile }.joinToString(separator = File.pathSeparator, transform = File::getPath) -+ ) -+ } -+ - // workaround for https://github.com/gradle/gradle/issues/4046 - inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset") - doLast { -diff --git a/src/main/java/io/papermc/paper/chat/ChatRenderer.java b/src/main/java/io/papermc/paper/chat/ChatRenderer.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/chat/ChatRenderer.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.chat; -+ -+import net.kyori.adventure.audience.Audience; -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.Player; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A chat renderer is responsible for rendering chat messages sent by {@link Player}s to the server. -+ */ -+@NullMarked -+@FunctionalInterface -+public interface ChatRenderer { -+ -+ /** -+ * Renders a chat message. This will be called once for each receiving {@link Audience}. -+ * -+ * @param source the message source -+ * @param sourceDisplayName the display name of the source player -+ * @param message the chat message -+ * @param viewer the receiving {@link Audience} -+ * @return a rendered chat message -+ */ -+ @ApiStatus.OverrideOnly -+ Component render(Player source, Component sourceDisplayName, Component message, Audience viewer); -+ -+ /** -+ * Create a new instance of the default {@link ChatRenderer}. -+ * -+ * @return a new {@link ChatRenderer} -+ */ -+ static ChatRenderer defaultRenderer() { -+ return new ViewerUnawareImpl.Default((source, sourceDisplayName, message) -> Component.translatable("chat.type.text", sourceDisplayName, message)); -+ } -+ -+ @ApiStatus.Internal -+ sealed interface Default extends ChatRenderer, ViewerUnaware permits ViewerUnawareImpl.Default { -+ } -+ -+ /** -+ * Creates a new viewer-unaware {@link ChatRenderer}, which will render the chat message a single time, -+ * displaying the same rendered message to every viewing {@link Audience}. -+ * -+ * @param renderer the viewer unaware renderer -+ * @return a new {@link ChatRenderer} -+ */ -+ static ChatRenderer viewerUnaware(final ViewerUnaware renderer) { -+ return new ViewerUnawareImpl(renderer); -+ } -+ -+ /** -+ * Similar to {@link ChatRenderer}, but without knowledge of the message viewer. -+ * -+ * @see ChatRenderer#viewerUnaware(ViewerUnaware) -+ */ -+ interface ViewerUnaware { -+ -+ /** -+ * Renders a chat message. -+ * -+ * @param source the message source -+ * @param sourceDisplayName the display name of the source player -+ * @param message the chat message -+ * @return a rendered chat message -+ */ -+ @ApiStatus.OverrideOnly -+ Component render(Player source, Component sourceDisplayName, Component message); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/chat/ViewerUnawareImpl.java b/src/main/java/io/papermc/paper/chat/ViewerUnawareImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/chat/ViewerUnawareImpl.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.chat; -+ -+import net.kyori.adventure.audience.Audience; -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.Player; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+@ApiStatus.Internal -+@NullMarked -+sealed class ViewerUnawareImpl implements ChatRenderer, ChatRenderer.ViewerUnaware permits ViewerUnawareImpl.Default { -+ private final ViewerUnaware unaware; -+ private @Nullable Component message; -+ -+ ViewerUnawareImpl(final ViewerUnaware unaware) { -+ this.unaware = unaware; -+ } -+ -+ @Override -+ public Component render(final Player source, final Component sourceDisplayName, final Component message, final Audience viewer) { -+ return this.render(source, sourceDisplayName, message); -+ } -+ -+ @Override -+ public Component render(final Player source, final Component sourceDisplayName, final Component message) { -+ if (this.message == null) { -+ this.message = this.unaware.render(source, sourceDisplayName, message); -+ } -+ return this.message; -+ } -+ -+ static final class Default extends ViewerUnawareImpl implements ChatRenderer.Default { -+ Default(final ViewerUnaware unaware) { -+ super(unaware); -+ } -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/player/AbstractChatEvent.java b/src/main/java/io/papermc/paper/event/player/AbstractChatEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/AbstractChatEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import io.papermc.paper.chat.ChatRenderer; -+import java.util.Set; -+import net.kyori.adventure.audience.Audience; -+import net.kyori.adventure.chat.SignedMessage; -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+import static java.util.Objects.requireNonNull; -+ -+/** -+ * An abstract implementation of a chat event, handling shared logic. -+ */ -+@ApiStatus.NonExtendable -+@NullMarked -+public abstract class AbstractChatEvent extends PlayerEvent implements Cancellable { -+ -+ private final Set viewers; -+ private final Component originalMessage; -+ private final SignedMessage signedMessage; -+ private ChatRenderer renderer; -+ private Component message; -+ -+ private boolean cancelled; -+ -+ AbstractChatEvent(final boolean async, final Player player, final Set viewers, final ChatRenderer renderer, final Component message, final Component originalMessage, final SignedMessage signedMessage) { -+ super(player, async); -+ this.viewers = viewers; -+ this.renderer = renderer; -+ this.message = message; -+ this.originalMessage = originalMessage; -+ this.signedMessage = signedMessage; -+ } -+ -+ /** -+ * Gets a set of {@link Audience audiences} that this chat message will be displayed to. -+ * -+ *

    The set returned may auto-populate on access. Any listener accessing the returned set should be aware that -+ * it may reduce performance for a lazy set implementation.

    -+ * -+ * @return a mutable set of {@link Audience audiences} who will receive the chat message -+ */ -+ public final Set viewers() { -+ return this.viewers; -+ } -+ -+ /** -+ * Sets the chat renderer. -+ * -+ * @param renderer the chat renderer -+ * @throws NullPointerException if {@code renderer} is {@code null} -+ */ -+ public final void renderer(final ChatRenderer renderer) { -+ this.renderer = requireNonNull(renderer, "renderer"); -+ } -+ -+ /** -+ * Gets the chat renderer. -+ * -+ * @return the chat renderer -+ */ -+ public final ChatRenderer renderer() { -+ return this.renderer; -+ } -+ -+ /** -+ * Gets the user-supplied message. -+ * The return value will reflect changes made using {@link #message(Component)}. -+ * -+ * @return the user-supplied message -+ */ -+ public final Component message() { -+ return this.message; -+ } -+ -+ /** -+ * Sets the user-supplied message. -+ * -+ * @param message the user-supplied message -+ * @throws NullPointerException if {@code message} is {@code null} -+ */ -+ public final void message(final Component message) { -+ this.message = requireNonNull(message, "message"); -+ } -+ -+ /** -+ * Gets the original and unmodified user-supplied message. -+ * The return value will not reflect changes made using -+ * {@link #message(Component)}. -+ * -+ * @return the original user-supplied message -+ */ -+ public final Component originalMessage() { -+ return this.originalMessage; -+ } -+ -+ /** -+ * Gets the signed message. -+ * Changes made in this event will not update -+ * the signed message. -+ * -+ * @return the signed message -+ */ -+ public final SignedMessage signedMessage() { -+ return this.signedMessage; -+ } -+ -+ @Override -+ public final boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public final void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+@ApiStatus.Experimental -+@NullMarked -+public class AsyncChatCommandDecorateEvent extends AsyncChatDecorateEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @ApiStatus.Internal -+ public AsyncChatCommandDecorateEvent(final @Nullable Player player, final Component originalMessage) { -+ super(player, originalMessage); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.server.ServerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * This event is fired when the server decorates a component for chat purposes. This is called -+ * before {@link AsyncChatEvent} and the other chat events. It is recommended that you modify the -+ * message here, and use the chat events for modifying receivers and later the chat type. If you -+ * want to keep the message as "signed" for the clients who get it, be sure to include the entire -+ * original message somewhere in the final message. -+ *
    -+ * See {@link AsyncChatCommandDecorateEvent} for the decoration of messages sent via commands -+ */ -+@ApiStatus.Experimental -+@NullMarked -+public class AsyncChatDecorateEvent extends ServerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final @Nullable Player player; -+ private final Component originalMessage; -+ private Component result; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public AsyncChatDecorateEvent(final @Nullable Player player, final Component originalMessage) { -+ super(true); -+ this.player = player; -+ this.originalMessage = originalMessage; -+ this.result = originalMessage; -+ } -+ -+ /** -+ * Gets the player (if available) associated with this event. -+ *

    -+ * Certain commands request decorations without a player context -+ * which is why this is possibly null. -+ * -+ * @return the player or {@code null} -+ */ -+ public @Nullable Player player() { -+ return this.player; -+ } -+ -+ /** -+ * Gets the original decoration input -+ * -+ * @return the input -+ */ -+ public Component originalMessage() { -+ return this.originalMessage; -+ } -+ -+ /** -+ * Gets the decoration result. This may already be different from -+ * {@link #originalMessage()} if some other listener to this event -+ * changed the result. -+ * -+ * @return the result -+ */ -+ public Component result() { -+ return this.result; -+ } -+ -+ /** -+ * Sets the resulting decorated component. -+ * -+ * @param result the result -+ */ -+ public void result(final Component result) { -+ this.result = result; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * A cancelled decorating event means that no changes to the result component -+ * will have any effect. The decorated component will be equal to the original -+ * component. -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import io.papermc.paper.chat.ChatRenderer; -+import java.util.Set; -+import net.kyori.adventure.audience.Audience; -+import net.kyori.adventure.chat.SignedMessage; -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * An event fired when a {@link Player} sends a chat message to the server. -+ *

    -+ * This event will sometimes fire synchronously, depending on how it was -+ * triggered. -+ *

    -+ * If a player is the direct cause of this event by an incoming packet, this -+ * event will be asynchronous. If a plugin triggers this event by compelling a -+ * player to chat, this event will be synchronous. -+ *

    -+ * Care should be taken to check {@link #isAsynchronous()} and treat the event -+ * appropriately. -+ */ -+@NullMarked -+public final class AsyncChatEvent extends AbstractChatEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @ApiStatus.Internal -+ public AsyncChatEvent(final boolean async, final Player player, final Set viewers, final ChatRenderer renderer, final Component message, final Component originalMessage, final SignedMessage signedMessage) { -+ super(async, player, viewers, renderer, message, originalMessage, signedMessage); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/player/ChatEvent.java b/src/main/java/io/papermc/paper/event/player/ChatEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/ChatEvent.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.event.player; -+ -+import io.papermc.paper.chat.ChatRenderer; -+import java.util.Set; -+import net.kyori.adventure.audience.Audience; -+import net.kyori.adventure.chat.SignedMessage; -+import net.kyori.adventure.text.Component; -+import org.bukkit.Warning; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * An event fired when a {@link Player} sends a chat message to the server. -+ * -+ * @deprecated Listening to this event forces chat to wait for the main thread, delaying chat messages. -+ * It is recommended to use {@link AsyncChatEvent} instead, wherever possible. -+ */ -+@Deprecated -+@Warning(reason = "Listening to this event forces chat to wait for the main thread, delaying chat messages.") -+@NullMarked -+public final class ChatEvent extends AbstractChatEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @ApiStatus.Internal -+ public ChatEvent(final Player player, final Set viewers, final ChatRenderer renderer, final Component message, final Component originalMessage, final SignedMessage signedMessage) { -+ super(false, player, viewers, renderer, message, originalMessage, signedMessage); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/text/PaperComponents.java b/src/main/java/io/papermc/paper/text/PaperComponents.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/text/PaperComponents.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.text; -+ -+import java.io.IOException; -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.flattener.ComponentFlattener; -+import net.kyori.adventure.text.format.NamedTextColor; -+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; -+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -+import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; -+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; -+import org.bukkit.Bukkit; -+import org.bukkit.command.CommandSender; -+import org.bukkit.entity.Entity; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Paper API-specific methods for working with {@link Component}s and related. -+ */ -+@NullMarked -+public final class PaperComponents { -+ -+ private PaperComponents() { -+ throw new RuntimeException("PaperComponents is not to be instantiated!"); -+ } -+ -+ /** -+ * Resolves a component with a specific command sender and subject. -+ *

    -+ * Note that in Vanilla, elevated permissions are usually required to use -+ * '@' selectors in various component types, but this method should not -+ * check such permissions from the sender. -+ *

    -+ * A {@link CommandSender} argument is required to resolve: -+ *

      -+ *
    • {@link net.kyori.adventure.text.NBTComponent}
    • -+ *
    • {@link net.kyori.adventure.text.ScoreComponent}
    • -+ *
    • {@link net.kyori.adventure.text.SelectorComponent}
    • -+ *
    -+ * A {@link Entity} argument is optional to help resolve: -+ *
      -+ *
    • {@link net.kyori.adventure.text.ScoreComponent}
    • -+ *
    -+ * {@link net.kyori.adventure.text.TranslatableComponent}s don't require any extra arguments. -+ * -+ * @param input the component to resolve -+ * @param context the command sender to resolve with -+ * @param scoreboardSubject the scoreboard subject to use (for use with {@link net.kyori.adventure.text.ScoreComponent}s) -+ * @return the resolved component -+ * @throws IOException if a syntax error tripped during resolving -+ */ -+ public static Component resolveWithContext(final Component input, final @Nullable CommandSender context, final @Nullable Entity scoreboardSubject) throws IOException { -+ return resolveWithContext(input, context, scoreboardSubject, true); -+ } -+ -+ /** -+ * Resolves a component with a specific command sender and subject. -+ *

    -+ * Note that in Vanilla, elevated permissions are required to use -+ * '@' selectors in various component types. If the boolean {@code bypassPermissions} -+ * argument is {@code false}, the {@link CommandSender} argument will be used to query -+ * those permissions. -+ *

    -+ * A {@link CommandSender} argument is required to resolve: -+ *

      -+ *
    • {@link net.kyori.adventure.text.NBTComponent}
    • -+ *
    • {@link net.kyori.adventure.text.ScoreComponent}
    • -+ *
    • {@link net.kyori.adventure.text.SelectorComponent}
    • -+ *
    -+ * A {@link Entity} argument is optional to help resolve: -+ *
      -+ *
    • {@link net.kyori.adventure.text.ScoreComponent}
    • -+ *
    -+ * {@link net.kyori.adventure.text.TranslatableComponent}s don't require any extra arguments. -+ * -+ * @param input the component to resolve -+ * @param context the command sender to resolve with -+ * @param scoreboardSubject the scoreboard subject to use (for use with {@link net.kyori.adventure.text.ScoreComponent}s) -+ * @param bypassPermissions true to bypass permissions checks for resolving components -+ * @return the resolved component -+ * @throws IOException if a syntax error tripped during resolving -+ */ -+ @SuppressWarnings("deprecation") // using unsafe as a bridge -+ public static Component resolveWithContext(final Component input, final @Nullable CommandSender context, final @Nullable Entity scoreboardSubject, final boolean bypassPermissions) throws IOException { -+ return Bukkit.getUnsafe().resolveWithContext(input, context, scoreboardSubject, bypassPermissions); -+ } -+ -+ /** -+ * Return a component flattener that can use game data to resolve extra information about components. -+ * -+ * @return a component flattener -+ */ -+ @SuppressWarnings("deprecation") // using unsafe as a bridge -+ public static ComponentFlattener flattener() { -+ return Bukkit.getUnsafe().componentFlattener(); -+ } -+ -+ /** -+ * Get a serializer for {@link Component}s that will convert components to -+ * a plain-text string. -+ * -+ *

    Implementations may provide a serializer capable of processing any -+ * information that requires access to implementation details.

    -+ * -+ * @return a serializer to plain text -+ * @deprecated will be removed in adventure 5.0.0, use {@link PlainTextComponentSerializer#plainText()} -+ */ -+ @Deprecated(forRemoval = true, since = "1.18.1") -+ public static PlainComponentSerializer plainSerializer() { -+ return Bukkit.getUnsafe().plainComponentSerializer(); -+ } -+ -+ /** -+ * Get a serializer for {@link Component}s that will convert components to -+ * a plain-text string. -+ * -+ *

    Implementations may provide a serializer capable of processing any -+ * information that requires access to implementation details.

    -+ * -+ * @return a serializer to plain text -+ * @deprecated use {@link PlainTextComponentSerializer#plainText()} -+ */ -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ public static PlainTextComponentSerializer plainTextSerializer() { -+ return Bukkit.getUnsafe().plainTextSerializer(); -+ } -+ -+ /** -+ * Get a serializer for {@link Component}s that will convert to and from the -+ * standard JSON serialization format using Gson. -+ * -+ *

    Implementations may provide a serializer capable of processing any -+ * information that requires implementation details, such as legacy -+ * (pre-1.16) hover events.

    -+ * -+ * @return a json component serializer -+ * @deprecated use {@link GsonComponentSerializer#gson()} -+ */ -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ public static GsonComponentSerializer gsonSerializer() { -+ return Bukkit.getUnsafe().gsonComponentSerializer(); -+ } -+ -+ /** -+ * Get a serializer for {@link Component}s that will convert to and from the -+ * standard JSON serialization format using Gson, downsampling any RGB colors -+ * to their nearest {@link NamedTextColor} counterpart. -+ * -+ *

    Implementations may provide a serializer capable of processing any -+ * information that requires implementation details, such as legacy -+ * (pre-1.16) hover events.

    -+ * -+ * @return a json component serializer -+ * @deprecated use {@link GsonComponentSerializer#colorDownsamplingGson()} -+ */ -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ public static GsonComponentSerializer colorDownsamplingGsonSerializer() { -+ return Bukkit.getUnsafe().colorDownsamplingGsonComponentSerializer(); -+ } -+ -+ /** -+ * Get a serializer for {@link Component}s that will convert to and from the -+ * legacy component format used by Bukkit. This serializer uses the -+ * {@link LegacyComponentSerializer.Builder#useUnusualXRepeatedCharacterHexFormat()} -+ * option to match upstream behavior. -+ * -+ *

    This legacy serializer uses the standard section symbol to mark -+ * formatting characters.

    -+ * -+ *

    Implementations may provide a serializer capable of processing any -+ * information that requires access to implementation details.

    -+ * -+ * @return a section serializer -+ * @deprecated use {@link LegacyComponentSerializer#legacySection()} -+ */ -+ @Deprecated(forRemoval = true, since = "1.18.2") -+ public static LegacyComponentSerializer legacySectionSerializer() { -+ return Bukkit.getUnsafe().legacyComponentSerializer(); -+ } -+} -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - * - * @param message the message - * @return the number of players -+ * @deprecated in favour of {@link Server#broadcast(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public static int broadcastMessage(@NotNull String message) { - return server.broadcastMessage(message); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - server.shutdown(); - } - -+ // Paper start -+ /** -+ * Broadcast a message to all players. -+ *

    -+ * This is the same as calling {@link #broadcast(net.kyori.adventure.text.Component, -+ * java.lang.String)} with the {@link Server#BROADCAST_CHANNEL_USERS} permission. -+ * -+ * @param message the message -+ * @return the number of players -+ */ -+ public static int broadcast(net.kyori.adventure.text.@NotNull Component message) { -+ return server.broadcast(message); -+ } - /** - * Broadcasts the specified message to every user with the given - * permission name. -@@ -0,0 +0,0 @@ public final class Bukkit { - * permissibles} must have to receive the broadcast - * @return number of message recipients - */ -+ public static int broadcast(net.kyori.adventure.text.@NotNull Component message, @NotNull String permission) { -+ return server.broadcast(message, permission); -+ } -+ // Paper end -+ /** -+ * Broadcasts the specified message to every user with the given -+ * permission name. -+ * -+ * @param message message to broadcast -+ * @param permission the required permission {@link Permissible -+ * permissibles} must have to receive the broadcast -+ * @return number of message recipients -+ * @deprecated in favour of {@link #broadcast(net.kyori.adventure.text.Component, String)} -+ */ -+ @Deprecated // Paper - public static int broadcast(@NotNull String message, @NotNull String permission) { - return server.broadcast(message, permission); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.createInventory(owner, type); - } - -+ // Paper start - /** - * Creates an empty inventory with the specified type and title. If the type - * is {@link InventoryType#CHEST}, the new inventory has a size of 27; -@@ -0,0 +0,0 @@ public final class Bukkit { - * @see InventoryType#isCreatable() - */ - @NotNull -+ public static Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, net.kyori.adventure.text.@NotNull Component title) { -+ return server.createInventory(owner, type, title); -+ } -+ // Paper end -+ -+ /** -+ * Creates an empty inventory with the specified type and title. If the type -+ * is {@link InventoryType#CHEST}, the new inventory has a size of 27; -+ * otherwise the new inventory has the normal size for its type.
    -+ * It should be noted that some inventory types do not support titles and -+ * may not render with said titles on the Minecraft client. -+ *
    -+ * {@link InventoryType#WORKBENCH} will not process crafting recipes if -+ * created with this method. Use -+ * {@link Player#openWorkbench(Location, boolean)} instead. -+ *
    -+ * {@link InventoryType#ENCHANTING} will not process {@link ItemStack}s -+ * for possible enchanting results. Use -+ * {@link Player#openEnchanting(Location, boolean)} instead. -+ * -+ * @param owner The holder of the inventory; can be null if there's no holder. -+ * @param type The type of inventory to create. -+ * @param title The title of the inventory, to be displayed when it is viewed. -+ * @return The new inventory. -+ * @throws IllegalArgumentException if the {@link InventoryType} cannot be -+ * viewed. -+ * @deprecated in favour of {@link #createInventory(InventoryHolder, InventoryType, net.kyori.adventure.text.Component)} -+ * -+ * @see InventoryType#isCreatable() -+ */ -+ @Deprecated // Paper -+ @NotNull - public static Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title) { - return server.createInventory(owner, type, title); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.createInventory(owner, size); - } - -+ // Paper start - /** - * Creates an empty inventory of type {@link InventoryType#CHEST} with the - * specified size and title. -@@ -0,0 +0,0 @@ public final class Bukkit { - * @throws IllegalArgumentException if the size is not a multiple of 9 - */ - @NotNull -+ public static Inventory createInventory(@Nullable InventoryHolder owner, int size, net.kyori.adventure.text.@NotNull Component title) throws IllegalArgumentException { -+ return server.createInventory(owner, size, title); -+ } -+ // Paper end -+ -+ /** -+ * Creates an empty inventory of type {@link InventoryType#CHEST} with the -+ * specified size and title. -+ * -+ * @param owner the holder of the inventory, or null to indicate no holder -+ * @param size a multiple of 9 as the size of inventory to create -+ * @param title the title of the inventory, displayed when inventory is -+ * viewed -+ * @return a new inventory -+ * @throws IllegalArgumentException if the size is not a multiple of 9 -+ * @deprecated in favour of {@link #createInventory(InventoryHolder, InventoryType, net.kyori.adventure.text.Component)} -+ */ -+ @Deprecated // Paper -+ @NotNull - public static Inventory createInventory(@Nullable InventoryHolder owner, int size, @NotNull String title) throws IllegalArgumentException { - return server.createInventory(owner, size, title); - } - -+ // Paper start - /** - * Creates an empty merchant. - * -@@ -0,0 +0,0 @@ public final class Bukkit { - * when the merchant inventory is viewed - * @return a new merchant - */ -+ public static @NotNull Merchant createMerchant(net.kyori.adventure.text.@Nullable Component title) { -+ return server.createMerchant(title); -+ } -+ // Paper start -+ /** -+ * Creates an empty merchant. -+ * -+ * @param title the title of the corresponding merchant inventory, displayed -+ * when the merchant inventory is viewed -+ * @return a new merchant -+ * @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)} -+ */ - @NotNull -+ @Deprecated // Paper - public static Merchant createMerchant(@Nullable String title) { - return server.createMerchant(title); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.isPrimaryThread(); - } - -+ // Paper start -+ /** -+ * Gets the message that is displayed on the server list. -+ * -+ * @return the server's MOTD -+ */ -+ @NotNull public static net.kyori.adventure.text.Component motd() { -+ return server.motd(); -+ } -+ -+ /** -+ * Set the message that is displayed on the server list. -+ * -+ * @param motd The message to be displayed -+ */ -+ public static void motd(final net.kyori.adventure.text.@NotNull Component motd) { -+ server.motd(motd); -+ } -+ -+ /** -+ * Gets the default message that is displayed when the server is stopped. -+ * -+ * @return the shutdown message -+ */ -+ public static net.kyori.adventure.text.@Nullable Component shutdownMessage() { -+ return server.shutdownMessage(); -+ } -+ // Paper end -+ - /** - * Gets the message that is displayed on the server list. - * - * @return the servers MOTD -+ * @deprecated in favour of {@link #motd()} - */ - @NotNull -+ @Deprecated // Paper - public static String getMotd() { - return server.getMotd(); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - * Set the message that is displayed on the server list. - * - * @param motd The message to be displayed -+ * @deprecated in favour of {@link #motd(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public static void setMotd(@NotNull String motd) { - server.setMotd(motd); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - * Gets the default message that is displayed when the server is stopped. - * - * @return the shutdown message -+ * @deprecated in favour of {@link #shutdownMessage()} - */ - @Nullable -+ @Deprecated // Paper - public static String getShutdownMessage() { - return server.getShutdownMessage(); - } -diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/ChatColor.java -+++ b/src/main/java/org/bukkit/ChatColor.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - - /** - * All supported color values for chat -+ * @deprecated ChatColor has been deprecated in favor of Adventure API. See {@link net.kyori.adventure.text.format.NamedTextColor} for the adventure equivalent of pre-defined text colors - */ -+@Deprecated // Paper - public enum ChatColor { - /** - * Represents black -diff --git a/src/main/java/org/bukkit/JukeboxSong.java b/src/main/java/org/bukkit/JukeboxSong.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/JukeboxSong.java -+++ b/src/main/java/org/bukkit/JukeboxSong.java -@@ -0,0 +0,0 @@ public interface JukeboxSong extends Keyed, Translatable { - private static JukeboxSong get(@NotNull String key) { - return Registry.JUKEBOX_SONG.getOrThrow(NamespacedKey.minecraft(key)); - } -+ -+ // Paper start - adventure -+ /** -+ * @deprecated this method assumes that jukebox song description will -+ * always be a translatable component which is not guaranteed. -+ */ -+ @Override -+ @Deprecated(forRemoval = true) -+ @org.jetbrains.annotations.NotNull String getTranslationKey(); -+ // Paper end - adventure - } -diff --git a/src/main/java/org/bukkit/Keyed.java b/src/main/java/org/bukkit/Keyed.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Keyed.java -+++ b/src/main/java/org/bukkit/Keyed.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents an object which has a {@link NamespacedKey} attached to it. - */ --public interface Keyed { -+public interface Keyed extends net.kyori.adventure.key.Keyed { // Paper -- extend Adventure Keyed - - /** - * Return the namespaced identifier for this object. -@@ -0,0 +0,0 @@ public interface Keyed { - */ - @NotNull - NamespacedKey getKey(); -+ -+ // Paper start -+ /** -+ * Returns the unique identifier for this object. -+ * -+ * @return this object's key -+ */ -+ @Override -+ default net.kyori.adventure.key.@NotNull Key key() { -+ return this.getKey(); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/Nameable.java b/src/main/java/org/bukkit/Nameable.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Nameable.java -+++ b/src/main/java/org/bukkit/Nameable.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - */ - public interface Nameable { - -+ // Paper start -+ /** -+ * Gets the custom name. -+ * -+ *

    This value has no effect on players, they will always use their real name.

    -+ * -+ * @return the custom name -+ */ -+ net.kyori.adventure.text.@Nullable Component customName(); -+ -+ /** -+ * Sets the custom name. -+ * -+ *

    This name will be used in death messages and can be sent to the client as a nameplate over the mob.

    -+ * -+ *

    Setting the name to {@code null} will clear it.

    -+ * -+ *

    This value has no effect on players, they will always use their real name.

    -+ * -+ * @param customName the custom name to set -+ */ -+ void customName(final net.kyori.adventure.text.@Nullable Component customName); -+ // Paper end -+ - /** - * Gets the custom name on a mob or block. If there is no name this method - * will return null. -@@ -0,0 +0,0 @@ public interface Nameable { - * This value has no effect on players, they will always use their real - * name. - * -+ * @deprecated in favour of {@link #customName()} - * @return name of the mob/block or null - */ -+ @Deprecated // Paper - @Nullable - public String getCustomName(); - -@@ -0,0 +0,0 @@ public interface Nameable { - * This value has no effect on players, they will always use their real - * name. - * -+ * @deprecated in favour of {@link #customName(net.kyori.adventure.text.Component)} - * @param name the name to set - */ -+ @Deprecated // Paper - public void setCustomName(@Nullable String name); - } -diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/NamespacedKey.java -+++ b/src/main/java/org/bukkit/NamespacedKey.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * underscores, hyphens, and forward slashes. - * - */ --public final class NamespacedKey { -+public final class NamespacedKey implements net.kyori.adventure.key.Key { // Paper - implement Key - - /** - * The namespace representing all inbuilt keys. -@@ -0,0 +0,0 @@ public final class NamespacedKey { - - @Override - public int hashCode() { -- int hash = 5; -- hash = 47 * hash + this.namespace.hashCode(); -- hash = 47 * hash + this.key.hashCode(); -- return hash; -+ // Paper start -+ int result = this.namespace.hashCode(); -+ result = (31 * result) + this.key.hashCode(); -+ return result; -+ // Paper end - } - - @Override -@@ -0,0 +0,0 @@ public final class NamespacedKey { - if (obj == null) { - return false; - } -- if (getClass() != obj.getClass()) { -- return false; -- } -- final NamespacedKey other = (NamespacedKey) obj; -- return this.namespace.equals(other.namespace) && this.key.equals(other.key); -+ // Paper start -+ if (!(obj instanceof net.kyori.adventure.key.Key key)) return false; -+ return this.namespace.equals(key.namespace()) && this.key.equals(key.value()); -+ // Paper end - } - - @Override -@@ -0,0 +0,0 @@ public final class NamespacedKey { - public static NamespacedKey fromString(@NotNull String key) { - return fromString(key, null); - } -+ -+ // Paper start -+ @NotNull -+ @Override -+ public String namespace() { -+ return this.getNamespace(); -+ } -+ -+ @NotNull -+ @Override -+ public String value() { -+ return this.getKey(); -+ } -+ -+ @NotNull -+ @Override -+ public String asString() { -+ return this.namespace + ':' + this.key; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a server implementation. - */ --public interface Server extends PluginMessageRecipient { -+public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper - - /** - * Used for all administrative messages, such as an operator using a - * command. - *

    -- * For use in {@link #broadcast(java.lang.String, java.lang.String)}. -+ * For use in {@link #broadcast(net.kyori.adventure.text.Component, java.lang.String)}. - */ - public static final String BROADCAST_CHANNEL_ADMINISTRATIVE = "bukkit.broadcast.admin"; - -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * Used for all announcement messages, such as informing users that a - * player has joined. - *

    -- * For use in {@link #broadcast(java.lang.String, java.lang.String)}. -+ * For use in {@link #broadcast(net.kyori.adventure.text.Component, java.lang.String)}. - */ - public static final String BROADCAST_CHANNEL_USERS = "bukkit.broadcast.user"; - -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * - * @param message the message - * @return the number of players -+ * @deprecated use {@link #broadcast(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public int broadcastMessage(@NotNull String message); - - /** -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * @param permission the required permission {@link Permissible - * permissibles} must have to receive the broadcast - * @return number of message recipients -+ * @deprecated in favour of {@link #broadcast(net.kyori.adventure.text.Component, String)} - */ -+ @Deprecated // Paper - public int broadcast(@NotNull String message, @NotNull String permission); -+ // Paper start -+ /** -+ * Broadcast a message to all players. -+ *

    -+ * This is the same as calling {@link #broadcast(net.kyori.adventure.text.Component, -+ * java.lang.String)} with the {@link #BROADCAST_CHANNEL_USERS} permission. -+ * -+ * @param message the message -+ * @return the number of players -+ */ -+ int broadcast(net.kyori.adventure.text.@NotNull Component message); -+ -+ /** -+ * Broadcasts the specified message to every user with the given -+ * permission name. -+ * -+ * @param message message to broadcast -+ * @param permission the required permission {@link Permissible -+ * permissibles} must have to receive the broadcast -+ * @return number of message recipients -+ */ -+ int broadcast(net.kyori.adventure.text.@NotNull Component message, @NotNull String permission); -+ // Paper end - - /** - * Gets the player by the given name, regardless if they are offline or -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - @NotNull - Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type); - -+ // Paper start -+ /** -+ * Creates an empty inventory with the specified type and title. If the type -+ * is {@link InventoryType#CHEST}, the new inventory has a size of 27; -+ * otherwise the new inventory has the normal size for its type.
    -+ * It should be noted that some inventory types do not support titles and -+ * may not render with said titles on the Minecraft client. -+ *
    -+ * {@link InventoryType#WORKBENCH} will not process crafting recipes if -+ * created with this method. Use -+ * {@link Player#openWorkbench(Location, boolean)} instead. -+ *
    -+ * {@link InventoryType#ENCHANTING} will not process {@link ItemStack}s -+ * for possible enchanting results. Use -+ * {@link Player#openEnchanting(Location, boolean)} instead. -+ * -+ * @param owner The holder of the inventory; can be null if there's no holder. -+ * @param type The type of inventory to create. -+ * @param title The title of the inventory, to be displayed when it is viewed. -+ * @return The new inventory. -+ * @throws IllegalArgumentException if the {@link InventoryType} cannot be -+ * viewed. -+ * -+ * @see InventoryType#isCreatable() -+ */ -+ @NotNull -+ Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, net.kyori.adventure.text.@NotNull Component title); -+ // Paper end -+ - /** - * Creates an empty inventory with the specified type and title. If the type - * is {@link InventoryType#CHEST}, the new inventory has a size of 27; -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * @return The new inventory. - * @throws IllegalArgumentException if the {@link InventoryType} cannot be - * viewed. -+ * @deprecated in favour of {@link #createInventory(InventoryHolder, InventoryType, net.kyori.adventure.text.Component)} - * - * @see InventoryType#isCreatable() - */ -+ @Deprecated // Paper - @NotNull - Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title); - -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - @NotNull - Inventory createInventory(@Nullable InventoryHolder owner, int size) throws IllegalArgumentException; - -+ // Paper start -+ /** -+ * Creates an empty inventory of type {@link InventoryType#CHEST} with the -+ * specified size and title. -+ * -+ * @param owner the holder of the inventory, or null to indicate no holder -+ * @param size a multiple of 9 as the size of inventory to create -+ * @param title the title of the inventory, displayed when inventory is -+ * viewed -+ * @return a new inventory -+ * @throws IllegalArgumentException if the size is not a multiple of 9 -+ */ -+ @NotNull -+ Inventory createInventory(@Nullable InventoryHolder owner, int size, net.kyori.adventure.text.@NotNull Component title) throws IllegalArgumentException; -+ // Paper end -+ - /** - * Creates an empty inventory of type {@link InventoryType#CHEST} with the - * specified size and title. -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * viewed - * @return a new inventory - * @throws IllegalArgumentException if the size is not a multiple of 9 -+ * @deprecated in favour of {@link #createInventory(InventoryHolder, int, net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - @NotNull - Inventory createInventory(@Nullable InventoryHolder owner, int size, @NotNull String title) throws IllegalArgumentException; - -+ // Paper start -+ /** -+ * Creates an empty merchant. -+ * -+ * @param title the title of the corresponding merchant inventory, displayed -+ * when the merchant inventory is viewed -+ * @return a new merchant -+ */ -+ @NotNull Merchant createMerchant(net.kyori.adventure.text.@Nullable Component title); -+ // Paper start - /** - * Creates an empty merchant. - * - * @param title the title of the corresponding merchant inventory, displayed - * when the merchant inventory is viewed - * @return a new merchant -+ * @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)} - */ - @NotNull -+ @Deprecated // Paper - Merchant createMerchant(@Nullable String title); - - /** -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - */ - boolean isPrimaryThread(); - -+ // Paper start -+ /** -+ * Gets the message that is displayed on the server list. -+ * -+ * @return the server's MOTD -+ */ -+ net.kyori.adventure.text.@NotNull Component motd(); -+ -+ /** -+ * Set the message that is displayed on the server list. -+ * -+ * @param motd The message to be displayed -+ */ -+ void motd(final net.kyori.adventure.text.@NotNull Component motd); -+ -+ /** -+ * Gets the default message that is displayed when the server is stopped. -+ * -+ * @return the shutdown message -+ */ -+ net.kyori.adventure.text.@Nullable Component shutdownMessage(); -+ // Paper end -+ - /** - * Gets the message that is displayed on the server list. - * - * @return the servers MOTD -+ * @deprecated in favour of {@link #motd()} - */ - @NotNull -+ @Deprecated // Paper - String getMotd(); - - /** - * Set the message that is displayed on the server list. - * - * @param motd The message to be displayed -+ * @deprecated in favour of {@link #motd(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - void setMotd(@NotNull String motd); - - /** -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * Gets the default message that is displayed when the server is stopped. - * - * @return the shutdown message -+ * @deprecated in favour of {@link #shutdownMessage()} - */ - @Nullable -+ @Deprecated // Paper - String getShutdownMessage(); - - /** -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * Sends the component to the player - * - * @param component the components to send -+ * @deprecated use {@link #broadcast(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) { - throw new UnsupportedOperationException("Not supported yet."); - } -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * Sends an array of components as a single message to the player - * - * @param components the components to send -+ * @deprecated use {@link #broadcast(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) { - throw new UnsupportedOperationException("Not supported yet."); - } -diff --git a/src/main/java/org/bukkit/ServerLinks.java b/src/main/java/org/bukkit/ServerLinks.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/ServerLinks.java -+++ b/src/main/java/org/bukkit/ServerLinks.java -@@ -0,0 +0,0 @@ public interface ServerLinks { - @NotNull - ServerLink addLink(@NotNull Type type, @NotNull URI url); - -+ // Paper start - Adventure -+ /** -+ * Adds the given link to the list of links. -+ * -+ * @param displayName link name / display text Component -+ * @param url link url -+ * @return the added link -+ */ -+ @NotNull -+ ServerLink addLink(@NotNull net.kyori.adventure.text.Component displayName, @NotNull URI url); -+ // Paper end - Adventure -+ - /** - * Adds the given link to the list of links. - * - * @param displayName link name / display text - * @param url link url - * @return the added link -+ * @deprecated in favour of {@link ServerLinks#addLink(net.kyori.adventure.text.Component, URI)} - */ -+ @Deprecated // Paper - Adventure - @NotNull - ServerLink addLink(@NotNull String displayName, @NotNull URI url); - -@@ -0,0 +0,0 @@ public interface ServerLinks { - @Nullable - Type getType(); - -+ // Paper start - Adventure -+ /** -+ * Gets the display name/text Component of this link. -+ * -+ * @return display name Component -+ */ -+ @NotNull -+ net.kyori.adventure.text.Component displayName(); -+ // Paper end - Adventure -+ - /** - * Gets the display name/text of this link. - * - * @return display name -+ * @deprecated in favour of {@link ServerLink#displayName()} - */ -+ @Deprecated // Paper - Adventure - @NotNull - String getDisplayName(); - -diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Sound.java -+++ b/src/main/java/org/bukkit/Sound.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - * guarantee values will not be removed from this interface. As such, you should not - * depend on the ordinal values of this class. - */ --public interface Sound extends OldEnum, Keyed { -+public interface Sound extends OldEnum, Keyed, net.kyori.adventure.sound.Sound.Type { // Paper - implement Sound.Type - - Sound AMBIENT_BASALT_DELTAS_ADDITIONS = getSound("ambient.basalt_deltas.additions"); - Sound AMBIENT_BASALT_DELTAS_LOOP = getSound("ambient.basalt_deltas.loop"); -@@ -0,0 +0,0 @@ public interface Sound extends OldEnum, Keyed { - static Sound[] values() { - return Lists.newArrayList(Registry.SOUNDS).toArray(new Sound[0]); - } -+ -+ // Paper start -+ @Override -+ default net.kyori.adventure.key.@NotNull Key key() { -+ return this.getKey(); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/SoundCategory.java b/src/main/java/org/bukkit/SoundCategory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/SoundCategory.java -+++ b/src/main/java/org/bukkit/SoundCategory.java -@@ -0,0 +0,0 @@ package org.bukkit; - /** - * An Enum of categories for sounds. - */ --public enum SoundCategory { -+public enum SoundCategory implements net.kyori.adventure.sound.Sound.Source.Provider { // Paper - implement Sound.Source.Provider - - MASTER, - MUSIC, -@@ -0,0 +0,0 @@ public enum SoundCategory { - PLAYERS, - AMBIENT, - VOICE; -+ -+ // Paper start - implement Sound.Source.Provider -+ @Override -+ public net.kyori.adventure.sound.Sound.@org.jetbrains.annotations.NotNull Source soundSource() { -+ return switch (this) { -+ case MASTER -> net.kyori.adventure.sound.Sound.Source.MASTER; -+ case MUSIC -> net.kyori.adventure.sound.Sound.Source.MUSIC; -+ case RECORDS -> net.kyori.adventure.sound.Sound.Source.RECORD; -+ case WEATHER -> net.kyori.adventure.sound.Sound.Source.WEATHER; -+ case BLOCKS -> net.kyori.adventure.sound.Sound.Source.BLOCK; -+ case HOSTILE -> net.kyori.adventure.sound.Sound.Source.HOSTILE; -+ case NEUTRAL -> net.kyori.adventure.sound.Sound.Source.NEUTRAL; -+ case PLAYERS -> net.kyori.adventure.sound.Sound.Source.PLAYER; -+ case AMBIENT -> net.kyori.adventure.sound.Sound.Source.AMBIENT; -+ case VOICE -> net.kyori.adventure.sound.Sound.Source.VOICE; -+ }; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - */ - @Deprecated(since = "1.7.2") - public interface UnsafeValues { -+ // Paper start -+ net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener(); -+ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer(); -+ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer(); -+ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer(); -+ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer(); -+ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); -+ net.kyori.adventure.text.Component resolveWithContext(net.kyori.adventure.text.Component component, org.bukkit.command.CommandSender context, org.bukkit.entity.Entity scoreboardSubject, boolean bypassPermissions) throws java.io.IOException; -+ // Paper end - - Material toLegacy(Material material); - -diff --git a/src/main/java/org/bukkit/Warning.java b/src/main/java/org/bukkit/Warning.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Warning.java -+++ b/src/main/java/org/bukkit/Warning.java -@@ -0,0 +0,0 @@ public @interface Warning { - * - */ - public boolean printFor(@Nullable Warning warning) { -+ if (Boolean.getBoolean("paper.alwaysPrintWarningState")) return true; // Paper - if (this == DEFAULT) { - return warning == null || warning.value(); - } -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a world, which may contain entities, chunks and blocks - */ --public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed { -+public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed, net.kyori.adventure.audience.ForwardingAudience { // Paper - - /** - * Gets the {@link Block} at the given coordinates -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @NotNull - public List getPlayers(); - -+ // Paper start -+ @NotNull -+ @Override -+ default Iterable audiences() { -+ return this.getPlayers(); -+ } -+ // Paper end -+ - /** - * Returns a list of entities within a bounding box centered around a - * Location. -diff --git a/src/main/java/org/bukkit/block/CommandBlock.java b/src/main/java/org/bukkit/block/CommandBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/CommandBlock.java -+++ b/src/main/java/org/bukkit/block/CommandBlock.java -@@ -0,0 +0,0 @@ public interface CommandBlock extends TileState { - * by default is "@". - * - * @return Name of this CommandBlock. -+ * @deprecated in favour of {@link #name()} - */ -+ @Deprecated // Paper - @NotNull - public String getName(); - -@@ -0,0 +0,0 @@ public interface CommandBlock extends TileState { - * same as setting it to "@". - * - * @param name New name for this CommandBlock. -+ * @deprecated in favour of {@link #name(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void setName(@Nullable String name); -+ -+ // Paper start -+ /** -+ * Gets the name of this CommandBlock. The name is used with commands -+ * that this CommandBlock executes. This name will never be null, and -+ * by default is a {@link net.kyori.adventure.text.TextComponent} containing {@code @}. -+ * -+ * @return Name of this CommandBlock. -+ */ -+ public net.kyori.adventure.text.@NotNull Component name(); -+ -+ /** -+ * Sets the name of this CommandBlock. The name is used with commands -+ * that this CommandBlock executes. Setting the name to null is the -+ * same as setting it to a {@link net.kyori.adventure.text.TextComponent} containing {@code @}. -+ * -+ * @param name New name for this CommandBlock. -+ */ -+ public void name(net.kyori.adventure.text.@Nullable Component name); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/Sign.java b/src/main/java/org/bukkit/block/Sign.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/Sign.java -+++ b/src/main/java/org/bukkit/block/Sign.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * Represents a captured state of either a SignPost or a WallSign. - */ - public interface Sign extends TileState, Colorable { -+ // Paper start -+ /** -+ * Gets all the lines of text currently on the {@link Side#FRONT} of this sign. -+ * -+ * @return List of components containing each line of text -+ * @deprecated A sign may have multiple writable sides now. Use {@link Sign#getSide(Side)} and {@link SignSide#lines()}. -+ */ -+ @NotNull -+ @Deprecated -+ public java.util.List lines(); -+ -+ /** -+ * Gets the line of text at the specified index on the {@link Side#FRONT}. -+ *

    -+ * For example, getLine(0) will return the first line of text. -+ * -+ * @param index Line number to get the text from, starting at 0 -+ * @throws IndexOutOfBoundsException Thrown when the line does not exist -+ * @return Text on the given line -+ * @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#line(int)}. -+ */ -+ @NotNull -+ @Deprecated -+ public net.kyori.adventure.text.Component line(int index) throws IndexOutOfBoundsException; -+ -+ /** -+ * Sets the line of text at the specified index on the {@link Side#FRONT}. -+ *

    -+ * For example, setLine(0, "Line One") will set the first line of text to -+ * "Line One". -+ * -+ * @param index Line number to set the text at, starting from 0 -+ * @param line New text to set at the specified index -+ * @throws IndexOutOfBoundsException If the index is out of the range 0..3 -+ * @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#line(int, net.kyori.adventure.text.Component)}. -+ */ -+ @Deprecated -+ public void line(int index, net.kyori.adventure.text.@NotNull Component line) throws IndexOutOfBoundsException; -+ // Paper end - - /** - * Gets all the lines of text currently on the {@link Side#FRONT} of this sign. - * - * @return Array of Strings containing each line of text -- * @deprecated A sign may have multiple writable sides now. Use {@link Sign#getSide(Side)} and {@link SignSide#getLines()}. -+ * @deprecated A sign may have multiple writable sides now. Use {@link Sign#getSide(Side)} and {@link SignSide#lines()}. - */ - @Deprecated(since = "1.20") - @NotNull -@@ -0,0 +0,0 @@ public interface Sign extends TileState, Colorable { - * @param index Line number to get the text from, starting at 0 - * @return Text on the given line - * @throws IndexOutOfBoundsException Thrown when the line does not exist -- * @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#getLine(int)}. -+ * @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#line(int)}. - */ - @Deprecated(since = "1.20") - @NotNull -@@ -0,0 +0,0 @@ public interface Sign extends TileState, Colorable { - * @param index Line number to set the text at, starting from 0 - * @param line New text to set at the specified index - * @throws IndexOutOfBoundsException If the index is out of the range 0..3 -- * @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#setLine(int, String)}. -+ * @deprecated A sign may have multiple writable sides now. Use {@link #getSide(Side)} and {@link SignSide#line(int, net.kyori.adventure.text.Component)}. - */ - @Deprecated(since = "1.20") - public void setLine(int index, @NotNull String line) throws IndexOutOfBoundsException; -diff --git a/src/main/java/org/bukkit/block/sign/SignSide.java b/src/main/java/org/bukkit/block/sign/SignSide.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/block/sign/SignSide.java -+++ b/src/main/java/org/bukkit/block/sign/SignSide.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - * Represents a side of a sign. - */ - public interface SignSide extends Colorable { -+ // Paper start -+ /** -+ * Gets all the lines of text currently on the sign. -+ * -+ * @return List of components containing each line of text -+ */ -+ @NotNull -+ public java.util.List lines(); -+ -+ /** -+ * Gets the line of text at the specified index. -+ *

    -+ * For example, getLine(0) will return the first line of text. -+ * -+ * @param index Line number to get the text from, starting at 0 -+ * @throws IndexOutOfBoundsException Thrown when the line does not exist -+ * @return Text on the given line -+ */ -+ @NotNull -+ public net.kyori.adventure.text.Component line(int index) throws IndexOutOfBoundsException; -+ -+ /** -+ * Sets the line of text at the specified index. -+ *

    -+ * For example, setLine(0, "Line One") will set the first line of text to -+ * "Line One". -+ * -+ * @param index Line number to set the text at, starting from 0 -+ * @param line New text to set at the specified index -+ * @throws IndexOutOfBoundsException If the index is out of the range 0..3 -+ */ -+ public void line(int index, net.kyori.adventure.text.@NotNull Component line) throws IndexOutOfBoundsException; -+ // Paper end - - /** - * Gets all the lines of text currently on this side of the sign. - * - * @return Array of Strings containing each line of text -+ * @deprecated in favour of {@link #lines()} - */ - @NotNull -+ @Deprecated // Paper - public String[] getLines(); - - /** -@@ -0,0 +0,0 @@ public interface SignSide extends Colorable { - * @param index Line number to get the text from, starting at 0 - * @return Text on the given line - * @throws IndexOutOfBoundsException Thrown when the line does not exist -+ * @deprecated in favour of {@link #line(int)} - */ - @NotNull -+ @Deprecated // Paper - public String getLine(int index) throws IndexOutOfBoundsException; - - /** -@@ -0,0 +0,0 @@ public interface SignSide extends Colorable { - * @param index Line number to set the text at, starting from 0 - * @param line New text to set at the specified index - * @throws IndexOutOfBoundsException If the index is out of the range 0..3 -+ * @deprecated in favour of {@link #line(int, net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void setLine(int index, @NotNull String line) throws IndexOutOfBoundsException; - - /** -diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/Command.java -+++ b/src/main/java/org/bukkit/command/Command.java -@@ -0,0 +0,0 @@ public abstract class Command { - protected String description; - protected String usageMessage; - private String permission; -- private String permissionMessage; -+ private net.kyori.adventure.text.Component permissionMessage; // Paper - public org.spigotmc.CustomTimingsHandler timings; // Spigot - - protected Command(@NotNull String name) { -@@ -0,0 +0,0 @@ public abstract class Command { - - if (permissionMessage == null) { - target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is a mistake."); -- } else if (permissionMessage.length() != 0) { -- for (String line : permissionMessage.replace("", permission).split("\n")) { -- target.sendMessage(line); -- } -+ // Paper start - use components for permissionMessage -+ } else if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { -+ target.sendMessage(permissionMessage.replaceText(net.kyori.adventure.text.TextReplacementConfig.builder().matchLiteral("").replacement(permission).build())); -+ // Paper end - } - - return false; -@@ -0,0 +0,0 @@ public abstract class Command { - @Deprecated(since = "1.20.4") - @Nullable - public String getPermissionMessage() { -- return permissionMessage; -+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serializeOrNull(permissionMessage); // Paper - } - - /** -@@ -0,0 +0,0 @@ public abstract class Command { - @Deprecated(since = "1.20.4") - @NotNull - public Command setPermissionMessage(@Nullable String permissionMessage) { -- this.permissionMessage = permissionMessage; -+ this.permissionMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(permissionMessage); // Paper - return this; - } - -@@ -0,0 +0,0 @@ public abstract class Command { - this.usageMessage = (usage == null) ? "" : usage; - return this; - } -+ // Paper start -+ /** -+ * Gets the permission message. -+ * -+ * @return the permission message -+ * @deprecated permission messages have not worked for player-executed -+ * commands since 1.13 as clients without permission to execute a command -+ * are unaware of its existence and therefore will not send an unknown -+ * command execution to the server. This message will only ever be shown to -+ * consoles or when this command is executed with -+ * {@link Bukkit#dispatchCommand(CommandSender, String)}. -+ */ -+ @Deprecated -+ public net.kyori.adventure.text.@Nullable Component permissionMessage() { -+ return this.permissionMessage; -+ } -+ -+ /** -+ * Sets the permission message. -+ * -+ * @param permissionMessage the permission message -+ * @deprecated permission messages have not worked for player-executed -+ * commands since 1.13 as clients without permission to execute a command -+ * are unaware of its existence and therefore will not send an unknown -+ * command execution to the server. This message will only ever be shown to -+ * consoles or when this command is executed with -+ * {@link Bukkit#dispatchCommand(CommandSender, String)}. -+ */ -+ @Deprecated -+ public void permissionMessage(net.kyori.adventure.text.@Nullable Component permissionMessage) { -+ this.permissionMessage = permissionMessage; -+ } -+ // Paper end - - public static void broadcastCommandMessage(@NotNull CommandSender source, @NotNull String message) { - broadcastCommandMessage(source, message, true); - } - - public static void broadcastCommandMessage(@NotNull CommandSender source, @NotNull String message, boolean sendToSource) { -- String result = source.getName() + ": " + message; -+ // Paper start -+ broadcastCommandMessage(source, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message), sendToSource); -+ } -+ -+ public static void broadcastCommandMessage(@NotNull CommandSender source, net.kyori.adventure.text.@NotNull Component message) { -+ broadcastCommandMessage(source, message, true); -+ } -+ -+ public static void broadcastCommandMessage(@NotNull CommandSender source, net.kyori.adventure.text.@NotNull Component message, boolean sendToSource) { -+ net.kyori.adventure.text.TextComponent.Builder result = net.kyori.adventure.text.Component.text() -+ .color(net.kyori.adventure.text.format.NamedTextColor.WHITE) -+ .decoration(net.kyori.adventure.text.format.TextDecoration.ITALIC, false) -+ .append(source.name()) -+ .append(net.kyori.adventure.text.Component.text(": ")) -+ .append(message); -+ // Paper end - - if (source instanceof BlockCommandSender) { - BlockCommandSender blockCommandSender = (BlockCommandSender) source; -@@ -0,0 +0,0 @@ public abstract class Command { - } - - Set users = Bukkit.getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE); -- String colored = ChatColor.GRAY + "" + ChatColor.ITALIC + "[" + result + ChatColor.GRAY + ChatColor.ITALIC + "]"; -+ // Paper start -+ net.kyori.adventure.text.TextComponent.Builder colored = net.kyori.adventure.text.Component.text() -+ .color(net.kyori.adventure.text.format.NamedTextColor.GRAY) -+ .decorate(net.kyori.adventure.text.format.TextDecoration.ITALIC) -+ .append(net.kyori.adventure.text.Component.text("["), result, net.kyori.adventure.text.Component.text("]")); -+ // Paper end - - if (sendToSource && !(source instanceof ConsoleCommandSender)) { - source.sendMessage(message); -diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/CommandSender.java -+++ b/src/main/java/org/bukkit/command/CommandSender.java -@@ -0,0 +0,0 @@ import org.bukkit.permissions.Permissible; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - --public interface CommandSender extends Permissible { -+public interface CommandSender extends net.kyori.adventure.audience.Audience, Permissible { // Paper - - /** - * Sends this sender a message - * - * @param message Message to be displayed -+ * @see #sendMessage(net.kyori.adventure.text.Component) -+ * @see #sendPlainMessage(String) -+ * @see #sendRichMessage(String) - */ -+ @org.jetbrains.annotations.ApiStatus.Obsolete // Paper - public void sendMessage(@NotNull String message); - - /** - * Sends this sender multiple messages - * - * @param messages An array of messages to be displayed -+ * @see #sendMessage(net.kyori.adventure.text.Component) -+ * @see #sendPlainMessage(String) -+ * @see #sendRichMessage(String) - */ -+ @org.jetbrains.annotations.ApiStatus.Obsolete // Paper - public void sendMessage(@NotNull String... messages); - - /** -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - * - * @param message Message to be displayed - * @param sender The sender of this message -+ * @see #sendMessage(net.kyori.adventure.identity.Identified, net.kyori.adventure.text.Component) -+ * @deprecated sender UUID is ignored - */ -+ @Deprecated // Paper - public void sendMessage(@Nullable UUID sender, @NotNull String message); - - /** -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - * - * @param messages An array of messages to be displayed - * @param sender The sender of this message -+ * @see #sendMessage(net.kyori.adventure.identity.Identified, net.kyori.adventure.text.Component) -+ * @deprecated sender UUID is ignored - */ -+ @Deprecated // Paper - public void sendMessage(@Nullable UUID sender, @NotNull String... messages); - - /** -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - * Sends this sender a chat component. - * - * @param component the components to send -+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component} - */ -+ @Deprecated // Paper - public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) { - throw new UnsupportedOperationException("Not supported yet."); - } -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - * Sends an array of components as a single message to the sender. - * - * @param components the components to send -+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component} - */ -+ @Deprecated // Paper - public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) { - throw new UnsupportedOperationException("Not supported yet."); - } -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - * - * @param component the components to send - * @param sender the sender of the message -+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component} - */ -+ @Deprecated // Paper - public void sendMessage(@Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) { - throw new UnsupportedOperationException("Not supported yet."); - } -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - * - * @param components the components to send - * @param sender the sender of the message -+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component} - */ -+ @Deprecated // Paper - public void sendMessage(@Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) { - throw new UnsupportedOperationException("Not supported yet."); - } -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - @NotNull - Spigot spigot(); - // Spigot end -+ -+ // Paper start -+ /** -+ * Gets the name of this command sender -+ * -+ * @return Name of the sender -+ */ -+ public net.kyori.adventure.text.@NotNull Component name(); -+ -+ @Override -+ default void sendMessage(final net.kyori.adventure.identity.@NotNull Identity identity, final net.kyori.adventure.text.@NotNull Component message, final net.kyori.adventure.audience.@NotNull MessageType type) { -+ this.sendMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message)); -+ } -+ -+ /** -+ * Sends a message with the MiniMessage format to the command sender. -+ *

    -+ * See MiniMessage docs -+ * for more information on the format. -+ * -+ * @param message MiniMessage content -+ */ -+ default void sendRichMessage(final @NotNull String message) { -+ this.sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message)); -+ } -+ -+ /** -+ * Sends a message with the MiniMessage format to the command sender. -+ *

    -+ * See MiniMessage docs and MiniMessage Placeholders docs -+ * for more information on the format. -+ * -+ * @param message MiniMessage content -+ * @param resolvers resolvers to use -+ */ -+ default void sendRichMessage(final @NotNull String message, final net.kyori.adventure.text.minimessage.tag.resolver.@NotNull TagResolver... resolvers) { -+ this.sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message, resolvers)); -+ } -+ -+ /** -+ * Sends a plain message to the command sender. -+ * -+ * @param message plain message -+ */ -+ default void sendPlainMessage(final @NotNull String message) { -+ this.sendMessage(net.kyori.adventure.text.Component.text(message)); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/command/PluginCommandYamlParser.java b/src/main/java/org/bukkit/command/PluginCommandYamlParser.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/PluginCommandYamlParser.java -+++ b/src/main/java/org/bukkit/command/PluginCommandYamlParser.java -@@ -0,0 +0,0 @@ public class PluginCommandYamlParser { - } - - if (permissionMessage != null) { -- newCmd.setPermissionMessage(permissionMessage.toString()); -+ newCmd.permissionMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(permissionMessage.toString())); // Paper - } - - pluginCmds.add(newCmd); -diff --git a/src/main/java/org/bukkit/command/ProxiedCommandSender.java b/src/main/java/org/bukkit/command/ProxiedCommandSender.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/ProxiedCommandSender.java -+++ b/src/main/java/org/bukkit/command/ProxiedCommandSender.java -@@ -0,0 +0,0 @@ package org.bukkit.command; - - import org.jetbrains.annotations.NotNull; - --public interface ProxiedCommandSender extends CommandSender { -+public interface ProxiedCommandSender extends CommandSender, net.kyori.adventure.audience.ForwardingAudience.Single { // Paper - - /** - * Returns the CommandSender which triggered this proxied command -@@ -0,0 +0,0 @@ public interface ProxiedCommandSender extends CommandSender { - @NotNull - CommandSender getCallee(); - -+ // Paper start -+ @Override -+ default void sendMessage(final net.kyori.adventure.identity.@NotNull Identity source, final net.kyori.adventure.text.@NotNull Component message, final net.kyori.adventure.audience.@NotNull MessageType type) { -+ net.kyori.adventure.audience.ForwardingAudience.Single.super.sendMessage(source, message, type); -+ } -+ -+ @NotNull -+ @Override -+ default net.kyori.adventure.audience.Audience audience() { -+ return this.getCaller(); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/configuration/ConfigurationSection.java b/src/main/java/org/bukkit/configuration/ConfigurationSection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/configuration/ConfigurationSection.java -+++ b/src/main/java/org/bukkit/configuration/ConfigurationSection.java -@@ -0,0 +0,0 @@ public interface ConfigurationSection { - * one line. - */ - public void setInlineComments(@NotNull String path, @Nullable List comments); -+ -+ // Paper start - add rich message component support to configuration -+ /** -+ * Gets the requested MiniMessage formatted String as Component by path. -+ *

    -+ * If the Component does not exist but a default value has been specified, -+ * this will return the default value. If the Component does not exist and no -+ * default value was specified, this will return null. -+ * -+ * @param path Path of the Component to get. -+ * @return Requested Component. -+ */ -+ default net.kyori.adventure.text.@Nullable Component getRichMessage(final @NotNull String path) { -+ return this.getRichMessage(path, null); -+ } -+ -+ /** -+ * Gets the requested MiniMessage formatted String as Component by path. -+ *

    -+ * If the Component does not exist but a default value has been specified, -+ * this will return the default value. If the Component does not exist and no -+ * default value was specified, this will return null. -+ * -+ * @param path Path of the Component to get. -+ * @param fallback component that will be used as fallback -+ * @return Requested Component. -+ */ -+ @Contract("_, !null -> !null") -+ default net.kyori.adventure.text.@Nullable Component getRichMessage(final @NotNull String path, final net.kyori.adventure.text.@Nullable Component fallback) { -+ return this.getComponent(path, net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(), fallback); -+ } -+ -+ /** -+ * Sets the specified path to the given value. -+ *

    -+ * If value is null, the entry will be removed. Any existing entry will be -+ * replaced, regardless of what the new value is. -+ * -+ * @param path Path of the object to set. -+ * @param value New value to set the path to. -+ */ -+ default void setRichMessage(final @NotNull String path, final net.kyori.adventure.text.@Nullable Component value) { -+ this.setComponent(path, net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(), value); -+ } -+ -+ /** -+ * Gets the requested formatted String as Component by path deserialized by the ComponentDecoder. -+ *

    -+ * If the Component does not exist but a default value has been specified, -+ * this will return the default value. If the Component does not exist and no -+ * default value was specified, this will return null. -+ * -+ * @param path Path of the Component to get. -+ * @param decoder ComponentDecoder instance used for deserialization -+ * @return Requested Component. -+ */ -+ default @Nullable C getComponent(final @NotNull String path, final net.kyori.adventure.text.serializer.@NotNull ComponentDecoder decoder) { -+ return this.getComponent(path, decoder, null); -+ } -+ -+ /** -+ * Gets the requested formatted String as Component by path deserialized by the ComponentDecoder. -+ *

    -+ * If the Component does not exist but a default value has been specified, -+ * this will return the default value. If the Component does not exist and no -+ * default value was specified, this will return null. -+ * -+ * @param path Path of the Component to get. -+ * @param decoder ComponentDecoder instance used for deserialization -+ * @param fallback component that will be used as fallback -+ * @return Requested Component. -+ */ -+ @Contract("_, _, !null -> !null") -+ default @Nullable C getComponent(final @NotNull String path, final net.kyori.adventure.text.serializer.@NotNull ComponentDecoder decoder, final @Nullable C fallback) { -+ java.util.Objects.requireNonNull(decoder, "decoder"); -+ final String value = this.getString(path); -+ return decoder.deserializeOr(value, fallback); -+ } -+ -+ /** -+ * Sets the specified path to the given value. -+ *

    -+ * If value is null, the entry will be removed. Any existing entry will be -+ * replaced, regardless of what the new value is. -+ * -+ * @param path Path of the object to set. -+ * @param encoder the encoder used to transform the value -+ * @param value New value to set the path to. -+ */ -+ default void setComponent(final @NotNull String path, final net.kyori.adventure.text.serializer.@NotNull ComponentEncoder encoder, final @Nullable C value) { -+ java.util.Objects.requireNonNull(encoder, "encoder"); -+ this.set(path, encoder.serializeOrNull(value)); -+ } -+ // Paper end - add rich message component support to configuration - } -diff --git a/src/main/java/org/bukkit/conversations/Conversable.java b/src/main/java/org/bukkit/conversations/Conversable.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/conversations/Conversable.java -+++ b/src/main/java/org/bukkit/conversations/Conversable.java -@@ -0,0 +0,0 @@ public interface Conversable { - * - * @param message Message to be displayed - */ -+ @org.jetbrains.annotations.ApiStatus.Obsolete // Paper - public void sendRawMessage(@NotNull String message); - - /** -@@ -0,0 +0,0 @@ public interface Conversable { - * - * @param message Message to be displayed - * @param sender The sender of this message -+ * @deprecated sender UUID is ignored - */ -+ @Deprecated // Paper - public void sendRawMessage(@Nullable UUID sender, @NotNull String message); - } -diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/enchantments/Enchantment.java -+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, Translatable { - * @return True if the enchantment may be applied, otherwise False - */ - public abstract boolean canEnchantItem(@NotNull ItemStack item); -+ // Paper start -+ /** -+ * Get the name of the enchantment with its applied level. -+ *

    -+ * If the given {@code level} is either less than the {@link #getStartLevel()} or greater than the {@link #getMaxLevel()}, -+ * the level may not be shown in the numeral format one may otherwise expect. -+ *

    -+ * -+ * @param level the level of the enchantment to show -+ * @return the name of the enchantment with {@code level} applied -+ */ -+ public abstract net.kyori.adventure.text.@NotNull Component displayName(int level); -+ // Paper end - - /** - * Gets the Enchantment at the specified key -diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -@@ -0,0 +0,0 @@ public abstract class EnchantmentWrapper extends Enchantment { - public Enchantment getEnchantment() { - return this; - } -+ // Paper start -+ @NotNull -+ @Override -+ public net.kyori.adventure.text.Component displayName(int level) { -+ return getEnchantment().displayName(level); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - * Not all methods are guaranteed to work/may have side effects when - * {@link #isInWorld()} is false. - */ --public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder { -+public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource, net.kyori.adventure.sound.Sound.Emitter { // Paper - - /** - * Gets the entity's current position -@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - @Override - Spigot spigot(); - // Spigot end -+ -+ // Paper start -+ /** -+ * Gets the entity's display name formatted with their team prefix/suffix and -+ * the entity's default hover/click events. -+ * -+ * @return the team display name -+ */ -+ net.kyori.adventure.text.@NotNull Component teamDisplayName(); -+ -+ @NotNull -+ @Override -+ default net.kyori.adventure.text.event.HoverEvent asHoverEvent(final @NotNull java.util.function.UnaryOperator op) { -+ return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.customName()))); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a player, connected or not - */ --public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient { -+public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer { // Paper -+ -+ // Paper start -+ @Override -+ default net.kyori.adventure.identity.@NotNull Identity identity() { -+ return net.kyori.adventure.identity.Identity.identity(this.getUniqueId()); -+ } -+ -+ /** -+ * Gets an unmodifiable view of all known currently active bossbars. -+ *

    -+ * This currently only returns bossbars shown to the player via -+ * {@link #showBossBar(net.kyori.adventure.bossbar.BossBar)} and does not contain bukkit -+ * {@link org.bukkit.boss.BossBar} instances shown to the player. -+ * -+ * @return an unmodifiable view of all known currently active bossbars -+ * @since 4.14.0 -+ */ -+ @Override -+ @org.jetbrains.annotations.UnmodifiableView @NotNull Iterable activeBossBars(); -+ -+ /** -+ * Gets the "friendly" name to display of this player. -+ * -+ * @return the display name -+ */ -+ net.kyori.adventure.text.@NotNull Component displayName(); -+ -+ /** -+ * Sets the "friendly" name to display of this player. -+ * -+ * @param displayName the display name to set -+ */ -+ void displayName(final net.kyori.adventure.text.@Nullable Component displayName); -+ // Paper end - - /** - * {@inheritDoc} -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * places defined by plugins. - * - * @return the friendly name -+ * @deprecated in favour of {@link #displayName()} - */ -+ @Deprecated // Paper - @NotNull - public String getDisplayName(); - -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * places defined by plugins. - * - * @param name The new display name. -+ * @deprecated in favour of {@link #displayName(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void setDisplayName(@Nullable String name); - -+ // Paper start -+ /** -+ * Sets the name that is shown on the in-game player list. -+ *

    -+ * If the value is null, the name will be identical to {@link #getName()}. -+ * -+ * @param name new player list name -+ */ -+ void playerListName(net.kyori.adventure.text.@Nullable Component name); -+ -+ /** -+ * Gets the name that is shown on the in-game player list. -+ * -+ * @return the player list name -+ */ -+ net.kyori.adventure.text.@NotNull Component playerListName(); -+ -+ /** -+ * Gets the currently displayed player list header for this player. -+ * -+ * @return player list header or null -+ */ -+ net.kyori.adventure.text.@Nullable Component playerListHeader(); -+ -+ /** -+ * Gets the currently displayed player list footer for this player. -+ * -+ * @return player list footer or null -+ */ -+ net.kyori.adventure.text.@Nullable Component playerListFooter(); -+ // Paper end - /** - * Gets the name that is shown on the player list. - * - * @return the player list name -+ * @deprecated in favour of {@link #playerListName()} - */ - @NotNull -+ @Deprecated // Paper - public String getPlayerListName(); - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * If the value is null, the name will be identical to {@link #getName()}. - * - * @param name new player list name -+ * @deprecated in favour of {@link #playerListName(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void setPlayerListName(@Nullable String name); - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * Gets the currently displayed player list header for this player. - * - * @return player list header or null -+ * @deprecated in favour of {@link #playerListHeader()} - */ -+ @Deprecated // Paper - @Nullable - public String getPlayerListHeader(); - -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * Gets the currently displayed player list footer for this player. - * - * @return player list header or null -+ * @deprecated in favour of {@link #playerListFooter()} - */ -+ @Deprecated // Paper - @Nullable - public String getPlayerListFooter(); - -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * Sets the currently displayed player list header for this player. - * - * @param header player list header, null for empty -+ * @deprecated in favour of {@link #sendPlayerListHeader(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void setPlayerListHeader(@Nullable String header); - - /** - * Sets the currently displayed player list footer for this player. - * - * @param footer player list footer, null for empty -+ * @deprecated in favour of {@link #sendPlayerListFooter(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void setPlayerListFooter(@Nullable String footer); - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * - * @param header player list header, null for empty - * @param footer player list footer, null for empty -+ * @deprecated in favour of {@link #sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void setPlayerListHeaderFooter(@Nullable String header, @Nullable String footer); - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * Kicks player with custom kick message. - * - * @param message kick message -+ * @deprecated in favour of {@link #kick(net.kyori.adventure.text.Component)} - */ -+ @Deprecated // Paper - public void kickPlayer(@Nullable String message); - -+ // Paper start -+ /** -+ * Kicks the player with the default kick message. -+ * @see #kick(net.kyori.adventure.text.Component) -+ */ -+ void kick(); -+ /** -+ * Kicks player with custom kick message. -+ * -+ * @param message kick message -+ */ -+ void kick(final net.kyori.adventure.text.@Nullable Component message); -+ // Paper end -+ - /** - * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will - * update the entry. -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ - public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull Map items); - -+ // Paper start -+ /** -+ * Send a sign change. This fakes a sign change packet for a user at -+ * a certain location. This will not actually change the world in any way. -+ * This method will use a sign at the location's block or a faked sign -+ * sent via -+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. -+ *

    -+ * If the client does not have a sign at the given location it will -+ * display an error message to the user. -+ * -+ * @param loc the location of the sign -+ * @param lines the new text on the sign or null to clear it -+ * @throws IllegalArgumentException if location is null -+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4 -+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual -+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()} -+ * (constructed e.g. via {@link Material#createBlockData()}) -+ */ -+ @Deprecated -+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines) throws IllegalArgumentException { -+ this.sendSignChange(loc, lines, DyeColor.BLACK); -+ } -+ -+ /** -+ * Send a sign change. This fakes a sign change packet for a user at -+ * a certain location. This will not actually change the world in any way. -+ * This method will use a sign at the location's block or a faked sign -+ * sent via -+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. -+ *

    -+ * If the client does not have a sign at the given location it will -+ * display an error message to the user. -+ * -+ * @param loc the location of the sign -+ * @param lines the new text on the sign or null to clear it -+ * @param dyeColor the color of the sign -+ * @throws IllegalArgumentException if location is null -+ * @throws IllegalArgumentException if dyeColor is null -+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4 -+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual -+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()} -+ * (constructed e.g. via {@link Material#createBlockData()}) -+ */ -+ @Deprecated -+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException { -+ this.sendSignChange(loc, lines, dyeColor, false); -+ } -+ -+ /** -+ * Send a sign change. This fakes a sign change packet for a user at -+ * a certain location. This will not actually change the world in any way. -+ * This method will use a sign at the location's block or a faked sign -+ * sent via -+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. -+ *

    -+ * If the client does not have a sign at the given location it will -+ * display an error message to the user. -+ * -+ * @param loc the location of the sign -+ * @param lines the new text on the sign or null to clear it -+ * @param hasGlowingText whether the text of the sign should glow as if dyed with a glowing ink sac -+ * @throws IllegalArgumentException if location is null -+ * @throws IllegalArgumentException if dyeColor is null -+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4 -+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual -+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()} -+ * (constructed e.g. via {@link Material#createBlockData()}) -+ */ -+ @Deprecated -+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines, boolean hasGlowingText) throws IllegalArgumentException { -+ this.sendSignChange(loc, lines, DyeColor.BLACK, hasGlowingText); -+ } -+ -+ /** -+ * Send a sign change. This fakes a sign change packet for a user at -+ * a certain location. This will not actually change the world in any way. -+ * This method will use a sign at the location's block or a faked sign -+ * sent via -+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. -+ *

    -+ * If the client does not have a sign at the given location it will -+ * display an error message to the user. -+ * -+ * @param loc the location of the sign -+ * @param lines the new text on the sign or null to clear it -+ * @param dyeColor the color of the sign -+ * @param hasGlowingText whether the text of the sign should glow as if dyed with a glowing ink sac -+ * @throws IllegalArgumentException if location is null -+ * @throws IllegalArgumentException if dyeColor is null -+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4 -+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual -+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()} -+ * (constructed e.g. via {@link Material#createBlockData()}) -+ */ -+ @Deprecated -+ void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) -+ throws IllegalArgumentException; -+ // Paper end -+ - /** - * Send a sign change. This fakes a sign change packet for a user at - * a certain location. This will not actually change the world in any way. -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @param lines the new text on the sign or null to clear it - * @throws IllegalArgumentException if location is null - * @throws IllegalArgumentException if lines is non-null and has a length less than 4 -+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual -+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()} -+ * (constructed e.g. via {@link Material#createBlockData()}) - */ -+ @Deprecated // Paper - public void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException; - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @throws IllegalArgumentException if location is null - * @throws IllegalArgumentException if dyeColor is null - * @throws IllegalArgumentException if lines is non-null and has a length less than 4 -+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual -+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()} -+ * (constructed e.g. via {@link Material#createBlockData()}) - */ -+ @Deprecated // Paper - public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException; - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @throws IllegalArgumentException if location is null - * @throws IllegalArgumentException if dyeColor is null - * @throws IllegalArgumentException if lines is non-null and has a length less than 4 -+ * @deprecated Use {@link #sendBlockUpdate(Location, TileState)} by creating a new virtual -+ * {@link org.bukkit.block.Sign} block state via {@link BlockData#createBlockState()} -+ * (constructed e.g. via {@link Material#createBlockData()}) - */ -+ @Deprecated // Paper - public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException; - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @throws IllegalArgumentException Thrown if the URL is null. - * @throws IllegalArgumentException Thrown if the URL is too long. - * @deprecated Minecraft no longer uses textures packs. Instead you -- * should use {@link #setResourcePack(String)}. -+ * should use {@link #setResourcePack(UUID, String, byte[], net.kyori.adventure.text.Component, boolean)}. - */ - @Deprecated(since = "1.7.2") - public void setTexturePack(@NotNull String url); -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @throws IllegalArgumentException Thrown if the URL is null. - * @throws IllegalArgumentException Thrown if the URL is too long. The - * length restriction is an implementation specific arbitrary value. -+ * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)} - */ -+ @Deprecated // Paper - adventure - public void setResourcePack(@NotNull String url); - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * pack correctly. - * - * -+ * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)} - * @param url The URL from which the client will download the resource - * pack. The string must contain only US-ASCII characters and should - * be encoded as per RFC 1738. -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @throws IllegalArgumentException Thrown if the hash is not 20 bytes - * long. - */ -+ @Deprecated // Paper - adventure - public void setResourcePack(@NotNull String url, @Nullable byte[] hash); - - /** -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * {@link PlayerResourcePackStatusEvent} to figure out whether or not - * the player loaded the pack! - *

  • To remove a resource pack you can use -- * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}. -+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}. - *
  • The request is sent with empty string as the hash when the hash is - * not provided. This might result in newer versions not loading the - * pack correctly. - * - * -+ * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)} - * @param url The URL from which the client will download the resource - * pack. The string must contain only US-ASCII characters and should - * be encoded as per RFC 1738. -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @throws IllegalArgumentException Thrown if the hash is not 20 bytes - * long. - */ -+ @Deprecated // Paper - adventure - public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt); - -+ // Paper start - /** - * Request that the player's client download and switch resource packs. - *

    -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * {@link PlayerResourcePackStatusEvent} to figure out whether or not - * the player loaded the pack! - *

  • To remove a resource pack you can use -- * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}. -+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}. -+ *
  • The request is sent with empty string as the hash when the hash is -+ * not provided. This might result in newer versions not loading the -+ * pack correctly. -+ * -+ * -+ * @param url The URL from which the client will download the resource -+ * pack. The string must contain only US-ASCII characters and should -+ * be encoded as per RFC 1738. -+ * @param hash The sha1 hash sum of the resource pack file which is used -+ * to apply a cached version of the pack directly without downloading -+ * if it is available. Hast to be 20 bytes long! -+ * @param prompt The optional custom prompt message to be shown to client. -+ * @throws IllegalArgumentException Thrown if the URL is null. -+ * @throws IllegalArgumentException Thrown if the URL is too long. The -+ * length restriction is an implementation specific arbitrary value. -+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes -+ * long. -+ * @see #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest) -+ */ -+ default void setResourcePack(final @NotNull String url, final byte @Nullable [] hash, final net.kyori.adventure.text.@Nullable Component prompt) { -+ this.setResourcePack(url, hash, prompt, false); -+ } -+ // Paper end -+ -+ /** -+ * Request that the player's client download and switch resource packs. -+ *

    -+ * The player's client will download the new resource pack asynchronously -+ * in the background, and will automatically switch to it once the -+ * download is complete. If the client has downloaded and cached a -+ * resource pack with the same hash in the past it will not download but -+ * directly apply the cached pack. If the hash is null and the client has -+ * downloaded and cached the same resource pack in the past, it will -+ * perform a file size check against the response content to determine if -+ * the resource pack has changed and needs to be downloaded again. When -+ * this request is sent for the very first time from a given server, the -+ * client will first display a confirmation GUI to the player before -+ * proceeding with the download. -+ *

    -+ * Notes: -+ *