[ci skip] Fix various compile warnings (#6264)

This commit is contained in:
Finn Künstner 2021-07-30 01:04:26 +02:00 committed by GitHub
parent a67959e131
commit e4ecf6ce87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 20 deletions

View File

@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
* If your logic is not safe to run asynchronously, only react to the synchronous version. * 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 Draft API - Subject to change until confirmed solves desired use cases
*/ */
@Deprecated
public class AsyncPlayerSendCommandsEvent <S extends BukkitBrigadierCommandSource> extends PlayerEvent { public class AsyncPlayerSendCommandsEvent <S extends BukkitBrigadierCommandSource> extends PlayerEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();

View File

@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
* *
* @deprecated Draft API - Subject to change until confirmed solves desired use cases * @deprecated Draft API - Subject to change until confirmed solves desired use cases
*/ */
@Deprecated
public class CommandRegisteredEvent <S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable { public class CommandRegisteredEvent <S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();

View File

@ -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 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 new file mode 100644
index 0000000000000000000000000000000000000000..8b1fdb9d2869d4c1862d557c91bf8a1d8c537507 index 0000000000000000000000000000000000000000..626e97bbcaa19d55475a0fc8770412d437af2733
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java +++ 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; +package com.destroystokyo.paper.event.player;
+ +
+import org.bukkit.Location; +import org.bukkit.Location;
@ -21,6 +21,7 @@ index 0000000000000000000000000000000000000000..8b1fdb9d2869d4c1862d557c91bf8a1d
+/** +/**
+ * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API + * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API
+ */ + */
+@Deprecated
+public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent { +public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent {
+ +
+ public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) { + public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) {

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 24 Mar 2019 18:39:01 -0400 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 while some of these may of been true, they are extreme cases and cause
a ton of noise to plugin developers. a ton of noise to plugin developers.
@ -31,7 +31,7 @@ index 6aabf764231d29b0d9c83c0c40e1088c34d6f168..228a7874bc8c280c43971a89ba9cbb14
return server.getTag(registry, tag, clazz); return server.getTag(registry, tag, clazz);
} }
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java 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 --- a/src/main/java/org/bukkit/Location.java
+++ b/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 { @@ -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 * @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(@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) { if (world != null) {
this.world = new WeakReference<>(world); this.world = new WeakReference<>(world);
} }
@ -57,12 +57,12 @@ index 88b3e0323dbc4f0fce31b147c7aaa08d65745852..1835d39f6259732e56d51fa746faf1e4
* @see #isWorldLoaded() * @see #isWorldLoaded()
*/ */
- @Nullable - @Nullable
+ @UndefinedNullability + @UndefinedNullability // Paper
public World getWorld() { public World getWorld() {
if (this.world == null) { if (this.world == null) {
return null; return null;
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java 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 --- a/src/main/java/org/bukkit/Server.java
+++ b/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 @@ -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 * @return the tag or null
*/ */
- @Nullable - @Nullable
+ @UndefinedNullability + @UndefinedNullability // Paper
<T extends Keyed> Tag<T> getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class<T> clazz); <T extends Keyed> Tag<T> getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class<T> 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 diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 71e5ee496a947fbd8e3ec579833b157c76b51833..d773e8594f91017bddd7ea8aada3a1ff2781d05b 100644 index 71e5ee496a947fbd8e3ec579833b157c76b51833..d773e8594f91017bddd7ea8aada3a1ff2781d05b 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java --- 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 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 --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/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 @@ -8,6 +8,7 @@ import java.util.Set; // Paper
@ -116,7 +138,15 @@ index 686e2a0b9fe061816b41435ef2337870dbdca8e5..290c3f0fd6e8c3407d421b697e0ee015
import org.bukkit.Utility; import org.bukkit.Utility;
import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.enchantments.Enchantment; 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 * @return a copy of the current ItemStack's ItemData
*/ */
@ -125,3 +155,15 @@ index 686e2a0b9fe061816b41435ef2337870dbdca8e5..290c3f0fd6e8c3407d421b697e0ee015
public ItemMeta getItemMeta() { public ItemMeta getItemMeta() {
return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone(); 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;

View File

@ -20,10 +20,10 @@ index d6897f43a0692e031bed8a212d9a637ef548cc60..e348034288c74ab80360086d71f0b7f6
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java 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 --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/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); return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
} }

View File

@ -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 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 --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/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(); ItemMeta itemMeta = getItemMeta();
return itemMeta != null && itemMeta.hasItemFlag(flag); return itemMeta != null && itemMeta.hasItemFlag(flag);
} }

View File

@ -88,10 +88,10 @@ index 84eda68281c6c6968d95b1313a33696c3a9980d4..bcd10b2c9255d778b678310febf19373
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java 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 --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/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() { public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this); return Bukkit.getUnsafe().getTranslationKey(this);
} }

View File

@ -26,10 +26,10 @@ index 6dbd520182b1e7713a68baad09b7f613424ef619..e504567cf755557be8511f2c93c17157
* Returns the server's protocol version. * 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 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 --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/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() { public io.papermc.paper.inventory.ItemRarity getRarity() {
return Bukkit.getUnsafe().getItemStackRarity(this); return Bukkit.getUnsafe().getItemStackRarity(this);
} }

View File

@ -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 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 --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/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 return result.ensureServerConversions(); // Paper
} }