[ci skip] rebuild patches

This commit is contained in:
Jake Potrebic 2023-03-23 14:57:03 -07:00
parent 9087a644a3
commit 23b0ef524a
No known key found for this signature in database
GPG key ID: 27CC63F7CBC866C7
60 changed files with 1138 additions and 1222 deletions

View file

@ -288,12 +288,12 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..c26ea217927ba77611e6ae93f8df50a8
+ return true;
+ }
+ }
- private static boolean isWellAnnotated(@Nullable List<AnnotationNode> annotations) {
+
+ return false;
+ }
+ // Paper end
+
- private static boolean isWellAnnotated(@Nullable List<AnnotationNode> annotations) {
+ private static boolean isWellAnnotated(@Nullable List<? extends AnnotationNode> annotations) { // Paper
if (annotations == null) {
return false;

File diff suppressed because it is too large Load diff

View file

@ -2194,7 +2194,7 @@ index 2f74ec96ece706de23156ebabfe493211bc05391..302319acbc257a075adfb78d9f5c49fd
- javaPlugin.init(loader, loader.server, description, dataFolder, file, this);
+ javaPlugin.init(null, org.bukkit.Bukkit.getServer(), description, dataFolder, file, this); // Paper
}
+ }
+
+ // Paper start
+ @Override
@ -2219,7 +2219,7 @@ index 2f74ec96ece706de23156ebabfe493211bc05391..302319acbc257a075adfb78d9f5c49fd
+ Class<? extends org.bukkit.configuration.serialization.ConfigurationSerializable> serializable = clazz.asSubclass(org.bukkit.configuration.serialization.ConfigurationSerializable.class);
+ org.bukkit.configuration.serialization.ConfigurationSerialization.unregisterClass(serializable);
+ }
+ }
}
+
+ @Override
+ public @Nullable io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup getGroup() {

View file

@ -3400,12 +3400,12 @@ index fbf56bcc4540f7f1a8ced7cc2cd96e291c1ac273..8602b96bfc860ff1fea4c1c7a3655ce3
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
+
}
+ }
+
+ // Paper start
+ public int getPing() {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
}
+ // Paper end
}
@ -3611,8 +3611,7 @@ index 44badfedcc3fdc26bdc293b85d8c781d6f659faa..123647bb10fc89508437d7a0bd3fd31d
public CustomTimingsHandler(@NotNull String name) {
- this(name, null);
- }
+ Timing timing;
-
- public CustomTimingsHandler(@NotNull String name, @Nullable CustomTimingsHandler parent) {
- this.name = name;
- this.parent = parent;
@ -3635,16 +3634,7 @@ index 44badfedcc3fdc26bdc293b85d8c781d6f659faa..123647bb10fc89508437d7a0bd3fd31d
- long avg = time / count;
-
- printStream.println(" " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations);
+ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace();
+ try {
+ final Method ofSafe = TimingsManager.class.getDeclaredMethod("getHandler", String.class, String.class, Timing.class);
+ ofSafe.setAccessible(true);
+ timing = (Timing) ofSafe.invoke(null,"Minecraft", "(Deprecated API) " + name, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered");
+ timing = Timings.NULL_HANDLER;
}
- }
- printStream.println("# Version " + Bukkit.getVersion());
- int entities = 0;
- int livingEntities = 0;
@ -3654,9 +3644,8 @@ index 44badfedcc3fdc26bdc293b85d8c781d6f659faa..123647bb10fc89508437d7a0bd3fd31d
- }
- printStream.println("# Entities " + entities);
- printStream.println("# LivingEntities " + livingEntities);
+ handler = timing;
}
- }
-
- /**
- * Resets all timings.
- */
@ -3668,9 +3657,7 @@ index 44badfedcc3fdc26bdc293b85d8c781d6f659faa..123647bb10fc89508437d7a0bd3fd31d
- }
- TimingsCommand.timingStart = System.nanoTime();
- }
+ public void startTiming() { handler.startTiming(); }
+ public void stopTiming() { handler.stopTiming(); }
-
- /**
- * Ticked every tick by CraftBukkit to count the number of times a timer
- * caused TPS loss.
@ -3686,7 +3673,8 @@ index 44badfedcc3fdc26bdc293b85d8c781d6f659faa..123647bb10fc89508437d7a0bd3fd31d
- }
- }
- }
-
+ Timing timing;
- /**
- * Starts timing to track a section of code.
- */
@ -3697,9 +3685,19 @@ index 44badfedcc3fdc26bdc293b85d8c781d6f659faa..123647bb10fc89508437d7a0bd3fd31d
- if (parent != null && ++parent.timingDepth == 1) {
- parent.start = start;
- }
- }
- }
-
+ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace();
+ try {
+ final Method ofSafe = TimingsManager.class.getDeclaredMethod("getHandler", String.class, String.class, Timing.class);
+ ofSafe.setAccessible(true);
+ timing = (Timing) ofSafe.invoke(null,"Minecraft", "(Deprecated API) " + name, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered");
+ timing = Timings.NULL_HANDLER;
}
+ handler = timing;
}
- /**
- * Stops timing a section of code.
- */
@ -3718,7 +3716,9 @@ index 44badfedcc3fdc26bdc293b85d8c781d6f659faa..123647bb10fc89508437d7a0bd3fd31d
- }
- }
- }
-
+ public void startTiming() { handler.startTiming(); }
+ public void stopTiming() { handler.stopTiming(); }
- /**
- * Reset this timer, setting all values to zero.
- */

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
index 8feb6698f9630f099be99e52d1149cd6bc615197..d51d2ec1d04d9ea8a25a70d0d856f2355ebfcb4a 100644
--- a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
@@ -13,13 +13,32 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
@@ -13,12 +13,31 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
private boolean cancelled;
private double amount;
private final RegainReason regainReason;
@ -25,8 +25,8 @@ index 8feb6698f9630f099be99e52d1149cd6bc615197..d51d2ec1d04d9ea8a25a70d0d856f235
this.amount = amount;
this.regainReason = regainReason;
+ this.isFastRegen = isFastRegen; // Paper
}
+ }
+
+ // Paper start - Add getter for isFastRegen
+ /**
+ * Is this event a result of the fast regeneration mechanic
@ -35,9 +35,8 @@ index 8feb6698f9630f099be99e52d1149cd6bc615197..d51d2ec1d04d9ea8a25a70d0d856f235
+ */
+ public boolean isFastRegen() {
+ return isFastRegen;
+ }
}
+ // Paper end
+
/**
* Gets the amount of regained health
*

View file

@ -18,21 +18,21 @@ index dbe15267053cfd6bdac093f798dda1cb5aff02c4..95130fde38e7fcec4139fac97df25d82
public void resetPlayerWeather();
+ // Paper start
/**
* Gives the player the amount of experience specified.
*
* @param amount Exp amount to give
*/
- public void giveExp(int amount);
+ public default void giveExp(int amount) {
+ giveExp(amount, false);
+ }
+ /**
+ * 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 default void giveExp(int amount) {
+ giveExp(amount, false);
+ }
/**
* 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);
+
+ /**

View file

@ -18,7 +18,7 @@ index d4d7ad9c3c953680342c121f39ddaef476549047..719d0d878320c1903b44076053989ba9
+ public void setConsumeArrow(boolean consumeArrow) {
+ this.setConsumeItem(consumeArrow);
+ }
+
+ @Deprecated
+ public boolean getConsumeArrow() {
+ return this.shouldConsumeItem();
@ -33,7 +33,7 @@ index d4d7ad9c3c953680342c121f39ddaef476549047..719d0d878320c1903b44076053989ba9
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) {
+ this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force);
+ }
+
+ @Deprecated
+ public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull ItemStack arrowItem, @NotNull final Entity projectile, final float force) {
+ this(shooter, bow, arrowItem, projectile, EquipmentSlot.HAND, force, true);

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/o
index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..f1a48eab1a357ae64545e1f1dc941c383cff8707 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -104,7 +104,37 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -104,7 +104,9 @@ public interface Inventory extends Iterable<ItemStack> {
public HashMap<Integer, ItemStack> addItem(@NotNull ItemStack... items) throws IllegalArgumentException;
/**
@ -16,6 +16,25 @@ index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..f1a48eab1a357ae64545e1f1dc941c38
+ * Removes the given ItemStacks from the storage contents of the inventory.
+ * For removing ItemStacks from the inventories that have other content groups,
+ * like Player inventories, see {@link #removeItemAnySlot(ItemStack...)}.
* <p>
* It will try to remove 'as much as possible' from the types and amounts
* you give as arguments.
@@ -121,10 +123,39 @@ public interface Inventory extends Iterable<ItemStack> {
* @param items The ItemStacks to remove
* @return A HashMap containing items that couldn't be removed.
* @throws IllegalArgumentException if items is null
+ * @see #removeItemAnySlot(ItemStack...)
*/
@NotNull
public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
+ // Paper start
+ /**
+ * Searches all possible inventory slots in order to remove the given ItemStacks.
+ * <p>
+ * Similar to {@link Inventory#removeItem(ItemStack...)} in behavior, except this
+ * method will check all possible slots in the inventory, rather than just the main
+ * storage contents.
+ * <p>
+ * It will try to remove 'as much as possible' from the types and amounts
+ * you give as arguments.
@ -32,28 +51,11 @@ index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..f1a48eab1a357ae64545e1f1dc941c38
+ * @param items The ItemStacks to remove
+ * @return A HashMap containing items that couldn't be removed.
+ * @throws IllegalArgumentException if items is null
+ * @see #removeItemAnySlot(ItemStack...)
+ */
+ @NotNull
+ public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
+
+ // Paper start
+ /**
+ * Searches all possible inventory slots in order to remove the given ItemStacks.
+ * <p>
+ * Similar to {@link Inventory#removeItem(ItemStack...)} in behavior, except this
+ * method will check all possible slots in the inventory, rather than just the main
+ * storage contents.
* <p>
* It will try to remove 'as much as possible' from the types and amounts
* you give as arguments.
@@ -123,7 +153,8 @@ public interface Inventory extends Iterable<ItemStack> {
* @throws IllegalArgumentException if items is null
*/
@NotNull
- public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
+ public HashMap<Integer, ItemStack> removeItemAnySlot(@NotNull ItemStack... items) throws IllegalArgumentException;
+ // Paper end
+
/**
* Returns all ItemStacks from the inventory
*

View file

@ -104,20 +104,16 @@ index cbe6b3a1ba7b04826d97c3558e8eb4e5ba11f92f..cbdcac688afb7c13dd7058fa522bbd2c
private final String name;
private long seed;
private World.Environment environment = World.Environment.NORMAL;
@@ -28,14 +29,81 @@ public class WorldCreator {
@@ -28,13 +29,80 @@ public class WorldCreator {
* @param name Name of the world that will be created
*/
public WorldCreator(@NotNull String name) {
- if (name == null) {
- throw new IllegalArgumentException("World name cannot be null");
- }
-
- this.name = name;
- this.seed = (new Random()).nextLong();
+ // Paper start
+ this(name, getWorldKey(name));
}
+ }
+
+ private static NamespacedKey getWorldKey(String name) {
+ final String mainLevelName = Bukkit.getUnsafe().getMainLevelName();
+ if (name.equals(mainLevelName)) {
@ -128,9 +124,10 @@ index cbe6b3a1ba7b04826d97c3558e8eb4e5ba11f92f..cbdcac688afb7c13dd7058fa522bbd2c
+ return NamespacedKey.minecraft("the_end");
+ } else {
+ return NamespacedKey.minecraft(name.toLowerCase(java.util.Locale.ENGLISH).replace(" ", "_"));
+ }
}
+ }
+
- this.name = name;
+ /**
+ * Creates an empty WorldCreator for the given world name and key
+ *
@ -142,7 +139,7 @@ index cbe6b3a1ba7b04826d97c3558e8eb4e5ba11f92f..cbdcac688afb7c13dd7058fa522bbd2c
+ throw new IllegalArgumentException("World name and key cannot be null");
+ }
+ this.name = levelName;
+ this.seed = (new Random()).nextLong();
this.seed = (new Random()).nextLong();
+ this.key = worldKey;
+ }
+
@ -186,9 +183,8 @@ index cbe6b3a1ba7b04826d97c3558e8eb4e5ba11f92f..cbdcac688afb7c13dd7058fa522bbd2c
+ @NotNull
+ public static WorldCreator ofKey(@NotNull NamespacedKey worldKey) {
+ return new WorldCreator(worldKey);
+ }
}
+ // Paper end
+
/**
* Copies the options from the specified world
*

View file

@ -194,12 +194,8 @@ index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..3f6b9e59c2ea38031ca74962e02d710f
+ * recipes.
*
- * This includes it's name, description and other visible tags.
- *
- * @return a AdvancementDisplay object, or null if not set.
+ * @return the display info
*/
- @Nullable
- AdvancementDisplay getDisplay();
+ */
+ @org.jetbrains.annotations.Nullable
+ io.papermc.paper.advancement.AdvancementDisplay getDisplay();
+
@ -209,10 +205,13 @@ index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..3f6b9e59c2ea38031ca74962e02d710f
+ * 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()
+ */
*/
- @Nullable
- AdvancementDisplay getDisplay();
+ @NotNull net.kyori.adventure.text.Component displayName();
+
+ /**

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.jav
index 869bad7405ec7fa67728e90d8b9f2e11b542611f..7ce8f1a26c1b33dd0eb6e6435952fd73abf49879 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java
@@ -11,16 +11,41 @@ import org.jetbrains.annotations.NotNull;
@@ -11,15 +11,40 @@ import org.jetbrains.annotations.NotNull;
public class EntityDamageByEntityEvent extends EntityDamageEvent {
private final Entity damager;
@ -32,8 +32,8 @@ index 869bad7405ec7fa67728e90d8b9f2e11b542611f..7ce8f1a26c1b33dd0eb6e6435952fd73
this.damager = damager;
+ // Paper start - add critical damage API
+ this.critical = critical;
}
+ }
+
+ /**
+ * Shows this damage instance was critical.
+ * The damage instance can be critical if the attacking player met the respective conditions.
@ -44,9 +44,8 @@ index 869bad7405ec7fa67728e90d8b9f2e11b542611f..7ce8f1a26c1b33dd0eb6e6435952fd73
+ */
+ public boolean isCritical() {
+ return this.critical;
+ }
}
+ // Paper end
+
/**
* Returns the entity that damaged the defender.
*

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java b/src/
index 67fb9d93e808e907fa980f3004d415ae5d0a53fc..97e36c7f6e09276fbae20eaeee0965566332ca46 100644
--- a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java
@@ -15,16 +15,59 @@ import org.jetbrains.annotations.Nullable;
@@ -15,15 +15,58 @@ import org.jetbrains.annotations.Nullable;
public class EntityPortalEvent extends EntityTeleportEvent {
private static final HandlerList handlers = new HandlerList();
private int searchRadius = 128;
@ -23,8 +23,8 @@ index 67fb9d93e808e907fa980f3004d415ae5d0a53fc..97e36c7f6e09276fbae20eaeee096556
super(entity, from, to);
this.searchRadius = searchRadius;
+ this.type = org.bukkit.PortalType.CUSTOM; // Paper
}
+ }
+
+ // Paper start
+ public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, final @NotNull org.bukkit.PortalType portalType) {
+ super(entity, from, to);
@ -63,12 +63,11 @@ index 67fb9d93e808e907fa980f3004d415ae5d0a53fc..97e36c7f6e09276fbae20eaeee096556
+ @Override
+ public void setTo(@Nullable final Location to) {
+ super.setTo(to);
+ }
}
+ // Paper end
+
/**
* Set the Block radius to search in for available portals.
*
diff --git a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java
index 57eeeafae84f83a939925820e827769749ff27ec..929a997671de8202efb9da97fbf9b4a0bf7c37e8 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java