Package com.sucy.skill.data
Class Settings
java.lang.Object
com.sucy.skill.data.Settings
The management class for SkillAPI's config.yml settings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanareSkillsDisabledForRegion(String region) booleancanAttack(org.bukkit.entity.LivingEntity attacker, org.bukkit.entity.LivingEntity target) Checks whether something can be attackedbooleancanAttack(org.bukkit.entity.LivingEntity attacker, org.bukkit.entity.LivingEntity target, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) Checks whether something can be attackedgetAttrGiveText(String attr) getAttrReqText(String attr) Retrieves the text used for attribute requirements on itemsdoublegetBreakYield(PlayerClass playerClass, org.bukkit.Material mat) doublegetCraftYield(PlayerClass playerClass, org.bukkit.Material mat) intRetrieves the default health for players that do not have a class.getGroupSettings(String group) Retrieves the settings for a class groupRetrieves the skill used for level up effectsintgetMaxAccounts(org.bukkit.entity.Player player) Retrieves the max amount of accounts allowed for a specific player by checking permissions for additional accounts.doublegetPlaceYield(PlayerClass playerClass, org.bukkit.Material mat) intgetRequiredExp(int level) Gets the required amount of experience at a given levelintRetrieves the amount of ticks in between each auto savegetSkillText(String skill) intRetrieves the password for the database credentialsRetrieves the username for the database credentialsdoubleGets the experience yield of a mobbooleanChecks whether the plugin has a valid skill for level up effects loaded.booleanisAlly(org.bukkit.entity.LivingEntity attacker, org.bukkit.entity.LivingEntity target) Checks whether something is an allybooleanChecks whether attributes are enabledbooleanChecks whether auto saving is enabledbooleanisExpDisabledForRegion(String region) booleanChecks whether SkillAPI should modify the max health of playersbooleanChecks whether auto-leveled skills are to be shown.booleanisUseSql()Checks whether the plugin is using SQL Database savingbooleanbooleanbooleanbooleanisValidTarget(org.bukkit.entity.LivingEntity target) Checks whether a target is a valid target.booleanisWorldEnabled(String world) Checks whether SkillAPI is active in the world with the given name.booleanisWorldEnabled(org.bukkit.World world) Checks whether SkillAPI is active in the worldvoidvoidvoidreload()Reloads the settings from SkillAPI's config.yml file.voidsetCombatProtection(CombatProtection combatProtection) Swaps out the default combat protection for a custom onebooleanshouldIgnoreExpLoss(org.bukkit.World world) booleanCheck whether to use the title display on the given message type
-
Constructor Details
-
Settings
Initializes a new settings manager.
This is already set up by SkillAPI and shouldn't be instantiated elsewhere. Instead, get it from SkillAPI using the SkillAPI.getSettings() method.
- Parameters:
plugin- SkillAPI plugin reference
-
-
Method Details
-
reload
public void reload()Reloads the settings from SkillAPI's config.yml file.
This will fill in any missing values with default values and trim any values that aren't supposed to be there.
-
loadExperienceSettings
public void loadExperienceSettings() -
getBreakYield
-
getPlaceYield
-
getCraftYield
-
loadGroupSettings
public void loadGroupSettings() -
getGroupSettings
Retrieves the settings for a class group- Parameters:
group- name of the group to retrieve the settings for- Returns:
- settings for the class group
-
getMaxAccounts
public int getMaxAccounts(org.bukkit.entity.Player player) Retrieves the max amount of accounts allowed for a specific player by checking permissions for additional accounts.- Parameters:
player- player to check the max allowed accounts for- Returns:
- number of allowed accounts
-
canAttack
public boolean canAttack(org.bukkit.entity.LivingEntity attacker, org.bukkit.entity.LivingEntity target) Checks whether something can be attacked- Parameters:
attacker- the attacking entitytarget- the target entity- Returns:
- true if can be attacked, false otherwise
-
canAttack
public boolean canAttack(org.bukkit.entity.LivingEntity attacker, org.bukkit.entity.LivingEntity target, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) Checks whether something can be attacked- Parameters:
attacker- the attacking entitytarget- the target entitycause- the cause of the damage, might affect death messages- Returns:
- true if can be attacked, false otherwise
-
isAlly
public boolean isAlly(org.bukkit.entity.LivingEntity attacker, org.bukkit.entity.LivingEntity target) Checks whether something is an ally- Parameters:
attacker- the attacking entitytarget- the target entity- Returns:
- true if an ally, false otherwise
-
isValidTarget
public boolean isValidTarget(org.bukkit.entity.LivingEntity target) Checks whether a target is a valid target.- Parameters:
target- target to check- Returns:
- true if a valid target, false otherwise
-
setCombatProtection
Swaps out the default combat protection for a custom one- Parameters:
combatProtection- combat protection to use
-
isAutoSave
public boolean isAutoSave()Checks whether auto saving is enabled- Returns:
- true if enabled, false otherwise
-
getSaveFreq
public int getSaveFreq()Retrieves the amount of ticks in between each auto save- Returns:
- frequency of saves
-
isUseSql
public boolean isUseSql()Checks whether the plugin is using SQL Database saving- Returns:
- true if enabled, false otherwise
-
getSqlUser
Retrieves the username for the database credentials- Returns:
- SQL database username
-
getSqlPass
Retrieves the password for the database credentials- Returns:
- SQL database password
-
getSqlDelay
public int getSqlDelay()- Returns:
- time in milliseconds to wait before loading SQL data
-
isModifyHealth
public boolean isModifyHealth()Checks whether SkillAPI should modify the max health of players- Returns:
- true if enabled, false otherwise
-
getDefaultHealth
public int getDefaultHealth()Retrieves the default health for players that do not have a class.
- Returns:
- default health for classless players
-
isShowingAutoSkills
public boolean isShowingAutoSkills()Checks whether auto-leveled skills are to be shown.- Returns:
- true if shown, false otherwise
-
isAttributesEnabled
public boolean isAttributesEnabled()Checks whether attributes are enabled- Returns:
- true if enabled, false otherwise
-
hasLevelUpEffect
public boolean hasLevelUpEffect()Checks whether the plugin has a valid skill for level up effects loaded.- Returns:
- true if one is available, false otherwise
-
getLevelUpSkill
Retrieves the skill used for level up effects- Returns:
- skill for level up effects
-
getSkillText
- Returns:
- lore for skill requirements
-
getAttrReqText
Retrieves the text used for attribute requirements on items- Returns:
- lore text for attributes
-
getAttrGiveText
- Returns:
- lore text for giving attributes
-
useTitle
Check whether to use the title display on the given message type- Parameters:
type- type of message to check for- Returns:
- true if should use title display, false otherwise
-
isUsingBars
public boolean isUsingBars()- Returns:
- true if using bar format, false otherwise
-
isUsingWand
public boolean isUsingWand() -
isUsingCombat
public boolean isUsingCombat() -
getRequiredExp
public int getRequiredExp(int level) Gets the required amount of experience at a given level- Parameters:
level- level of the class- Returns:
- required experience to gain a level
-
getYield
Gets the experience yield of a mob- Parameters:
mob- mob to get the yield of- Returns:
- experience yield
-
shouldIgnoreExpLoss
public boolean shouldIgnoreExpLoss(org.bukkit.World world) - Parameters:
world- world a player died in- Returns:
- true if the world is blacklisted for losing experience
-
isWorldEnabled
public boolean isWorldEnabled(org.bukkit.World world) Checks whether SkillAPI is active in the world- Parameters:
world- world to check- Returns:
- true if active, false otherwise
-
isWorldEnabled
Checks whether SkillAPI is active in the world with the given name.- Parameters:
world- world name- Returns:
- true if active, false otherwise
-
areSkillsDisabledForRegion
-
isExpDisabledForRegion
-