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

This commit is contained in:
Finn Künstner 2021-07-30 01:04:26 +02:00
parent 23470be165
commit bf8f91cf09
4 changed files with 49 additions and 4 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

@ -21,6 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+/** +/**
+ * @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.
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @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,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @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;
@ -79,10 +79,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* @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 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 diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java --- a/src/main/java/org/bukkit/inventory/ItemFactory.java
@ -116,6 +138,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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;
@@ -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 @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 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;