From e4ecf6ce87f4f990bb29b86d243a81e8163c0553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Finn=20K=C3=BCnstner?= Date: Fri, 30 Jul 2021 01:04:26 +0200 Subject: [PATCH] [ci skip] Fix various compile warnings (#6264) --- .../AsyncPlayerSendCommandsEvent.java | 1 + .../brigadier/CommandRegisteredEvent.java | 1 + .../0015-Add-PlayerInitialSpawnEvent.patch | 5 +- ...0178-Fix-Spigot-annotation-mistakes.patch} | 58 ++++++++++++++++--- ...Add-Raw-Byte-ItemStack-Serialization.patch | 4 +- ...-translation-keys-for-blocks-entitie.patch | 4 +- patches/api/0284-Item-Rarity-API.patch | 4 +- .../api/0304-ItemStack-repair-check-API.patch | 4 +- patches/api/0309-ItemStack-editMeta.patch | 4 +- 9 files changed, 65 insertions(+), 20 deletions(-) rename patches/api/{0178-Flip-some-Spigot-API-null-annotations.patch => 0178-Fix-Spigot-annotation-mistakes.patch} (66%) diff --git a/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendCommandsEvent.java b/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendCommandsEvent.java index a275a85ad..6e507c7a5 100644 --- a/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendCommandsEvent.java +++ b/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendCommandsEvent.java @@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull; * If your logic is not safe to run asynchronously, only react to the synchronous version. * @deprecated Draft API - Subject to change until confirmed solves desired use cases */ +@Deprecated public class AsyncPlayerSendCommandsEvent extends PlayerEvent { private static final HandlerList handlers = new HandlerList(); diff --git a/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/CommandRegisteredEvent.java b/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/CommandRegisteredEvent.java index 92924622b..d676a18a6 100644 --- a/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/CommandRegisteredEvent.java +++ b/Paper-MojangAPI/src/main/java/com/destroystokyo/paper/event/brigadier/CommandRegisteredEvent.java @@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull; * * @deprecated Draft API - Subject to change until confirmed solves desired use cases */ +@Deprecated public class CommandRegisteredEvent extends ServerEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0015-Add-PlayerInitialSpawnEvent.patch b/patches/api/0015-Add-PlayerInitialSpawnEvent.patch index c113777bf..44ff48c32 100644 --- a/patches/api/0015-Add-PlayerInitialSpawnEvent.patch +++ b/patches/api/0015-Add-PlayerInitialSpawnEvent.patch @@ -7,10 +7,10 @@ For modifying a player's initial spawn location as they join the server diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..8b1fdb9d2869d4c1862d557c91bf8a1d8c537507 +index 0000000000000000000000000000000000000000..626e97bbcaa19d55475a0fc8770412d437af2733 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java -@@ -0,0 +1,16 @@ +@@ -0,0 +1,17 @@ +package com.destroystokyo.paper.event.player; + +import org.bukkit.Location; @@ -21,6 +21,7 @@ index 0000000000000000000000000000000000000000..8b1fdb9d2869d4c1862d557c91bf8a1d +/** + * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API + */ ++@Deprecated +public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent { + + public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) { diff --git a/patches/api/0178-Flip-some-Spigot-API-null-annotations.patch b/patches/api/0178-Fix-Spigot-annotation-mistakes.patch similarity index 66% rename from patches/api/0178-Flip-some-Spigot-API-null-annotations.patch rename to patches/api/0178-Fix-Spigot-annotation-mistakes.patch index c02e908ca..cf9a383ac 100644 --- a/patches/api/0178-Flip-some-Spigot-API-null-annotations.patch +++ b/patches/api/0178-Fix-Spigot-annotation-mistakes.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 18:39:01 -0400 -Subject: [PATCH] Flip some Spigot API null annotations +Subject: [PATCH] Fix Spigot annotation mistakes while some of these may of been true, they are extreme cases and cause a ton of noise to plugin developers. @@ -31,7 +31,7 @@ index 6aabf764231d29b0d9c83c0c40e1088c34d6f168..228a7874bc8c280c43971a89ba9cbb14 return server.getTag(registry, tag, clazz); } diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 88b3e0323dbc4f0fce31b147c7aaa08d65745852..1835d39f6259732e56d51fa746faf1e4c65eaf07 100644 +index 88b3e0323dbc4f0fce31b147c7aaa08d65745852..23ca89dde7f6ac9082d4b97fce2959425f3680cb 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java @@ -46,7 +46,7 @@ public class Location implements Cloneable, ConfigurationSerializable { @@ -48,7 +48,7 @@ index 88b3e0323dbc4f0fce31b147c7aaa08d65745852..1835d39f6259732e56d51fa746faf1e4 * @param pitch The absolute rotation on the y-plane, in degrees */ - public Location(@Nullable final World world, final double x, final double y, final double z, final float yaw, final float pitch) { -+ public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) { ++ public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) { // Paper if (world != null) { this.world = new WeakReference<>(world); } @@ -57,12 +57,12 @@ index 88b3e0323dbc4f0fce31b147c7aaa08d65745852..1835d39f6259732e56d51fa746faf1e4 * @see #isWorldLoaded() */ - @Nullable -+ @UndefinedNullability ++ @UndefinedNullability // Paper public World getWorld() { if (this.world == null) { return null; diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index f5f41fb37fd8dbdcffe47eefa939aecdad8210c0..a09513f74b3fb9790958f40a7ebef952f9e304f2 100644 +index f5f41fb37fd8dbdcffe47eefa939aecdad8210c0..878b1b196e9b0ba7f8688f6741dcce1f6bfe6cb3 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1242,7 +1242,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -79,10 +79,32 @@ index f5f41fb37fd8dbdcffe47eefa939aecdad8210c0..a09513f74b3fb9790958f40a7ebef952 * @return the tag or null */ - @Nullable -+ @UndefinedNullability ++ @UndefinedNullability // Paper Tag getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class clazz); /** +diff --git a/src/main/java/org/bukkit/entity/LingeringPotion.java b/src/main/java/org/bukkit/entity/LingeringPotion.java +index f124b35ec76e6cb6a1a0dc464005087043c3efd0..94a2fef0dc9e13c754cd31d5eabc1bde2dbbe6a5 100644 +--- a/src/main/java/org/bukkit/entity/LingeringPotion.java ++++ b/src/main/java/org/bukkit/entity/LingeringPotion.java +@@ -5,4 +5,5 @@ package org.bukkit.entity; + * + * @deprecated lingering status depends on only on the potion item. + */ ++@Deprecated // Paper + public interface LingeringPotion extends ThrownPotion { } +diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java +index 2ff1b1308571d8f8056d3359e8a8ba4a589c3726..e669ad8ecd182c6899c7820414e6ee1f7312d699 100644 +--- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java ++++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java +@@ -68,6 +68,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab + * @return experience level costs offered + * @deprecated Use {@link #getOffers()} instead of this method + */ ++ @Deprecated // Paper + @NotNull + public int[] getExpLevelCostsOffered() { + int[] levelOffers = new int[offers.length]; diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java index 71e5ee496a947fbd8e3ec579833b157c76b51833..d773e8594f91017bddd7ea8aada3a1ff2781d05b 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -105,7 +127,7 @@ index 71e5ee496a947fbd8e3ec579833b157c76b51833..d773e8594f91017bddd7ea8aada3a1ff /** diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 686e2a0b9fe061816b41435ef2337870dbdca8e5..290c3f0fd6e8c3407d421b697e0ee01584f4cebd 100644 +index 686e2a0b9fe061816b41435ef2337870dbdca8e5..aacf8ea85909299355d16cad0386072ec542a70e 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -8,6 +8,7 @@ import java.util.Set; // Paper @@ -116,7 +138,15 @@ index 686e2a0b9fe061816b41435ef2337870dbdca8e5..290c3f0fd6e8c3407d421b697e0ee015 import org.bukkit.Utility; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.enchantments.Enchantment; -@@ -546,7 +547,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -68,6 +69,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor + * @param damage durability / damage + * @deprecated see {@link #setDurability(short)} + */ ++ @Deprecated // Paper + public ItemStack(@NotNull final Material type, final int amount, final short damage) { + this(type, amount, damage, null); + } +@@ -546,7 +548,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor * * @return a copy of the current ItemStack's ItemData */ @@ -125,3 +155,15 @@ index 686e2a0b9fe061816b41435ef2337870dbdca8e5..290c3f0fd6e8c3407d421b697e0ee015 public ItemMeta getItemMeta() { return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone(); } +diff --git a/src/main/java/org/bukkit/material/Step.java b/src/main/java/org/bukkit/material/Step.java +index 9f502e7ee05d0512e190a1722cc112ece068c4e2..10c0465cf58d680bfa9a0f9233f94e8b6d5a9b93 100644 +--- a/src/main/java/org/bukkit/material/Step.java ++++ b/src/main/java/org/bukkit/material/Step.java +@@ -78,6 +78,7 @@ public class Step extends TexturedMaterial { + * + * @deprecated Magic value + */ ++ @Deprecated // Paper + @Override + protected int getTextureIndex() { + return getData() & 0x7; diff --git a/patches/api/0195-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/api/0195-Add-Raw-Byte-ItemStack-Serialization.patch index e88adb86e..9508269c7 100644 --- a/patches/api/0195-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/api/0195-Add-Raw-Byte-ItemStack-Serialization.patch @@ -20,10 +20,10 @@ index d6897f43a0692e031bed8a212d9a637ef548cc60..e348034288c74ab80360086d71f0b7f6 // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 290c3f0fd6e8c3407d421b697e0ee01584f4cebd..9a878e4fde31c015e2f3fdf365d5d16c30198685 100644 +index 1da4ccef66e42fafd5ae975780c6f521137868be..93ab6407ff09fa5e90e2d8e92fd43a4f95d9a6fa 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -628,6 +628,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -629,6 +629,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor return Bukkit.getServer().getItemFactory().ensureServerConversions(this); } diff --git a/patches/api/0225-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch b/patches/api/0225-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch index d9c9d2143..c9c652738 100644 --- a/patches/api/0225-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch +++ b/patches/api/0225-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch @@ -104,10 +104,10 @@ index 9be5371c7f398d0ec8241403661415ff40661067..f415b61b0d4b57e1557aaf240a0f2ad5 + } } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 9a878e4fde31c015e2f3fdf365d5d16c30198685..bd96c06aca1fc18807e65c34f399ce2ebe891816 100644 +index 93ab6407ff09fa5e90e2d8e92fd43a4f95d9a6fa..d11ebe61560e652fe96b3b0c7ab9174788ff83cb 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -851,5 +851,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -852,5 +852,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor ItemMeta itemMeta = getItemMeta(); return itemMeta != null && itemMeta.hasItemFlag(flag); } diff --git a/patches/api/0284-Item-Rarity-API.patch b/patches/api/0284-Item-Rarity-API.patch index 4a4197238..0eba86371 100644 --- a/patches/api/0284-Item-Rarity-API.patch +++ b/patches/api/0284-Item-Rarity-API.patch @@ -88,10 +88,10 @@ index 84eda68281c6c6968d95b1313a33696c3a9980d4..bcd10b2c9255d778b678310febf19373 // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index bd96c06aca1fc18807e65c34f399ce2ebe891816..f72d3d62d61755bbaf1950ebcb228ce95d1faf58 100644 +index d11ebe61560e652fe96b3b0c7ab9174788ff83cb..e8f4543131d293beaa1fe9b44e2e98f27bc5dc79 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -863,5 +863,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -864,5 +864,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor public String getTranslationKey() { return Bukkit.getUnsafe().getTranslationKey(this); } diff --git a/patches/api/0304-ItemStack-repair-check-API.patch b/patches/api/0304-ItemStack-repair-check-API.patch index d90207b8e..ac9f88171 100644 --- a/patches/api/0304-ItemStack-repair-check-API.patch +++ b/patches/api/0304-ItemStack-repair-check-API.patch @@ -26,10 +26,10 @@ index 6dbd520182b1e7713a68baad09b7f613424ef619..e504567cf755557be8511f2c93c17157 * Returns the server's protocol version. * diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index f72d3d62d61755bbaf1950ebcb228ce95d1faf58..1bd9f7582bb907ff178fd110fdc92834885d1d78 100644 +index e8f4543131d293beaa1fe9b44e2e98f27bc5dc79..b4d55e0d5e605cb6980b555acd42d16e1e65c196 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -873,5 +873,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -874,5 +874,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor public io.papermc.paper.inventory.ItemRarity getRarity() { return Bukkit.getUnsafe().getItemStackRarity(this); } diff --git a/patches/api/0309-ItemStack-editMeta.patch b/patches/api/0309-ItemStack-editMeta.patch index d9b90f5c3..6b66f2569 100644 --- a/patches/api/0309-ItemStack-editMeta.patch +++ b/patches/api/0309-ItemStack-editMeta.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack#editMeta diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 1bd9f7582bb907ff178fd110fdc92834885d1d78..a7909406e9d54c1ab4789b984ed6b1da50837fce 100644 +index b4d55e0d5e605cb6980b555acd42d16e1e65c196..f3fa8f7f021464aa9d463c14550487cc7d48c873 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -542,6 +542,31 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -543,6 +543,31 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor return result.ensureServerConversions(); // Paper }