Class ShootHandler
java.lang.Object
me.deecaad.weaponmechanics.weapon.shoot.ShootHandler
- All Implemented Interfaces:
me.deecaad.core.file.IValidator,TriggerListener
public class ShootHandler
extends Object
implements me.deecaad.core.file.IValidator, TriggerListener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanMostly this is defaulted to false.voiddoShootFirearmActions(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, HandData handData, org.bukkit.inventory.EquipmentSlot slot) org.bukkit.LocationgetShootLocation(EntityWrapper shooter, String weaponTitle, boolean mainhand) Gets the location to shoot from.booleanhandleConsumeItemOnShoot(org.bukkit.inventory.ItemStack weaponStack, HandData handData) Removes one from the amount of weapon stack.booleankeepFullAutoOn(EntityWrapper entityWrapper, TriggerType triggerType, Trigger trigger) Checks whether to keep full auto on with given triggervoidshoot(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.Location shootLocation, boolean mainHand, boolean updateSpreadChange, boolean isMelee) Shoots using weapon.voidshoot(org.bukkit.entity.LivingEntity livingEntity, String weaponTitle, org.bukkit.util.Vector normalizedDirection) Shoots using weapon.booleanshootWithoutTrigger(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield) voidstartReloadIfBothWeaponsEmpty(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, boolean dualWield, boolean isReloadLoop) booleantryUse(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield, org.bukkit.entity.LivingEntity knownVictim) Tries to use given trigger type to trigger some action.voidvalidate(me.deecaad.core.file.Configuration configuration, me.deecaad.core.file.SerializeData data) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.deecaad.core.file.IValidator
denyKeys, shouldValidate
-
Constructor Details
-
ShootHandler
public ShootHandler() -
ShootHandler
-
-
Method Details
-
allowOtherTriggers
public boolean allowOtherTriggers()Description copied from interface:TriggerListenerMostly this is defaulted to false.- Specified by:
allowOtherTriggersin interfaceTriggerListener- Returns:
- true if other triggers can occur even after this trigger is valid
-
tryUse
public boolean tryUse(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield, @Nullable org.bukkit.entity.LivingEntity knownVictim) Description copied from interface:TriggerListenerTries to use given trigger type to trigger some action.- Specified by:
tryUsein interfaceTriggerListener- Parameters:
entityWrapper- the entity which caused triggerweaponTitle- the weapon title involvedweaponStack- the weapon stack involvedslot- the weapon slot usedtriggerType- the trigger which caused thisdualWield- whether this was dual wieldknownVictim- if there is known victim- Returns:
- true if was able to use
-
shootWithoutTrigger
public boolean shootWithoutTrigger(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield) - Returns:
- true if was able to shoot
-
doShootFirearmActions
public void doShootFirearmActions(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, HandData handData, org.bukkit.inventory.EquipmentSlot slot) -
keepFullAutoOn
public boolean keepFullAutoOn(EntityWrapper entityWrapper, TriggerType triggerType, Trigger trigger) Checks whether to keep full auto on with given trigger -
startReloadIfBothWeaponsEmpty
public void startReloadIfBothWeaponsEmpty(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, boolean dualWield, boolean isReloadLoop) -
shoot
public void shoot(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.Location shootLocation, boolean mainHand, boolean updateSpreadChange, boolean isMelee) Shoots using weapon. Does not use ammo nor check for it. -
shoot
public void shoot(org.bukkit.entity.LivingEntity livingEntity, String weaponTitle, org.bukkit.util.Vector normalizedDirection) Shoots using weapon. Does not use ammo nor check for it. Does not apply recoil nor anything that would require EntityWrapper. -
handleConsumeItemOnShoot
public boolean handleConsumeItemOnShoot(org.bukkit.inventory.ItemStack weaponStack, HandData handData) Removes one from the amount of weapon stack. If stack is now empty also cancels all hand tasks.- Parameters:
weaponStack- the weapon stack- Returns:
- true if weapon stack amount is now 0
-
getShootLocation
public org.bukkit.Location getShootLocation(EntityWrapper shooter, String weaponTitle, boolean mainhand) Gets the location to shoot from.The returned location will have its direction set to the desired shoot direction. For VR players, this will be the hand direction.
- Parameters:
shooter- the entity that is shootingweaponTitle- the weapon titlemainhand- whether the shooter is shooting from their mainhand- Returns:
- the location to shoot from
-
getKeyword
- Specified by:
getKeywordin interfaceme.deecaad.core.file.IValidator
-
getAllowedPaths
- Specified by:
getAllowedPathsin interfaceme.deecaad.core.file.IValidator
-
validate
public void validate(me.deecaad.core.file.Configuration configuration, me.deecaad.core.file.SerializeData data) throws me.deecaad.core.file.SerializerException - Specified by:
validatein interfaceme.deecaad.core.file.IValidator- Throws:
me.deecaad.core.file.SerializerException
-