Class WeaponSkinEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
me.deecaad.weaponmechanics.weapon.weaponevents.WeaponEvent
me.deecaad.weaponmechanics.weapon.weaponevents.WeaponSkinEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class WeaponSkinEvent extends WeaponEvent implements org.bukkit.event.Cancellable
Called whenever a SkinHandler attempts to change the skin of a weapon. A skin may be changed when an entity zooms in/out, reloads, sprints, runs out of ammo, etc.
  • Constructor Details

    • WeaponSkinEvent

      public WeaponSkinEvent(String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.entity.LivingEntity shooter, org.bukkit.inventory.EquipmentSlot hand, SkinSelector skinList)
    • WeaponSkinEvent

      public WeaponSkinEvent(String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.entity.LivingEntity shooter, org.bukkit.inventory.EquipmentSlot hand, SkinSelector skinList, TriggerType cause, boolean forceDefault)
  • Method Details

    • getSkinSelector

      public SkinSelector getSkinSelector()
      Returns the config options for this skin. You can get this by using WeaponMechanics.getConfigurations().getObject(weaponTitle + ".Skin", SkinSelector.class)
      Returns:
      The non-null skin list.
    • getCause

      public TriggerType getCause()
      Returns the reason for the skin update. Returns null when the cause is unknown, or a plugin manually updated the skin.
      Returns:
      The cause of the skin update, or null.
    • isForceDefault

      public boolean isForceDefault()
      Returns true if the SkinHandler requests a DEFAULT weapon. This tends to happen when the weapon is dequipped.
      Returns:
      true if the weapon should be default skin.
    • getSkin

      public String getSkin()
      If only WeaponMechanics is installed, this method will always return "Default". If WeaponMechanicsCosmetics is installed, this method may return a different value (Which you can find in the config for this weapon).
      Returns:
      The non-null name of the skin.
    • setSkin

      public void setSkin(String skin)
      • Only lowercase letters
      • Use null for default skin
      • Make sure skin exists
      Parameters:
      skin - The nullable skin name.
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancel)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • getHandlers

      @NotNull public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()