Switch to jspecify annotations for Player (#12042)

Fixes compilation issues for plugins from recent API addition with double-annotated parameter (JetBrains annotations are type-use and parameter, so nonnull array of nonnull elements ends up with duplicates)
This commit is contained in:
Jason Penilla
2025-02-08 12:57:35 -07:00
committed by GitHub
parent 51acc802b8
commit 61312fdb59
3 changed files with 215 additions and 256 deletions

View File

@@ -11,14 +11,15 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.permissions.ServerOperator; import org.bukkit.permissions.ServerOperator;
import org.bukkit.profile.PlayerProfile; import org.bukkit.profile.PlayerProfile;
import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.NullMarked;
import org.jetbrains.annotations.Nullable; import org.jspecify.annotations.Nullable;
/** /**
* Represents a reference to a player identity and the data belonging to a * Represents a reference to a player identity and the data belonging to a
* player that is stored on the disk and can, thus, be retrieved without the * player that is stored on the disk and can, thus, be retrieved without the
* player needing to be online. * player needing to be online.
*/ */
@NullMarked
public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, io.papermc.paper.persistence.PersistentDataViewHolder { // Paper - Add Offline PDC API public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, io.papermc.paper.persistence.PersistentDataViewHolder { // Paper - Add Offline PDC API
/** /**
@@ -62,7 +63,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @return Player UUID * @return Player UUID
*/ */
@Override @Override
@NotNull
public UUID getUniqueId(); public UUID getUniqueId();
/** /**
@@ -74,7 +74,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* *
* @return the player's profile * @return the player's profile
*/ */
@NotNull
com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile(); // Paper com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile(); // Paper
/** /**
@@ -91,7 +90,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @return Ban Entry * @return Ban Entry
* @deprecated use {@link #ban(String, Date, String)} * @deprecated use {@link #ban(String, Date, String)}
*/ */
@NotNull
@Deprecated(since = "1.20.4") @Deprecated(since = "1.20.4")
public default BanEntry banPlayer(@Nullable String reason) { public default BanEntry banPlayer(@Nullable String reason) {
return banPlayer(reason, null, null); return banPlayer(reason, null, null);
@@ -104,7 +102,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @return Ban Entry * @return Ban Entry
* @deprecated use {@link #ban(String, Date, String)} * @deprecated use {@link #ban(String, Date, String)}
*/ */
@NotNull
@Deprecated(since = "1.20.4") @Deprecated(since = "1.20.4")
public default BanEntry banPlayer(@Nullable String reason, @Nullable String source) { public default BanEntry banPlayer(@Nullable String reason, @Nullable String source) {
return banPlayer(reason, null, source); return banPlayer(reason, null, source);
@@ -117,9 +114,8 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @return Ban Entry * @return Ban Entry
* @deprecated use {@link #ban(String, Date, String)} * @deprecated use {@link #ban(String, Date, String)}
*/ */
@NotNull
@Deprecated(since = "1.20.4") @Deprecated(since = "1.20.4")
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires) { public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires) {
return banPlayer(reason, expires, null); return banPlayer(reason, expires, null);
} }
@@ -131,18 +127,16 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @return Ban Entry * @return Ban Entry
* @deprecated use {@link #ban(String, Date, String)} * @deprecated use {@link #ban(String, Date, String)}
*/ */
@NotNull
@Deprecated(since = "1.20.4") @Deprecated(since = "1.20.4")
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) { public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires, @Nullable String source) {
return banPlayer(reason, expires, source, true); return banPlayer(reason, expires, source, true);
} }
/** /**
* @deprecated use {@link #ban(String, Date, String)} * @deprecated use {@link #ban(String, Date, String)}
*/ */
@NotNull
@Deprecated(since = "1.20.4") @Deprecated(since = "1.20.4")
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickIfOnline) { public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires, @Nullable String source, boolean kickIfOnline) {
BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.NAME).addBan(getName(), reason, expires, source); BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.NAME).addBan(getName(), reason, expires, source);
if (kickIfOnline && isOnline()) { if (kickIfOnline && isOnline()) {
getPlayer().kickPlayer(reason); getPlayer().kickPlayer(reason);
@@ -309,7 +303,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the statistic requires an * @throws IllegalArgumentException if the statistic requires an
* additional parameter * additional parameter
*/ */
public void incrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; public void incrementStatistic(Statistic statistic) throws IllegalArgumentException;
/** /**
* Decrements the given statistic for this player. * Decrements the given statistic for this player.
@@ -322,7 +316,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the statistic requires an * @throws IllegalArgumentException if the statistic requires an
* additional parameter * additional parameter
*/ */
public void decrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; public void decrementStatistic(Statistic statistic) throws IllegalArgumentException;
/** /**
* Increments the given statistic for this player. * Increments the given statistic for this player.
@@ -334,7 +328,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the statistic requires an * @throws IllegalArgumentException if the statistic requires an
* additional parameter * additional parameter
*/ */
public void incrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException; public void incrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException;
/** /**
* Decrements the given statistic for this player. * Decrements the given statistic for this player.
@@ -346,7 +340,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the statistic requires an * @throws IllegalArgumentException if the statistic requires an
* additional parameter * additional parameter
*/ */
public void decrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException; public void decrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException;
/** /**
* Sets the given statistic for this player. * Sets the given statistic for this player.
@@ -358,7 +352,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the statistic requires an * @throws IllegalArgumentException if the statistic requires an
* additional parameter * additional parameter
*/ */
public void setStatistic(@NotNull Statistic statistic, int newValue) throws IllegalArgumentException; public void setStatistic(Statistic statistic, int newValue) throws IllegalArgumentException;
/** /**
* Gets the value of the given statistic for this player. * Gets the value of the given statistic for this player.
@@ -369,7 +363,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the statistic requires an * @throws IllegalArgumentException if the statistic requires an
* additional parameter * additional parameter
*/ */
public int getStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; public int getStatistic(Statistic statistic) throws IllegalArgumentException;
/** /**
* Increments the given statistic for this player for the given material. * Increments the given statistic for this player for the given material.
@@ -384,7 +378,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; public void incrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
/** /**
* Decrements the given statistic for this player for the given material. * Decrements the given statistic for this player for the given material.
@@ -399,7 +393,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; public void decrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
/** /**
* Gets the value of the given statistic for this player. * Gets the value of the given statistic for this player.
@@ -412,7 +406,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public int getStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; public int getStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
/** /**
* Increments the given statistic for this player for the given material. * Increments the given statistic for this player for the given material.
@@ -426,7 +420,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException; public void incrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException;
/** /**
* Decrements the given statistic for this player for the given material. * Decrements the given statistic for this player for the given material.
@@ -440,7 +434,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException; public void decrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException;
/** /**
* Sets the given statistic for this player for the given material. * Sets the given statistic for this player for the given material.
@@ -454,7 +448,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue) throws IllegalArgumentException; public void setStatistic(Statistic statistic, Material material, int newValue) throws IllegalArgumentException;
/** /**
* Increments the given statistic for this player for the given entity. * Increments the given statistic for this player for the given entity.
@@ -469,7 +463,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; public void incrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
/** /**
* Decrements the given statistic for this player for the given entity. * Decrements the given statistic for this player for the given entity.
@@ -484,7 +478,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; public void decrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
/** /**
* Gets the value of the given statistic for this player. * Gets the value of the given statistic for this player.
@@ -497,7 +491,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public int getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; public int getStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
/** /**
* Increments the given statistic for this player for the given entity. * Increments the given statistic for this player for the given entity.
@@ -511,7 +505,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount) throws IllegalArgumentException; public void incrementStatistic(Statistic statistic, EntityType entityType, int amount) throws IllegalArgumentException;
/** /**
* Decrements the given statistic for this player for the given entity. * Decrements the given statistic for this player for the given entity.
@@ -525,7 +519,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount); public void decrementStatistic(Statistic statistic, EntityType entityType, int amount);
/** /**
* Sets the given statistic for this player for the given entity. * Sets the given statistic for this player for the given entity.
@@ -539,7 +533,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @throws IllegalArgumentException if the given parameter is not valid * @throws IllegalArgumentException if the given parameter is not valid
* for the statistic * for the statistic
*/ */
public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue); public void setStatistic(Statistic statistic, EntityType entityType, int newValue);
/** /**
* Gets the player's last death location. * Gets the player's last death location.
@@ -571,6 +565,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* @see io.papermc.paper.persistence.PersistentDataViewHolder#getPersistentDataContainer() * @see io.papermc.paper.persistence.PersistentDataViewHolder#getPersistentDataContainer()
*/ */
@Override @Override
io.papermc.paper.persistence.@NotNull PersistentDataContainerView getPersistentDataContainer(); io.papermc.paper.persistence.PersistentDataContainerView getPersistentDataContainer();
// Paper end - add pdc to offline player // Paper end - add pdc to offline player
} }

View File

@@ -18,17 +18,18 @@ import org.bukkit.inventory.Merchant;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.NullMarked;
import org.jetbrains.annotations.Nullable; import org.jspecify.annotations.Nullable;
/** /**
* Represents a human entity, such as an NPC or a player * Represents a human entity, such as an NPC or a player
*/ */
@NullMarked
public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder { public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder {
// Paper start // Paper start
@Override @Override
org.bukkit.inventory.@NotNull EntityEquipment getEquipment(); org.bukkit.inventory.EntityEquipment getEquipment();
// Paper end // Paper end
/** /**
@@ -36,7 +37,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @return Player name * @return Player name
*/ */
@NotNull
@Override @Override
public String getName(); public String getName();
@@ -46,7 +46,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return The inventory of the player, this also contains the armor * @return The inventory of the player, this also contains the armor
* slots. * slots.
*/ */
@NotNull
@Override @Override
public PlayerInventory getInventory(); public PlayerInventory getInventory();
@@ -55,7 +54,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @return The EnderChest of the player * @return The EnderChest of the player
*/ */
@NotNull
public Inventory getEnderChest(); public Inventory getEnderChest();
/** /**
@@ -63,7 +61,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @return the players main hand * @return the players main hand
*/ */
@NotNull
public MainHand getMainHand(); public MainHand getMainHand();
/** /**
@@ -76,7 +73,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @deprecated use {@link InventoryView} and its children. * @deprecated use {@link InventoryView} and its children.
*/ */
@Deprecated(forRemoval = true, since = "1.21") @Deprecated(forRemoval = true, since = "1.21")
public boolean setWindowProperty(@NotNull InventoryView.Property prop, int value); public boolean setWindowProperty(InventoryView.Property prop, int value);
/** /**
* Gets the player's current enchantment seed. * Gets the player's current enchantment seed.
@@ -104,7 +101,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @return The inventory view. * @return The inventory view.
*/ */
@NotNull
public InventoryView getOpenInventory(); public InventoryView getOpenInventory();
/** /**
@@ -115,7 +111,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return The newly opened inventory view * @return The newly opened inventory view
*/ */
@Nullable @Nullable
public InventoryView openInventory(@NotNull Inventory inventory); public InventoryView openInventory(Inventory inventory);
/** /**
* Opens an empty workbench inventory window with the player's inventory * Opens an empty workbench inventory window with the player's inventory
@@ -162,7 +158,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @param inventory The view to open * @param inventory The view to open
*/ */
public void openInventory(@NotNull InventoryView inventory); public void openInventory(InventoryView inventory);
/** /**
* Starts a trade between the player and the villager. * Starts a trade between the player and the villager.
@@ -178,7 +174,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/ */
@Deprecated(since = "1.21.4") @Deprecated(since = "1.21.4")
@Nullable @Nullable
public InventoryView openMerchant(@NotNull Villager trader, boolean force); public InventoryView openMerchant(Villager trader, boolean force);
/** /**
* Starts a trade between the player and the merchant. * Starts a trade between the player and the merchant.
@@ -194,7 +190,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/ */
@Deprecated(since = "1.21.4") @Deprecated(since = "1.21.4")
@Nullable @Nullable
public InventoryView openMerchant(@NotNull Merchant merchant, boolean force); public InventoryView openMerchant(Merchant merchant, boolean force);
// Paper start - Add additional containers // Paper start - Add additional containers
/** /**
@@ -311,7 +307,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @param reason why the inventory is closing * @param reason why the inventory is closing
*/ */
public void closeInventory(@NotNull org.bukkit.event.inventory.InventoryCloseEvent.Reason reason); public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason);
// Paper end // Paper end
/** /**
@@ -322,7 +318,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* methods in {@link PlayerInventory}. * methods in {@link PlayerInventory}.
*/ */
@Deprecated(since = "1.9") @Deprecated(since = "1.9")
@NotNull
public ItemStack getItemInHand(); public ItemStack getItemInHand();
/** /**
@@ -342,7 +337,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @return The ItemStack of the item you are currently moving around. * @return The ItemStack of the item you are currently moving around.
*/ */
@NotNull
public ItemStack getItemOnCursor(); public ItemStack getItemOnCursor();
/** /**
@@ -361,7 +355,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return if a cooldown is active on the material * @return if a cooldown is active on the material
* @throws IllegalArgumentException if the material is not an item * @throws IllegalArgumentException if the material is not an item
*/ */
public boolean hasCooldown(@NotNull Material material); public boolean hasCooldown(Material material);
/** /**
* Get the cooldown time in ticks remaining for the specified material. * Get the cooldown time in ticks remaining for the specified material.
@@ -370,7 +364,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return the remaining cooldown time in ticks * @return the remaining cooldown time in ticks
* @throws IllegalArgumentException if the material is not an item * @throws IllegalArgumentException if the material is not an item
*/ */
public int getCooldown(@NotNull Material material); public int getCooldown(Material material);
/** /**
* Set a cooldown on the specified material for a certain amount of ticks. * Set a cooldown on the specified material for a certain amount of ticks.
@@ -386,7 +380,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @param ticks the amount of ticks to set or 0 to remove * @param ticks the amount of ticks to set or 0 to remove
* @throws IllegalArgumentException if the material is not an item * @throws IllegalArgumentException if the material is not an item
*/ */
public void setCooldown(@NotNull Material material, int ticks); public void setCooldown(Material material, int ticks);
// Paper start // Paper start
/** /**
@@ -413,7 +407,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @param item the item to check * @param item the item to check
* @return if a cooldown is active on the item * @return if a cooldown is active on the item
*/ */
public boolean hasCooldown(@NotNull ItemStack item); public boolean hasCooldown(ItemStack item);
/** /**
* Get the cooldown time in ticks remaining for the specified item. * Get the cooldown time in ticks remaining for the specified item.
@@ -421,7 +415,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @param item the item to check * @param item the item to check
* @return the remaining cooldown time in ticks * @return the remaining cooldown time in ticks
*/ */
public int getCooldown(@NotNull ItemStack item); public int getCooldown(ItemStack item);
/** /**
* Set a cooldown on the specified item for a certain amount of ticks. * Set a cooldown on the specified item for a certain amount of ticks.
@@ -436,7 +430,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @param item the item to set the cooldown for * @param item the item to set the cooldown for
* @param ticks the amount of ticks to set or 0 to remove * @param ticks the amount of ticks to set or 0 to remove
*/ */
public void setCooldown(@NotNull ItemStack item, int ticks); public void setCooldown(ItemStack item, int ticks);
/** /**
* Get the sleep ticks of the player. This value may be capped. * Get the sleep ticks of the player. This value may be capped.
@@ -493,7 +487,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* normally possible * normally possible
* @return whether the sleep was successful * @return whether the sleep was successful
*/ */
public boolean sleep(@NotNull Location location, boolean force); public boolean sleep(Location location, boolean force);
/** /**
* Causes the player to wakeup if they are currently sleeping. * Causes the player to wakeup if they are currently sleeping.
@@ -519,7 +513,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return location * @return location
* @throws IllegalStateException if not sleeping * @throws IllegalStateException if not sleeping
*/ */
@NotNull
public Location getBedLocation(); public Location getBedLocation();
/** /**
@@ -527,7 +520,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @return Current game mode * @return Current game mode
*/ */
@NotNull
public GameMode getGameMode(); public GameMode getGameMode();
/** /**
@@ -535,7 +527,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @param mode New game mode * @param mode New game mode
*/ */
public void setGameMode(@NotNull GameMode mode); public void setGameMode(GameMode mode);
/** /**
* Check if the player is currently blocking (ie with a shield). * Check if the player is currently blocking (ie with a shield).
@@ -600,7 +592,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @return whether or not the recipe was newly discovered * @return whether or not the recipe was newly discovered
*/ */
public boolean discoverRecipe(@NotNull NamespacedKey recipe); public boolean discoverRecipe(NamespacedKey recipe);
/** /**
* Discover a collection of recipes for this player such that they have not * Discover a collection of recipes for this player such that they have not
@@ -614,7 +606,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* none were newly discovered and a number equal to {@code recipes.size()} * none were newly discovered and a number equal to {@code recipes.size()}
* indicates that all were new * indicates that all were new
*/ */
public int discoverRecipes(@NotNull Collection<NamespacedKey> recipes); public int discoverRecipes(Collection<NamespacedKey> recipes);
/** /**
* Undiscover a recipe for this player such that it has already been * Undiscover a recipe for this player such that it has already been
@@ -626,7 +618,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return whether or not the recipe was successfully undiscovered (i.e. it * @return whether or not the recipe was successfully undiscovered (i.e. it
* was previously discovered) * was previously discovered)
*/ */
public boolean undiscoverRecipe(@NotNull NamespacedKey recipe); public boolean undiscoverRecipe(NamespacedKey recipe);
/** /**
* Undiscover a collection of recipes for this player such that they have * Undiscover a collection of recipes for this player such that they have
@@ -640,7 +632,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* were undiscovered and a number equal to {@code recipes.size()} indicates * were undiscovered and a number equal to {@code recipes.size()} indicates
* that all were undiscovered * that all were undiscovered
*/ */
public int undiscoverRecipes(@NotNull Collection<NamespacedKey> recipes); public int undiscoverRecipes(Collection<NamespacedKey> recipes);
/** /**
* Check whether or not this entity has discovered the specified recipe. * Check whether or not this entity has discovered the specified recipe.
@@ -649,14 +641,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* *
* @return true if discovered, false otherwise * @return true if discovered, false otherwise
*/ */
public boolean hasDiscoveredRecipe(@NotNull NamespacedKey recipe); public boolean hasDiscoveredRecipe(NamespacedKey recipe);
/** /**
* Get an immutable set of recipes this entity has discovered. * Get an immutable set of recipes this entity has discovered.
* *
* @return all discovered recipes * @return all discovered recipes
*/ */
@NotNull
public Set<NamespacedKey> getDiscoveredRecipes(); public Set<NamespacedKey> getDiscoveredRecipes();
/** /**
@@ -730,7 +721,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @deprecated use {@link #openSign(org.bukkit.block.Sign, org.bukkit.block.sign.Side)} * @deprecated use {@link #openSign(org.bukkit.block.Sign, org.bukkit.block.sign.Side)}
*/ */
@Deprecated @Deprecated
default void openSign(@NotNull org.bukkit.block.Sign sign) { default void openSign(org.bukkit.block.Sign sign) {
this.openSign(sign, org.bukkit.block.sign.Side.FRONT); this.openSign(sign, org.bukkit.block.sign.Side.FRONT);
} }
@@ -740,7 +731,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @param sign The sign to open * @param sign The sign to open
* @param side The side of the sign to open * @param side The side of the sign to open
*/ */
void openSign(org.bukkit.block.@NotNull Sign sign, org.bukkit.block.sign.@NotNull Side side); void openSign(org.bukkit.block.Sign sign, org.bukkit.block.sign.Side side);
// Paper end // Paper end
/** /**
@@ -801,7 +792,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return the dropped item entity, or null if the action was unsuccessful * @return the dropped item entity, or null if the action was unsuccessful
*/ */
@Nullable @Nullable
default Item dropItem(final @NotNull EquipmentSlot slot) { default Item dropItem(final EquipmentSlot slot) {
return this.dropItem(slot, Integer.MAX_VALUE); return this.dropItem(slot, Integer.MAX_VALUE);
} }
@@ -813,7 +804,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return the dropped item entity, or null if the action was unsuccessful * @return the dropped item entity, or null if the action was unsuccessful
*/ */
@Nullable @Nullable
default Item dropItem(final @NotNull EquipmentSlot slot, final int amount) { default Item dropItem(final EquipmentSlot slot, final int amount) {
return this.dropItem(slot, amount, false, null); return this.dropItem(slot, amount, false, null);
} }
@@ -828,7 +819,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return the dropped item entity, or null if the action was unsuccessful * @return the dropped item entity, or null if the action was unsuccessful
*/ */
@Nullable @Nullable
Item dropItem(@NotNull EquipmentSlot slot, int amount, boolean throwRandomly, @Nullable Consumer<Item> entityOperation); Item dropItem(EquipmentSlot slot, int amount, boolean throwRandomly, @Nullable Consumer<Item> entityOperation);
/** /**
* Makes the player drop any arbitrary {@link ItemStack}, independently of whether the player actually * Makes the player drop any arbitrary {@link ItemStack}, independently of whether the player actually
@@ -841,7 +832,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return the dropped item entity, or null if the action was unsuccessful * @return the dropped item entity, or null if the action was unsuccessful
*/ */
@Nullable @Nullable
default Item dropItem(final @NotNull ItemStack itemStack) { default Item dropItem(final ItemStack itemStack) {
return this.dropItem(itemStack, false, null); return this.dropItem(itemStack, false, null);
} }
@@ -859,7 +850,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @return the dropped item entity, or null if the action was unsuccessful * @return the dropped item entity, or null if the action was unsuccessful
*/ */
@Nullable @Nullable
Item dropItem(final @NotNull ItemStack itemStack, boolean throwRandomly, @Nullable Consumer<Item> entityOperation); Item dropItem(final ItemStack itemStack, boolean throwRandomly, @Nullable Consumer<Item> entityOperation);
/** /**
* Gets the players current exhaustion level. * Gets the players current exhaustion level.
@@ -996,6 +987,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @throws IllegalArgumentException if the fireworkItemStack is not a firework * @throws IllegalArgumentException if the fireworkItemStack is not a firework
*/ */
@Nullable @Nullable
public Firework fireworkBoost(@NotNull ItemStack fireworkItemStack); public Firework fireworkBoost(ItemStack fireworkItemStack);
} }

File diff suppressed because it is too large Load Diff