From 9b7863a607ef0b5d883238729b8c2d34fa1512c6 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Sun, 1 Oct 2023 02:20:51 +0200 Subject: [PATCH] Some jd fixes (#9781) --- patches/api/Add-Material-Tags.patch | 4 +- patches/api/Add-getDrops-to-BlockState.patch | 2 +- patches/api/Adventure.patch | 3 +- .../api/Fix-Spigot-annotation-mistakes.patch | 13 ++++++ patches/api/Test-changes.patch | 41 +++---------------- ...ing-Trader-spawn-rate-config-options.patch | 2 +- ...on-t-call-getItemMeta-on-hasItemMeta.patch | 2 +- 7 files changed, 26 insertions(+), 41 deletions(-) diff --git a/patches/api/Add-Material-Tags.patch b/patches/api/Add-Material-Tags.patch index ca9d4592c5..bde111a898 100644 --- a/patches/api/Add-Material-Tags.patch +++ b/patches/api/Add-Material-Tags.patch @@ -1082,7 +1082,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + /** + * Covers undead mobs -+ * @see https://minecraft.gamepedia.com/Mob#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) @@ -1111,7 +1111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + /** + * Covers all water based mobs -+ * @see https://minecraft.gamepedia.com/Mob#Water-based_mobs ++ * @see https://minecraft.wiki/wiki/Mob#Aquatic_mobs + */ + 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) diff --git a/patches/api/Add-getDrops-to-BlockState.patch b/patches/api/Add-getDrops-to-BlockState.patch index 7e08b816a9..8543995b31 100644 --- a/patches/api/Add-getDrops-to-BlockState.patch +++ b/patches/api/Add-getDrops-to-BlockState.patch @@ -42,6 +42,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return an immutable list of dropped items for the block state + */ + @NotNull -+ java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops(@NotNull org.bukkit.inventory.ItemStack tool, @Nullable org.bukkit.entity.Entity entity); ++ 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/Adventure.patch b/patches/api/Adventure.patch index 3512bf3ca4..e745798d3b 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -1591,9 +1591,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * 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()}. ++ * @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(); + + /** diff --git a/patches/api/Fix-Spigot-annotation-mistakes.patch b/patches/api/Fix-Spigot-annotation-mistakes.patch index dd9be90aef..2a1ec058ea 100644 --- a/patches/api/Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/Fix-Spigot-annotation-mistakes.patch @@ -354,6 +354,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Spigot spigot(); // Spigot 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 @@ public interface Block extends Metadatable, Translatable { + * @return a list of dropped items for this type of block + */ + @NotNull +- Collection getDrops(@NotNull ItemStack tool, @Nullable Entity entity); ++ Collection getDrops(@Nullable ItemStack tool, @Nullable Entity entity); // Paper + + /** + * Returns if the given item is a preferred choice to break this Block. 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 diff --git a/patches/api/Test-changes.patch b/patches/api/Test-changes.patch index cfb9a2dd9f..4db5299e37 100644 --- a/patches/api/Test-changes.patch +++ b/patches/api/Test-changes.patch @@ -224,43 +224,14 @@ diff --git a/src/test/java/org/bukkit/BukkitMirrorTest.java b/src/test/java/org/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/test/java/org/bukkit/BukkitMirrorTest.java +++ b/src/test/java/org/bukkit/BukkitMirrorTest.java -@@ -0,0 +0,0 @@ public class BukkitMirrorTest { +@@ -0,0 +0,0 @@ import org.junit.jupiter.params.ParameterizedTest; + import org.junit.jupiter.params.provider.Arguments; + import org.junit.jupiter.params.provider.MethodSource; - @ParameterizedTest - @MethodSource("data") -+ @org.junit.jupiter.api.Disabled // Paper - public void isStatic(Method server, String name, Method bukkit) throws Throwable { - assertThat(Modifier.isStatic(bukkit.getModifiers()), is(true)); - } ++@org.junit.jupiter.api.Disabled // Paper + public class BukkitMirrorTest { - @ParameterizedTest - @MethodSource("data") -+ @org.junit.jupiter.api.Disabled // Paper - public void isDeprecated(Method server, String name, Method bukkit) throws Throwable { - assertThat(bukkit.isAnnotationPresent(Deprecated.class), is(server.isAnnotationPresent(Deprecated.class))); - } - - @ParameterizedTest - @MethodSource("data") -+ @org.junit.jupiter.api.Disabled // Paper - public void returnType(Method server, String name, Method bukkit) throws Throwable { - assertThat(bukkit.getReturnType(), is((Object) server.getReturnType())); - // assertThat(bukkit.getGenericReturnType(), is(server.getGenericReturnType())); // too strict on type generics -@@ -0,0 +0,0 @@ public class BukkitMirrorTest { - - @ParameterizedTest - @MethodSource("data") -+ @org.junit.jupiter.api.Disabled // Paper - public void parameterTypes(Method server, String name, Method bukkit) throws Throwable { - // assertThat(bukkit.getGenericParameterTypes(), is(server.getGenericParameterTypes())); // too strict on type generics - } - - @ParameterizedTest - @MethodSource("data") -+ @org.junit.jupiter.api.Disabled // Paper - public void declaredException(Method server, String name, Method bukkit) throws Throwable { - assertThat(bukkit.getGenericExceptionTypes(), is(server.getGenericExceptionTypes())); - } + public static Stream data() { 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 diff --git a/patches/server/Add-Wandering-Trader-spawn-rate-config-options.patch b/patches/server/Add-Wandering-Trader-spawn-rate-config-options.patch index c9e9e5632e..757e034fdb 100644 --- a/patches/server/Add-Wandering-Trader-spawn-rate-config-options.patch +++ b/patches/server/Add-Wandering-Trader-spawn-rate-config-options.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Wandering Trader spawn rate config options Adds config options for modifying the spawn rates of Wandering Traders. These values are all easy to understand and configure after a quick read of this -page on the Minecraft wiki: https://minecraft.gamepedia.com/Wandering_Trader#Spawning +page on the Minecraft wiki: https://minecraft.wiki/wiki/Wandering_Trader#Spawning Usages of the vanilla WanderingTraderSpawnDelay and WanderingTraderSpawnChance values in IWorldServerData are removed as they were only used in certain places, with hardcoded values used in other places. diff --git a/patches/server/Don-t-call-getItemMeta-on-hasItemMeta.patch b/patches/server/Don-t-call-getItemMeta-on-hasItemMeta.patch index 67932e8113..783b24003d 100644 --- a/patches/server/Don-t-call-getItemMeta-on-hasItemMeta.patch +++ b/patches/server/Don-t-call-getItemMeta-on-hasItemMeta.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't call getItemMeta on hasItemMeta Spigot 1.13 checks if any field (which are manually copied from the ItemStack's "tag" NBT tag) on the ItemMeta class of an ItemStack is set. -We could just check if the "tag" NBT tag is empty, albeit that would break some plugins. The only general tag added on 1.13 is "Damage", and we can just check if the "tag" NBT tag contains any other tag that's not "Damage" (https://minecraft.gamepedia.com/Player.dat_format#Item_structure) making the `hasItemStack` method behave as before. +We could just check if the "tag" NBT tag is empty, albeit that would break some plugins. The only general tag added on 1.13 is "Damage", and we can just check if the "tag" NBT tag contains any other tag that's not "Damage" (https://minecraft.wiki/wiki/Player.dat_format#Item_structure) making the `hasItemStack` method behave as before. Returns true if getDamage() == 0 or has damage tag or other tag is set. Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves.