Class InfoHandler

java.lang.Object
me.deecaad.weaponmechanics.weapon.info.InfoHandler
All Implemented Interfaces:
me.deecaad.core.file.IValidator

public class InfoHandler extends Object implements me.deecaad.core.file.IValidator
  • Constructor Details

    • InfoHandler

      public InfoHandler()
      Default constructor for validator
    • InfoHandler

      public InfoHandler(WeaponHandler weaponHandler)
  • Method Details

    • getWeaponTitle

      @NotNull public String getWeaponTitle(String weapon)
      Returns the weapon-title that is most similar to the method parameter. This method will always return a valid weapon title, regardless of how inaccurate the parameter is. Meaning, yes, AK-47 could return RPG.
      Parameters:
      weapon - The non-null "inaccurate" weapon-title.
      Returns:
      The non-null valid weapon-title.
    • hasPermission

      public boolean hasPermission(org.bukkit.entity.LivingEntity player, String weaponTitle)
    • addWeapon

      public void addWeapon(String weaponTitle)
      Adds new weapon title to weapon list
      Parameters:
      weaponTitle - the new weapon title
    • hasWeapon

      public boolean hasWeapon(String weaponTitle)
    • getSortedWeaponList

      public List<String> getSortedWeaponList()
      Returns:
      the list of all registered weapons in sorted order
    • addWeaponWithConvert

      public void addWeaponWithConvert(String weaponTitle)
      Adds weapon title to weapon converter list
      Parameters:
      weaponTitle - the weapon title
    • getWeaponTitle

      @Nullable public String getWeaponTitle(org.bukkit.inventory.ItemStack weaponStack, boolean autoConvert)
      Parameters:
      weaponStack - the item stack which is supposed to be weapon
      autoConvert - whether or not to automatically convert weapon stack to weapon if its valid
      Returns:
      the weapon title or null if not found
    • tryConvertingToWeapon

      @Nullable public String tryConvertingToWeapon(org.bukkit.inventory.ItemStack possibleWeaponStack)
      Simple method which tries to convert the item stack to weapon stack if its configured to do so.
      Parameters:
      possibleWeaponStack - the possible weapon stack
      Returns:
      the weapon title or null if not found
    • generateWeapon

      public org.bukkit.inventory.ItemStack generateWeapon(String weaponTitle, int amount)
    • giveOrDropWeapon

      public boolean giveOrDropWeapon(String weaponTitle, org.bukkit.entity.LivingEntity entity, int amount)
    • giveOrDropWeapon

      public boolean giveOrDropWeapon(String weaponTitle, org.bukkit.entity.LivingEntity entity, int amount, Map<String,Object> data)
    • denyDualWielding

      public boolean denyDualWielding(TriggerType checkCause, @Nullable org.bukkit.entity.Player player, @Nullable String mainWeaponTitle, @Nullable String offWeaponTitle)
      Checks if two weapons are able to work together when holding both of them
      Parameters:
      player - the player for which to send denied message if not allowed to dual wield
      mainWeaponTitle - the main hand weapon title
      offWeaponTitle - the off hand weapon title
      Returns:
      whether dual wielding is allowed
    • getKeyword

      public String getKeyword()
      Specified by:
      getKeyword in interface me.deecaad.core.file.IValidator
    • getAllowedPaths

      public List<String> getAllowedPaths()
      Specified by:
      getAllowedPaths in interface me.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:
      validate in interface me.deecaad.core.file.IValidator
      Throws:
      me.deecaad.core.file.SerializerException