[ci skip] rebuild patches

This commit is contained in:
Jake Potrebic
2023-03-23 14:57:03 -07:00
parent 39255145b6
commit 0adc18baf8
60 changed files with 1113 additions and 1197 deletions

View File

@@ -18,21 +18,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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

@@ -32,8 +32,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ public boolean isCritical() {
+ return this.critical;
+ }
}
+ // Paper end
+
/**
* Returns the entity that damaged the defender.
*

View File

@@ -194,12 +194,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * 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();
+
+ /**

File diff suppressed because it is too large Load Diff

View File

@@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ public boolean isFastRegen() {
+ return isFastRegen;
+ }
}
+ // Paper end
+
/**
* Gets the amount of regained health
*

View File

@@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void setConsumeArrow(boolean consumeArrow) {
+ this.setConsumeItem(consumeArrow);
+ }
+
+ @Deprecated
+ public boolean getConsumeArrow() {
+ return this.shouldConsumeItem();
@@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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

@@ -110,14 +110,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @NotNull
+ public static WorldCreator ofKey(@NotNull NamespacedKey worldKey) {
+ return new WorldCreator(worldKey);
+ }
}
+ // Paper end
+
/**
* Copies the options from the specified world
*

View File

@@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java

View File

@@ -16,6 +16,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * 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.
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @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.
@@ -0,0 +0,0 @@ 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

@@ -2194,7 +2194,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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

@@ -288,12 +288,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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;

View File

@@ -3400,12 +3400,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
- printStream.println("# Entities " + entities);
- printStream.println("# LivingEntities " + livingEntities);
+ handler = timing;
}
- }
-
- /**
- * Resets all timings.
- */
@@ -3668,9 +3657,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
- 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
- }
- }
-
+ Timing timing;
- /**
- * Starts timing to track a section of code.
- */
@@ -3697,9 +3685,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
- }
- }
-
+ public void startTiming() { handler.startTiming(); }
+ public void stopTiming() { handler.stopTiming(); }
- /**
- * Reset this timer, setting all values to zero.
- */