mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-13 21:24:00 +01:00
Remove fully qualified imports and comments. Small cleanup
This commit is contained in:
parent
5361df84ce
commit
11884caf21
2 changed files with 14 additions and 14 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue