From 11884caf21d65f8addaa148b3cc553a9f2000dd4 Mon Sep 17 00:00:00 2001 From: Strokkur24 <133226102+Strokkur424@users.noreply.github.com> Date: Tue, 24 Dec 2024 13:18:14 +0100 Subject: [PATCH] Remove fully qualified imports and comments. Small cleanup --- .../java/org/bukkit/entity/HumanEntity.java | 23 ++++++++++--------- .../craftbukkit/entity/CraftHumanEntity.java | 5 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java b/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java index 91cc11b5f0..f275331ac1 100644 --- a/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java @@ -2,10 +2,12 @@ package org.bukkit.entity; import java.util.Collection; import java.util.Set; +import java.util.UUID; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.NamespacedKey; +import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryView; @@ -706,7 +708,6 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ public boolean dropItem(boolean dropAll); - // Paper start - Extend HumanEntity#dropItem API /** * Makes the entity drop the first declared {@link ItemStack} occurrence in the inventory * @@ -720,17 +721,17 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder /** * Makes the entity drop an item from their inventory based on the specified ItemStack. * <br> - * This method calls {@link HumanEntity#dropItem(int slot, java.util.UUID thrower, boolean throwRandomly)} + * This method calls {@link HumanEntity#dropItem(int slot, UUID thrower, boolean throwRandomly)} * with the first {@link ItemStack} occurrence in the inventory * * @param itemStack The ItemStack to drop - * @param thrower The {@link java.util.UUID} to set the resulting {@link Item}'s thrower to + * @param thrower The {@link UUID} to set the resulting {@link Item}'s thrower to * @param throwRandomly Whether the item should disperse randomly. * This means that instead of the item being dropped where the player is currently looking, * it instead throws it in any direction, similar to how items drop after a player's death. * @return The dropped item, or null if the action was unsuccessful */ - public @Nullable Item dropItem(final @NotNull ItemStack itemStack, final @Nullable java.util.UUID thrower, final boolean throwRandomly); + public @Nullable Item dropItem(final @NotNull ItemStack itemStack, final @Nullable UUID thrower, final boolean throwRandomly); /** * Makes the entity drop an item from their inventory based on the slot. @@ -747,22 +748,22 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder * Makes the entity drop an item from their inventory based on the slot. * * @param slot The slot to drop - * @param thrower The {@link java.util.UUID} to set the resulting {@link Item}'s thrower to + * @param thrower The {@link UUID} to set the resulting {@link Item}'s thrower to * @param throwRandomly Whether the item should disperse randomly. * This means that instead of the item being dropped where the player is currently looking, * it instead throws it in any direction, similar to how items drop after a player's death. * @return The dropped item entity, or null if the action was unsuccessful * @throws IndexOutOfBoundsException If the slot is negative or bigger than the player's inventory */ - public @Nullable Item dropItem(final int slot, final @Nullable java.util.UUID thrower, final boolean throwRandomly); + public @Nullable Item dropItem(final int slot, final @Nullable UUID thrower, final boolean throwRandomly); /** - * Makes the entity drop an item from their inventory based on the {@link org.bukkit.inventory.EquipmentSlot} + * Makes the entity drop an item from their inventory based on the {@link EquipmentSlot} * * @param slot The equipment slot to drop * @return The dropped item entity, or null if the action was unsuccessful */ - public default @Nullable Item dropItem(final @NotNull org.bukkit.inventory.EquipmentSlot slot) { + public default @Nullable Item dropItem(final @NotNull EquipmentSlot slot) { return this.dropItem(slot, null, false); } @@ -770,14 +771,14 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder * Makes the player drop an item from their inventory based on the equipment slot. * * @param slot The equipment slot to drop - * @param thrower The {@link java.util.UUID} to set the resulting {@link Item}'s thrower to + * @param thrower The {@link UUID} to set the resulting {@link Item}'s thrower to * @param throwRandomly Whether the item should disperse randomly. * This means that instead of the item being dropped where the player is currently looking, * it instead throws it in any direction, similar to how items drop after a player's death. * @return The dropped item entity, or null if the action was unsuccessful */ - public @Nullable Item dropItem(final @NotNull org.bukkit.inventory.EquipmentSlot slot, final @Nullable java.util.UUID thrower, final boolean throwRandomly); - // Paper end + public @Nullable Item dropItem(final @NotNull EquipmentSlot slot, final @Nullable UUID thrower, final boolean throwRandomly); + /** * Gets the players current exhaustion level. diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index a43845e0f9..35350604ae 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -803,7 +803,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { // Paper end - Fix HumanEntity#drop not updating the client inv } - // Paper start - Extend HumanEntity#dropItem API @Override public @Nullable org.bukkit.entity.Item dropItem(final @NotNull ItemStack itemStack, final @Nullable java.util.UUID thrower, final boolean throwRandomly) { final int slot = this.inventory.first(itemStack); @@ -817,7 +816,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @Override public @Nullable org.bukkit.entity.Item dropItem(final int slot, final @Nullable java.util.UUID thrower, final boolean throwRandomly) { // Make sure the slot is in bounds - if (slot < 0 || this.inventory.getSize() <= slot) { + if (slot < 0 || slot >= this.inventory.getSize()) { throw new IndexOutOfBoundsException("Slot " + slot + " out of range for inventory of size " + this.inventory.getSize()); } @@ -838,7 +837,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } private org.bukkit.entity.Item dropItemRaw(final ItemStack is, final @Nullable java.util.UUID thrower, final boolean throwRandomly) { - if (is == null || is.getType() == Material.AIR) { + if (is == null || is.isEmpty()) { return null; }