Package org.mcmonkey.sentinel
Class SentinelItemHelper
java.lang.Object
org.mcmonkey.sentinel.SentinelHelperObject
org.mcmonkey.sentinel.SentinelItemHelper
Helper for item management.
-
Field Summary
Fields inherited from class org.mcmonkey.sentinel.SentinelHelperObject
attackHelper, itemHelper, sentinel, targetingHelper, weaponHelper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStackautoRedirect(org.bukkit.inventory.ItemStack stack) Processes weapon redirection for an item, returning the redirected item (or an unchanged one).org.bukkit.inventory.ItemStackgetArrow()Gets the correct ArrowItem type for the NPC based on inventory items (can be null if the NPC needs ammo but has none).org.bukkit.inventory.ItemStackReturns the item held by an NPC.voidGrabs the next item for an NPC to use and moves it into the NPC's hand.booleanReturns whether the NPC is holding a shield in its offhand.booleanisMeleeWeapon(org.bukkit.inventory.ItemStack item) Returns whether the item is some form of melee weapon.booleanisRanged()Returns whether the NPC is holding a ranged weapon.booleanisRanged(org.bukkit.inventory.ItemStack item) Returns whether the NPC is holding a ranged weapon.voidReduces the durability of the NPC's held item.booleanReturns whether the NPC can take durability from the held item.voidswapToMatch(java.util.function.Function<org.bukkit.inventory.ItemStack, Boolean> doSwap, boolean isRanged) Swaps weapon to the first item that matches the input function.voidSwaps the NPC to a melee weapon if possible.voidSwaps the NPC to an open hand if possible.voidSwaps the NPC to a ranged weapon if possible.booleanSwaps offhand to shield for defense, if possible.voidTakes an arrow from the NPC's inventory.voidtakeOne()Takes one item from the NPC's held items (for consumables).booleanusesBow(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a bow item.booleanusesEgg(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using an egg item.booleanusesFangsBook(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using an evoker fangs attack book.booleanusesFireball(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a fireball item.booleanusesLightning(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a lightning-attack item.booleanusesLlamaSpit(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a llama spit item (white_dye).booleanusesPearl(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a pearl item.booleanusesPotion(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a potion item.booleanusesShulkerBullet(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a shulker bullet item.booleanusesSnowball(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a snowball item.booleanusesSpectral(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a spectral-effect-attack item.booleanusesTrident(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a trident item.booleanusesWitherSkull(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a wither-skull item.Methods inherited from class org.mcmonkey.sentinel.SentinelHelperObject
debug, getLivingEntity, getNPC, setTraitObject
-
Constructor Details
-
SentinelItemHelper
public SentinelItemHelper()
-
-
Method Details
-
getArrow
public org.bukkit.inventory.ItemStack getArrow()Gets the correct ArrowItem type for the NPC based on inventory items (can be null if the NPC needs ammo but has none). -
reduceDurability
public void reduceDurability()Reduces the durability of the NPC's held item. -
takeArrow
public void takeArrow()Takes an arrow from the NPC's inventory. -
takeOne
public void takeOne()Takes one item from the NPC's held items (for consumables). -
grabNextItem
public void grabNextItem()Grabs the next item for an NPC to use and moves it into the NPC's hand. -
swapToShield
public boolean swapToShield()Swaps offhand to shield for defense, if possible. Returns true if a shield was equipped. -
swapToMatch
public void swapToMatch(java.util.function.Function<org.bukkit.inventory.ItemStack, Boolean> doSwap, boolean isRanged) Swaps weapon to the first item that matches the input function. -
swapToOpenHand
public void swapToOpenHand()Swaps the NPC to an open hand if possible. -
swapToRanged
public void swapToRanged()Swaps the NPC to a ranged weapon if possible. -
swapToMelee
public void swapToMelee()Swaps the NPC to a melee weapon if possible. -
hasShield
public boolean hasShield()Returns whether the NPC is holding a shield in its offhand. -
isMeleeWeapon
public boolean isMeleeWeapon(org.bukkit.inventory.ItemStack item) Returns whether the item is some form of melee weapon. -
isRanged
public boolean isRanged()Returns whether the NPC is holding a ranged weapon. -
isRanged
public boolean isRanged(org.bukkit.inventory.ItemStack item) Returns whether the NPC is holding a ranged weapon. -
autoRedirect
public org.bukkit.inventory.ItemStack autoRedirect(org.bukkit.inventory.ItemStack stack) Processes weapon redirection for an item, returning the redirected item (or an unchanged one). -
getHeldItem
public org.bukkit.inventory.ItemStack getHeldItem()Returns the item held by an NPC. -
usesBow
public boolean usesBow(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a bow item. -
usesFireball
public boolean usesFireball(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a fireball item. -
usesSnowball
public boolean usesSnowball(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a snowball item. -
usesLightning
public boolean usesLightning(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a lightning-attack item. -
usesEgg
public boolean usesEgg(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using an egg item. -
usesPearl
public boolean usesPearl(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a pearl item. -
usesWitherSkull
public boolean usesWitherSkull(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a wither-skull item. -
usesTrident
public boolean usesTrident(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a trident item. -
usesSpectral
public boolean usesSpectral(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a spectral-effect-attack item. -
usesPotion
public boolean usesPotion(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a potion item. -
usesLlamaSpit
public boolean usesLlamaSpit(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a llama spit item (white_dye). -
usesShulkerBullet
public boolean usesShulkerBullet(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using a shulker bullet item. -
usesFangsBook
public boolean usesFangsBook(org.bukkit.inventory.ItemStack it) Returns whether the NPC is using an evoker fangs attack book. -
shouldTakeDura
public boolean shouldTakeDura()Returns whether the NPC can take durability from the held item.
-