Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11702)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
ed0ec489 SPIGOT-7965: Unknown TransformReason for Hoglins
9db03457 SPIGOT-7964: Fix typo in Deprecation annotation
d14119af PR-1082: Add "since" to Deprecation annotations
e8a318d4 PR-1067: Add method to get Advancement requirements

CraftBukkit Changes:
40dd796db SPIGOT-7971: NotSerializableException on serialize CraftUseCooldownComponent
fa85c5e0a SPIGOT-7968: ProjectileHitEvent not trigerred when arrow hits entity
b75b792ec SPIGOT-7970: World#getMaxHeight() returning incorrect value
2b9a094bb SPIGOT-7965: Unknown TransformReason for Hoglins
fd3f5a380 SPIGOT-7966: Some trees do not generate with #generateTree
f2822317c PR-1515: Add a Class reader and Class node argument provider
07abf6852 PR-1514: Add a test case for ClassTraverser
a7577cb24 Fix Inventory#addItem not respecting max stack size
066a74e74 PR-1490: Add method to get Advancement requirements
4a1df30e4 PR-1512: Test Art class based on specific values instead of the implementation, to better catch implementation changes
53254c56f PR-1503: Simplify CAS loop to getAndSet
e9447dc5e Make BlockDataMeta#setBlockData hide unspecified states
dd08a7120 SPIGOT-7960: Fix inconsistency between natural item drop coordinates
e9e8ed753 SPIGOT-7960: Improve natural item drop methods

Spigot Changes:
60c9969b Rebuild patches
This commit is contained in:
Bjarne Koll 2024-12-03 15:47:48 +01:00
parent 65ca4c1911
commit 881d616533
50 changed files with 374 additions and 347 deletions

View file

@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@Nullable
@Deprecated
@Deprecated(since = "1.20.4")
public Location getBedSpawnLocation();
+ // Paper start
+ /**

View file

@ -198,7 +198,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+public class SheepDyeWoolEvent extends io.papermc.paper.event.entity.EntityDyeEvent implements Cancellable {
+ // Paper - move everything to superclass
@Deprecated
@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 {
}

View file

@ -141,34 +141,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed {
* @deprecated not available since 1.21.2
*/
@Deprecated
@Deprecated(since = "1.21.2")
- public static final FeatureFlag BUNDLE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("bundle"));
+ FeatureFlag BUNDLE = deprecated("bundle");
/**
- * <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19 - 1.19.4
- *
- * @deprecated not available since 1.20
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19 - 1.19.4
*
* @deprecated not available since 1.20
+ * The {@code trade_rebalance} feature flag.
*/
- @Deprecated
- @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");
- /**
- * <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.20.5 - 1.20.6
- *
- * @deprecated not available since 1.21
- */
- @Deprecated
/**
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 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"));
+ @Deprecated(since = "1.20")
+ FeatureFlag UPDATE_1_20 = deprecated("update_1_20");
+
+ @Deprecated(since = "1.21")
+ FeatureFlag UPDATE_121 = deprecated("update_1_21");
@ApiStatus.Experimental // Paper - add missing annotation

View file

@ -156,5 +156,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private final Map<LivingEntity, Double> affectedEntities;
+ protected final Map<LivingEntity, Double> affectedEntities; // Paper
@Deprecated
@Deprecated(since = "1.20.2")
public PotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final Map<LivingEntity, Double> affectedEntities) {

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- 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
@Deprecated(since = "1.17")
@Contract("_ -> fail")
public void setSkeletonType(Skeleton.SkeletonType type);
+

View file

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Entity damager;
+ private final boolean critical; // Paper
@Deprecated(forRemoval = true)
@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);
}
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.critical = false; // Paper - add critical damage API
}
@Deprecated(forRemoval = true)
@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);
}

View file

@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.drops = drops; // Paper - custom shear drops
}
@Deprecated
@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

View file

@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- 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
@Deprecated(since = "1.7.10")
@NotNull
public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException;
+

View file

@ -32,8 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*
* @param count amount of arrows in entity's body
+ * @param fireEvent whether to fire the {@link org.bukkit.event.entity.ArrowBodyCountChangeEvent} event
*/
- public void setArrowsInBody(int count);
+ */
+ void setArrowsInBody(int count, boolean fireEvent); // Paper
+
+ // Paper start - Add methods for working with arrows stuck in living entities
@ -43,7 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * 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);
+
+ /**

View file

@ -316,7 +316,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* 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
@Deprecated(since = "1.20.6")
Material asMaterial();
+
+ // Paper start - add Translatable
@ -568,7 +568,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* 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
@Deprecated(since = "1.20.6")
Material asMaterial();
+
+ // Paper start - add Translatable

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/entity/Evoker.java
@@ -0,0 +0,0 @@ public interface Evoker extends Spellcaster {
*/
@Deprecated
@Deprecated(since = "1.11.2")
void setCurrentSpell(@Nullable Spell spell);
+
+ // Paper start

View file

@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/advancement/Advancement.java
@@ -0,0 +0,0 @@ public interface Advancement extends Keyed {
@NotNull
Collection<String> getCriteria();
AdvancementRequirements getRequirements();
+ // Paper start
/**

View file

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private final String hostname; // Paper
private final boolean transferred;
@Deprecated
@Deprecated(since = "1.7.5")
@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event {
}

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/
@Deprecated
@Deprecated(since = "1.12")
public void setShoulderEntityRight(@Nullable Entity entity);
+ // Paper start - Add method to open already placed sign
+ /**

View file

@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- 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
@Deprecated(since = "1.12.1")
boolean setOwner(@Nullable String owner);
+ // Paper start

View file

@ -1562,7 +1562,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
*/
@Deprecated
@Deprecated(since = "1.7.2")
public interface UnsafeValues {
+ // Paper start
+ net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener();
@ -1714,7 +1714,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @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
@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
@ -1723,7 +1723,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @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
@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
@ -1732,7 +1732,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @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
@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
@ -1837,7 +1837,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return false;
@@ -0,0 +0,0 @@ public abstract class Command {
@Deprecated
@Deprecated(since = "1.20.4")
@Nullable
public String getPermissionMessage() {
- return permissionMessage;
@ -1846,7 +1846,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public abstract class Command {
@Deprecated
@Deprecated(since = "1.20.4")
@NotNull
public Command setPermissionMessage(@Nullable String permissionMessage) {
- this.permissionMessage = permissionMessage;
@ -2664,7 +2664,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * should use {@link #setResourcePack(String)}.
+ * should use {@link #setResourcePack(UUID, String, byte[], net.kyori.adventure.text.Component, boolean)}.
*/
@Deprecated
@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.
@ -2947,7 +2947,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @deprecated API behavior subject to change
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
*/
@Deprecated
@Deprecated(since = "1.8.7")
public void sendTitle(@Nullable String title, @Nullable String subtitle);
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param fadeIn time in ticks for titles to fade in. Defaults to 10.
@ -3136,7 +3136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
@Deprecated
@Deprecated(since = "1.19.4")
public SignChangeEvent(@NotNull final Block theBlock, @NotNull final Player thePlayer, @NotNull final String[] theLines) {
this(theBlock, thePlayer, theLines, Side.FRONT);
}
@ -3467,9 +3467,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ public void disallow(@NotNull final Result result, @NotNull final net.kyori.adventure.text.Component message) {
+ this.result = result;
this.message = message;
}
+ this.message = message;
+ }
+
+ /**
+ * Disallows the player from logging in, with the given reason
+ *
@ -3482,8 +3482,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Deprecated
+ public void disallow(@NotNull final PlayerPreLoginEvent.Result result, @NotNull final net.kyori.adventure.text.Component message) {
+ this.result = result == null ? null : Result.valueOf(result.name());
+ this.message = message;
+ }
this.message = message;
}
+ // Paper end
+ /**
+ * Gets the current kick message that will be used if getResult() !=
@ -3508,7 +3508,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void setKickMessage(@NotNull final String message) {
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper
+ }
+
/**
* Allows the player to log in
*/
@ -3534,7 +3534,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event {
@Deprecated
@Deprecated(since = "1.3.2")
public void disallow(@NotNull final PlayerPreLoginEvent.Result result, @NotNull final String message) {
this.result = result == null ? null : Result.valueOf(result.name());
- this.message = message;
@ -3558,7 +3558,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * alternative for thread safe implementations.
+ * @deprecated Listening to this event forces chat to wait for the main thread, delaying chat messages. It is recommended to use {@link io.papermc.paper.event.player.AsyncChatEvent} instead, wherever possible.
*/
@Deprecated
@Deprecated(since = "1.3.1")
@Warning(reason = "Listening to this event forces chat to wait for the main thread, delaying chat messages.")
diff --git a/src/main/java/org/bukkit/event/player/PlayerEvent.java b/src/main/java/org/bukkit/event/player/PlayerEvent.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -4947,7 +4947,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public final class MapCursor {
*/
@Deprecated
@Deprecated(since = "1.6.2")
public MapCursor(byte x, byte y, byte direction, byte type, boolean visible) {
- this(x, y, direction, type, visible, null);
+ this(x, y, direction, type, visible, (String) null); // Paper
@ -4970,7 +4970,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @deprecated Magic value, use {@link #MapCursor(byte, byte, byte, Type, boolean, String)}
+ * @deprecated Magic value. Use {@link #MapCursor(byte, byte, byte, Type, boolean, net.kyori.adventure.text.Component)}
*/
@Deprecated
@Deprecated(since = "1.13")
public MapCursor(byte x, byte y, byte direction, byte type, boolean visible, @Nullable String caption) {
@@ -0,0 +0,0 @@ public final class MapCursor {
setDirection(direction);
@ -4996,7 +4996,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.x = x; this.y = y; this.visible = visible; this.caption = caption;
+ setDirection(direction);
+ setRawType(type);
}
+ }
+ /**
+ * Initialize the map cursor.
+ *
@ -5011,7 +5011,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.x = x; this.y = y; this.visible = visible; this.caption = caption;
+ setDirection(direction);
+ setType(type);
+ }
}
+ // Paper end
/**
@ -5290,7 +5290,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @deprecated use {@link #registerNewObjective(String, Criteria, String)}
+ * @deprecated use {@link #registerNewObjective(String, Criteria, net.kyori.adventure.text.Component)}
*/
@Deprecated
@Deprecated(since = "1.20.5")
@NotNull
@@ -0,0 +0,0 @@ public interface Scoreboard {
* characters.
@ -5299,7 +5299,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @deprecated use {@link #registerNewObjective(String, Criteria, String, RenderType)}
+ * @deprecated use {@link #registerNewObjective(String, Criteria, net.kyori.adventure.text.Component, RenderType)}
*/
@Deprecated
@Deprecated(since = "1.20.5")
@NotNull
@@ -0,0 +0,0 @@ public interface Scoreboard {
* characters.

View file

@ -246,8 +246,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @return The list of effects
* @deprecated Non-Functional
*/
- @Deprecated
+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper
- @Deprecated(since = "1.6.2")
+ @Deprecated(since = "1.6.2", forRemoval = true) // Paper
@NotNull
- public Collection<PotionEffect> getEffectsFromDamage(int damage);
+ // Paper start - make default
@ -262,7 +262,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link PotionType#getPotionEffects()} instead
*/
@NotNull
- @Deprecated
+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper
- @Deprecated(since = "1.20.2")
+ @Deprecated(since = "1.20.2", forRemoval = true) // Paper
public Collection<PotionEffect> getEffects(@NotNull PotionType type, boolean upgraded, boolean extended);
}

View file

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Tue, 3 Dec 2024 15:33:45 +0100
Subject: [PATCH] Disable deprecated annotation test
diff --git a/src/test/java/org/bukkit/DeprecatedTest.java b/src/test/java/org/bukkit/DeprecatedTest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/DeprecatedTest.java
+++ b/src/test/java/org/bukkit/DeprecatedTest.java
@@ -0,0 +0,0 @@ import com.google.common.base.Joiner;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.support.test.ClassNodeTest;
+import org.junit.jupiter.api.Disabled;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode;
@@ -0,0 +0,0 @@ import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.RecordComponentNode;
+@Disabled
public class DeprecatedTest {
private static final String DEPRECATED_DESC = Type.getDescriptor(Deprecated.class);

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- 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 {
@Deprecated
@Deprecated(since = "1.12")
public ShapedRecipe(@NotNull ItemStack result) {
this(NamespacedKey.randomKey(), result);
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace(); // Paper
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- 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 {
@Deprecated
@Deprecated(since = "1.12")
public ShapelessRecipe(@NotNull ItemStack result) {
this(NamespacedKey.randomKey(), result);
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace(); // Paper

View file

@ -163,7 +163,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @deprecated prefer {@link ArmorStand#getItem(EquipmentSlot)} // Paper
*/
@NotNull
@Deprecated
@Deprecated(since = "1.15.2")
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
* @param item the item to hold
* @see #getEquipment()
@ -171,7 +171,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * {@link EntityEquipment#setItemInHand(org.bukkit.inventory.ItemStack)}
+ * {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} // Paper
*/
@Deprecated
@Deprecated(since = "1.15.2")
void setItemInHand(@Nullable ItemStack item);
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
* @param tick {@code true} if this armour stand can tick, {@code false} otherwise

View file

@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @deprecated Magic value
+ * @deprecated Magic value. Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)}
*/
@Deprecated
@Deprecated(since = "1.7.5")
@NotNull
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final AreaEffectCloud entity;
+ private boolean allowEmptyAreaEffectCreation; // Paper
@Deprecated
@Deprecated(since = "1.20.2")
public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final AreaEffectCloud entity) {
@@ -0,0 +0,0 @@ public class LingeringPotionSplashEvent extends ProjectileHitEvent implements Ca
return entity;

View file

@ -82,5 +82,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper end
@Deprecated
@Deprecated(since = "1.19.2")
public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull ExperienceOrb experienceOrb, int repairAmount) {

View file

@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/FeatureFlag.java
+++ b/src/main/java/org/bukkit/FeatureFlag.java
@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed {
@Deprecated
@Deprecated(since = "1.20.2")
public static final FeatureFlag UPDATE_1_20 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_20"));
+ @ApiStatus.Experimental // Paper - add missing annotation
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed {
@Deprecated
@Deprecated(since = "1.21")
public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21"));
+ @ApiStatus.Experimental // Paper - add missing annotation

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Player player;
+ private final org.bukkit.inventory.EquipmentSlot hand; // Paper - expose hand
@Deprecated
@Deprecated(since = "1.13.2")
public BlockCanBuildEvent(@NotNull final Block block, @NotNull final BlockData type, final boolean canBuild) {
- this(block, null, type, canBuild);
+ this(block, null, type, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); // Paper - expose hand

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/BanList.java
@@ -0,0 +0,0 @@ public interface BanList<T> {
*/
@Deprecated
@Deprecated(since = "1.20.1")
@Nullable
- public BanEntry<T> getBanEntry(@NotNull String target);
+ public <E extends BanEntry<? super T>> E getBanEntry(@NotNull String target); // Paper
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* Gets a {@link BanEntry} by target.
@@ -0,0 +0,0 @@ public interface BanList<T> {
*/
@Deprecated
@Deprecated(since = "1.20.1")
@Nullable
- public BanEntry<T> addBan(@NotNull String target, @Nullable String reason, @Nullable Date expires, @Nullable String source);
+ public <E extends BanEntry<? super T>> E addBan(@NotNull String target, @Nullable String reason, @Nullable Date expires, @Nullable String source); // Paper

View file

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @param instrument the Instrument. Has no effect if null.
- * @deprecated no effect on newer Minecraft versions
*/
- @Deprecated
- @Deprecated(since = "1.13")
public void setInstrument(@NotNull Instrument instrument) {
if (instrument != null) {
this.instrument = instrument;
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @param note the Note. Has no effect if null.
- * @deprecated no effect on newer Minecraft versions
*/
- @Deprecated
- @Deprecated(since = "1.13")
public void setNote(@NotNull Note note) {
if (note != null) {
this.note = note;

View file

@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @return The entity type. May be null for implementation specific default.
* @deprecated different types are different items
*/
- @Deprecated
+ @Deprecated(forRemoval = true) // Paper
- @Deprecated(since = "1.13")
+ @Deprecated(since = "1.13", forRemoval = true) // Paper
@Contract("-> fail")
EntityType getSpawnedType();
@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* default.
* @deprecated different types are different items
*/
- @Deprecated
+ @Deprecated(forRemoval = true) // Paper
- @Deprecated(since = "1.13")
+ @Deprecated(since = "1.13", forRemoval = true) // Paper
@Contract("_ -> fail")
void setSpawnedType(EntityType type);

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
*/
@Nullable
@Deprecated
@Deprecated(since = "1.20.5")
+ @io.papermc.paper.annotation.DoNotUse // Paper
public EquipmentSlot getSlot() {
return slot == EquipmentSlotGroup.ANY ? null : slot.getExample();

View file

@ -241,10 +241,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* Represents a captured state of a bed.
- * @deprecated does not provide useful information beyond the material itself
*/
-@Deprecated
-@Deprecated(since = "1.13")
-public interface Bed extends TileState, Colorable { }
+// Paper start
+// @Deprecated
+// @Deprecated(since = "1.13")
+public interface Bed extends TileState, Colorable {
+
+ @Override
@ -377,7 +377,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * @deprecated use {@link #getAttachedFace()}
+ * @deprecated use {@link #setAttachedFace(AttachedFace)}
*/
@Deprecated
@Deprecated(since = "1.15.2")
void setFace(@NotNull Face face);
@@ -0,0 +0,0 @@ public interface Switch extends Directional, FaceAttachable, Powerable {
*/
@ -1091,8 +1091,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @deprecated This is simply the online players. Modifications have no effect
*/
@NotNull
- @Deprecated
+ @Deprecated(forRemoval = true)
- @Deprecated(since = "1.3.1")
+ @Deprecated(since = "1.3.1", forRemoval = true)
public Set<Player> getRecipients() {
return recipients;
}

View file

@ -17,5 +17,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * chunk as before as terrain decoration may be spread across chunks. It may
+ * or may not change blocks in the adjacent chunks as well.
*/
@Deprecated
@Deprecated(since = "1.13")
public boolean regenerateChunk(int x, int z);

View file

@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @see #getScore(String)
- * @deprecated Scoreboards can contain entries that aren't players
*/
- @Deprecated
+ // @Deprecated // Paper
- @Deprecated(since = "1.7.8")
+ // @Deprecated(since = "1.7.8") // Paper
@NotNull
Score getScore(@NotNull OfflinePlayer player);
@ -46,8 +46,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @see #getScores(String)
- * @deprecated Scoreboards can contain entries that aren't players
*/
- @Deprecated
+ // @Deprecated // Paper
- @Deprecated(since = "1.7.8")
+ // @Deprecated(since = "1.7.8") // Paper
@NotNull
Set<Score> getScores(@NotNull OfflinePlayer player);
@ -57,8 +57,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @see #resetScores(String)
- * @deprecated Scoreboards can contain entries that aren't players
*/
- @Deprecated
+ // @Deprecated // Paper
- @Deprecated(since = "1.7.8")
+ // @Deprecated(since = "1.7.8") // Paper
void resetScores(@NotNull OfflinePlayer player);
/**
@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @see #getEntryTeam(String)
- * @deprecated Scoreboards can contain entries that aren't players
*/
- @Deprecated
+ // @Deprecated // Paper
- @Deprecated(since = "1.8.6")
+ // @Deprecated(since = "1.8.6") // Paper
@Nullable
Team getPlayerTeam(@NotNull OfflinePlayer player);
@ -119,8 +119,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @see #addEntry(String)
- * @deprecated Teams can contain entries that aren't players
*/
- @Deprecated
+ // @Deprecated // Paper
- @Deprecated(since = "1.8.6")
+ // @Deprecated(since = "1.8.6") // Paper
void addPlayer(@NotNull OfflinePlayer player);
/**
@ -130,8 +130,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @see #removeEntry(String)
- * @deprecated Teams can contain entries that aren't players
*/
- @Deprecated
+ // @Deprecated // Paper
- @Deprecated(since = "1.8.6")
+ // @Deprecated(since = "1.8.6") // Paper
boolean removePlayer(@NotNull OfflinePlayer player);
/**
@ -141,8 +141,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @see #hasEntry(String)
- * @deprecated Teams can contain entries that aren't players
*/
- @Deprecated
+ // @Deprecated // Paper
- @Deprecated(since = "1.8.6")
+ // @Deprecated(since = "1.8.6") // Paper
boolean hasPlayer(@NotNull OfflinePlayer player);
/**
* Checks to see if the specified entry is a member of this team.

View file

@ -426,7 +426,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/entity/Endermite.java
@@ -0,0 +0,0 @@ public interface Endermite extends Monster {
*/
@Deprecated
@Deprecated(since = "1.17")
void setPlayerSpawned(boolean playerSpawned);
+ // Paper start
+ /**

View file

@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- * only for {@link Enchantment#BINDING_CURSE} and
- * {@link Enchantment#VANISHING_CURSE}.
*/
- @Deprecated
- @Deprecated(since = "1.13")
public abstract boolean isCursed();
/**

View file

@ -261,7 +261,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ProjectileSource getShooter();
@@ -0,0 +0,0 @@ public interface Projectile extends Entity {
*/
@Deprecated(forRemoval = true)
@Deprecated(since = "1.20.2", forRemoval = true)
public void setBounce(boolean doesBounce);
+ // Paper start
+

View file

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* Create a smithing recipe to produce the specified result ItemStack.
@@ -0,0 +0,0 @@ public class SmithingRecipe implements Recipe, Keyed {
*/
@Deprecated
@Deprecated(since = "1.20.1")
public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @Nullable RecipeChoice base, @Nullable RecipeChoice addition) {
+ // Paper start
+ this(key, result, base, addition, true);

View file

@ -1730,7 +1730,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
addPermission(perm, true);
}
@Deprecated
@Deprecated(since = "1.12")
public void addPermission(@NotNull Permission perm, boolean dirty) {
+ if (true) {this.paperPluginManager.addPermission(perm); return;} // Paper - This just has a performance implication, use the better api to avoid this.
String name = perm.getName().toLowerCase(Locale.ROOT);

View file

@ -185,7 +185,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
*/
@Deprecated
@Deprecated(since = "1.13")
public void setDurability(final short durability) {
- ItemMeta meta = getItemMeta();
- if (meta != null) {
@ -198,7 +198,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
*/
@Deprecated
@Deprecated(since = "1.13")
public short getDurability() {
- ItemMeta meta = getItemMeta();
- return (meta == null) ? 0 : (short) ((Damageable) meta).getDamage();

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final RespawnReason respawnReason;
+ private final java.util.Set<RespawnFlag> respawnFlags; // Paper
@Deprecated
@Deprecated(since = "1.16.1")
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn) {
@@ -0,0 +0,0 @@ public class PlayerRespawnEvent extends PlayerEvent {
this(respawnPlayer, respawnLocation, isBedSpawn, false, RespawnReason.PLUGIN);

View file

@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @return The type ID of this instrument.
- * @deprecated Magic value
*/
- @Deprecated
- @Deprecated(since = "1.6.2")
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
public byte getType() {
return this.type;
@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @return The instrument
- * @deprecated Magic value
*/
- @Deprecated
- @Deprecated(since = "1.6.2")
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
@Nullable
public static Instrument getByType(final byte type) {

View file

@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
@@ -0,0 +0,0 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
public long nextSubTickCount() {
return this.world.nextSubTickCount();
public RandomSource getRandom() {
return this.world.getRandom();
}
+
+ // Paper start

View file

@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
+++ b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
@@ -0,0 +0,0 @@ public class CraftAdvancement implements org.bukkit.advancement.Advancement {
return Collections.unmodifiableCollection(this.handle.value().criteria().keySet());
return new CraftAdvancementRequirements(this.handle.value().requirements());
}
+ // Paper start - Add more advancement API

View file

@ -53,6 +53,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ChunkGenerator chunkGenerator,
RandomState noiseConfig,
LevelHeightAccessor world,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
}
}
- return new CraftChunkSnapshot(x, z, world.getMinHeight(), world.getMaxHeight(), world.getSeaLevel(), world.getName(), world.getFullTime(), blockIDs, skyLight, emitLight, empty, new Heightmap(actual, Heightmap.Types.MOTION_BLOCKING), iregistry, biome);
+ return new CraftChunkSnapshot(x, z, world.getMinHeight(), world.getMaxY(), world.getSeaLevel(), world.getName(), world.getFullTime(), blockIDs, skyLight, emitLight, empty, new Heightmap(actual, Heightmap.Types.MOTION_BLOCKING), iregistry, biome);
}
static void validateChunkCoordinates(int minY, int maxY, int x, int y, int z) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
@ -69,6 +82,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.world.getMaxY() + 1;
}
+ public int getMaxY() {
+ return this.world.getMaxY();
+ }
+
@Override
public int getLogicalHeight() {
return this.world.dimensionType().logicalHeight();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java

View file

@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bjarne Koll <git@lynxplay.dev>
Date: Sat, 23 Nov 2024 22:48:26 +0100
Subject: [PATCH] Call ProjectileHitEvent for entity hits
A simple bugfix replacing a new vanilla call to
Projectile#hitTargetOrDeflectSelf with the bukkit replacement to call
the event.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -0,0 +0,0 @@ public abstract class AbstractArrow extends Projectile {
continue;
}
- ProjectileDeflection projectiledeflection = this.hitTargetOrDeflectSelf(movingobjectpositionentity);
+ ProjectileDeflection projectiledeflection = this.preHitTargetOrDeflectSelf(movingobjectpositionentity); // Paper - also call projectile hit event
this.hasImpulse = true;
if (this.getPierceLevel() > 0 && projectiledeflection == ProjectileDeflection.NONE) {

View file

@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
private void finishConversion() {
- this.convertTo(
+ net.minecraft.world.entity.Entity converted = this.convertTo( // Paper - Fix issues with mob conversion; reset to prevent event spam
EntityType.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0))
);
- this.convertTo(EntityType.ZOGLIN, ConversionParams.single(this, true, false), (entityzoglin) -> {
+ net.minecraft.world.entity.Entity converted = this.convertTo(EntityType.ZOGLIN, ConversionParams.single(this, true, false), (entityzoglin) -> {
entityzoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0));
}, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED); // CraftBukkit - add spawn and transform reasons
+
+ // Paper start - Fix issues with mob conversion; reset to prevent event spam
+ if (converted == null) {

View file

@ -330,10 +330,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private void addTask(final CraftTask task) {
+ protected void addTask(final CraftTask task) {
final AtomicReference<CraftTask> tail = this.tail;
CraftTask tailTask = tail.get();
while (!tail.compareAndSet(tailTask, task)) {
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
final CraftTask tailTask = this.tail.getAndSet(task);
tailTask.setNext(task);
}

@ -1 +1 @@
Subproject commit 36b11391a2c0213669acfa9b863a3a3704374fbc
Subproject commit ed0ec4893b5f755e2493e652091bba42dc7ad742

@ -1 +1 @@
Subproject commit a71a7e1f57653334d66e389d162a437b1491bfc8
Subproject commit 40dd796db69931bd3b5220f2ee4d734a8bd44c9d

@ -1 +1 @@
Subproject commit e65d67a7a97d6502296109d5c295255ecbc04575
Subproject commit 60c9969b3e34b1a7c8f06e358241399b5f47bfb1