From bf8f91cf09f757d8962aebe8d1ca5cd649d80ab3 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 + patches/api/Add-PlayerInitialSpawnEvent.patch | 1 + ...h => Fix-Spigot-annotation-mistakes.patch} | 50 +++++++++++++++++-- 4 files changed, 49 insertions(+), 4 deletions(-) rename patches/api/{Flip-some-Spigot-API-null-annotations.patch => Fix-Spigot-annotation-mistakes.patch} (70%) 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 a275a85ad2..6e507c7a51 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 92924622b5..d676a18a66 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/Add-PlayerInitialSpawnEvent.patch b/patches/api/Add-PlayerInitialSpawnEvent.patch index fc94033c49..6ccdf4a171 100644 --- a/patches/api/Add-PlayerInitialSpawnEvent.patch +++ b/patches/api/Add-PlayerInitialSpawnEvent.patch @@ -21,6 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +/** + * @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/Flip-some-Spigot-API-null-annotations.patch b/patches/api/Fix-Spigot-annotation-mistakes.patch similarity index 70% rename from patches/api/Flip-some-Spigot-API-null-annotations.patch rename to patches/api/Fix-Spigot-annotation-mistakes.patch index 754ac70886..10ee93361a 100644 --- a/patches/api/Flip-some-Spigot-API-null-annotations.patch +++ b/patches/api/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. @@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * @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,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * @see #isWorldLoaded() */ - @Nullable -+ @UndefinedNullability ++ @UndefinedNullability // Paper public World getWorld() { if (this.world == null) { return null; @@ -79,10 +79,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/LingeringPotion.java ++++ b/src/main/java/org/bukkit/entity/LingeringPotion.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java ++++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -116,6 +138,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.Utility; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.enchantments.Enchantment; +@@ -0,0 +0,0 @@ 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); + } @@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor * * @return a copy of the current ItemStack's ItemData @@ -125,3 +155,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/material/Step.java ++++ b/src/main/java/org/bukkit/material/Step.java +@@ -0,0 +0,0 @@ public class Step extends TexturedMaterial { + * + * @deprecated Magic value + */ ++ @Deprecated // Paper + @Override + protected int getTextureIndex() { + return getData() & 0x7;