Class InfoHandler
java.lang.Object
me.deecaad.weaponmechanics.weapon.info.InfoHandler
- All Implemented Interfaces:
me.deecaad.core.file.IValidator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds new weapon title to weapon listvoidaddWeaponWithConvert(String weaponTitle) Adds weapon title to weapon converter listbooleandenyDualWielding(TriggerType checkCause, org.bukkit.entity.Player player, String mainWeaponTitle, String offWeaponTitle) Checks if two weapons are able to work together when holding both of themorg.bukkit.inventory.ItemStackgenerateWeapon(String weaponTitle, int amount) getWeaponTitle(String weapon) Returns the weapon-title that is most similar to the method parameter.getWeaponTitle(org.bukkit.inventory.ItemStack weaponStack, boolean autoConvert) booleangiveOrDropWeapon(String weaponTitle, org.bukkit.entity.LivingEntity entity, int amount) booleangiveOrDropWeapon(String weaponTitle, org.bukkit.entity.LivingEntity entity, int amount, Map<String, Object> data) booleanhasPermission(org.bukkit.entity.LivingEntity player, String weaponTitle) booleantryConvertingToWeapon(org.bukkit.inventory.ItemStack possibleWeaponStack) Simple method which tries to convert the item stack to weapon stack if its configured to do so.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
-
InfoHandler
public InfoHandler()Default constructor for validator -
InfoHandler
-
-
Method Details
-
getWeaponTitle
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-47could returnRPG.- Parameters:
weapon- The non-null "inaccurate" weapon-title.- Returns:
- The non-null valid weapon-title.
-
hasPermission
-
addWeapon
Adds new weapon title to weapon list- Parameters:
weaponTitle- the new weapon title
-
hasWeapon
-
getSortedWeaponList
- Returns:
- the list of all registered weapons in sorted order
-
addWeaponWithConvert
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 weaponautoConvert- whether or not to automatically convert weapon stack to weapon if its valid- Returns:
- the weapon title or null if not found
-
tryConvertingToWeapon
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
-
giveOrDropWeapon
public boolean giveOrDropWeapon(String weaponTitle, org.bukkit.entity.LivingEntity entity, int amount) -
giveOrDropWeapon
-
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 wieldmainWeaponTitle- the main hand weapon titleoffWeaponTitle- the off hand weapon title- Returns:
- whether dual wielding is allowed
-
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
-