Class WeaponHandler

java.lang.Object
me.deecaad.weaponmechanics.weapon.WeaponHandler

public class WeaponHandler extends Object
Class to generally handle weapon functions
  • Constructor Details

    • WeaponHandler

      public WeaponHandler()
  • Method Details

    • useTrigger

      public void useTrigger(org.bukkit.entity.LivingEntity livingEntity, TriggerType triggerType, boolean autoConvert)
      Checks main and off hand items if they're weapons and uses them based on trigger. This is used with the exceptions off TriggerPlayerListeners.dropItem(PlayerDropItemEvent), TriggerPlayerListeners.interact(PlayerInteractEvent) and TriggerPlayerListeners.swapHandItems(PlayerSwapHandItemsEvent).
      Parameters:
      livingEntity - the living entity which caused trigger
      triggerType - the trigger type
      autoConvert - whether the weapon items should be converted
    • tryUses

      public void tryUses(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield, @Nullable org.bukkit.entity.LivingEntity victim)
      Tries all uses in this exact order
      
       1) Shoot
       2) Reload
       3) Scope
       4) Selective fire
       5) Ammo type switch
       6) Any other registered TriggerListener in order they were added
       
      Parameters:
      entityWrapper - the entity which caused trigger
      weaponTitle - the weapon title involved
      weaponStack - the weapon stack involved
      slot - the weapon slot used
      triggerType - the trigger which caused this
      dualWield - whether this was dual wield
      victim - if there is known victim
    • addTriggerListener

      public void addTriggerListener(TriggerListener triggerListener)
      Add new trigger listener to list. Trigger listeners are used in order they're given
      Parameters:
      triggerListener - the new trigger listener
    • getInfoHandler

      public InfoHandler getInfoHandler()
      Returns:
      the info handler
    • getShootHandler

      public ShootHandler getShootHandler()
      Returns:
      the shoot handler
    • getReloadHandler

      public ReloadHandler getReloadHandler()
      Returns:
      the reload handler
    • getScopeHandler

      public ScopeHandler getScopeHandler()
      Returns:
      the scope handler
    • getDamageHandler

      public DamageHandler getDamageHandler()
      Returns:
      the damage handler
    • getSkinHandler

      public SkinHandler getSkinHandler()
      Returns:
      the skin handler
    • getMeleeHandler

      public MeleeHandler getMeleeHandler()
      Returns:
      the melee handler
    • getStatsHandler

      public StatsHandler getStatsHandler()
      Returns:
      the stats handler
    • getHitHandler

      public HitHandler getHitHandler()
      Returns:
      the hit handler