Wire up Super Ability config pt 1

This commit is contained in:
nossr50
2019-03-19 05:00:21 -07:00
parent e933efcee0
commit 45430d9c25
13 changed files with 113 additions and 53 deletions

View File

@ -367,9 +367,9 @@ public class MainConfig extends ConfigValidated {
reason.add(COMMANDS + "." + INSPECT1 + "." + MAX_DISTANCE + " should be greater than 0!");
}
if (getTreeFellerThreshold() <= 0) {
/*if (getTreeFellerThreshold() <= 0) {
reason.add(ABILITIES + "." + LIMITS + "." + TREE_FELLER_THRESHOLD + " should be greater than 0!");
}
}*/
if (getFishingLureModifier() < 0) {
reason.add(ABILITIES + "." + FISHING + "." + LURE_MODIFIER + " should be at least 0!");
@ -675,41 +675,6 @@ public class MainConfig extends ConfigValidated {
return getDoubleValue(COMMANDS, INSPECT1, MAX_DISTANCE);
}
/*
* ABILITY SETTINGS
*/
/* General Settings */
public boolean getAbilityMessagesEnabled() {
return getBooleanValue(ABILITIES, MESSAGES);
}
public boolean getAbilitiesEnabled() {
return getBooleanValue(ABILITIES, ENABLED);
}
public boolean getAbilitiesOnlyActivateWhenSneaking() {
return getBooleanValue(ABILITIES, ACTIVATION, ONLY_ACTIVATE_WHEN_SNEAKING);
}
public int getCooldown(SuperAbilityType ability) {
return getIntValue(ABILITIES, COOLDOWNS + ability.toString());
}
public int getMaxLength(SuperAbilityType ability) {
return getIntValue(ABILITIES, MAX_SECONDS, ability.toString());
}
/* Durability Settings */
public int getAbilityToolDamage() {
return getIntValue(ABILITIES, TOOLS, DURABILITY_LOSS);
}
/* Thresholds */
public int getTreeFellerThreshold() {
return getIntValue(ABILITIES, LIMITS, TREE_FELLER_THRESHOLD);
}
/*
* SKILL SETTINGS
*/

View File

@ -1,7 +1,18 @@
package com.gmail.nossr50.config.hocon.notifications;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigNotifications {
public static final boolean SUPER_ABILITY_TOOL_NOTIFICATION_DEFAULT = true;
@Setting(value = "Super-Ability-Tool-Raising-Lowering-Notification",
comment = "Notifies the player when they go into the tool readying state for super abilities.")
private boolean superAbilityToolMessage = SUPER_ABILITY_TOOL_NOTIFICATION_DEFAULT;
public boolean isSuperAbilityToolMessage() {
return superAbilityToolMessage;
}
}

View File

@ -13,4 +13,11 @@ public class ConfigSectionSuperAbilityLimits {
"\nDefault value: "+TOOL_DURABILITY_DAMAGE_DEFAULT)
private int toolDurabilityDamage = TOOL_DURABILITY_DAMAGE_DEFAULT;
public ConfigSectionTreeFeller getTreeFeller() {
return treeFeller;
}
public int getToolDurabilityDamage() {
return toolDurabilityDamage;
}
}

View File

@ -53,4 +53,5 @@ public class ConfigSectionSuperAbilityMaxLength {
public int getTreeFeller() {
return treeFeller;
}
}

View File

@ -12,4 +12,8 @@ public class ConfigSectionTreeFeller {
"\nLower this number to improve performance." +
"\nDefault value: "+TREE_FELLER_LIMIT_DEFAULT)
private int treeFellerLimit = TREE_FELLER_LIMIT_DEFAULT;
public int getTreeFellerLimit() {
return treeFellerLimit;
}
}

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50.config.hocon.superabilities;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -30,4 +32,74 @@ public class ConfigSuperAbilities {
@Setting(value = "Super-Ability-Settings", comment = "Change specific parameters for super abilities.")
private ConfigSectionSuperAbilityLimits superAbilityLimits = new ConfigSectionSuperAbilityLimits();
public boolean isSuperAbilitiesEnabled() {
return superAbilitiesEnabled;
}
public boolean isMustSneakToActivate() {
return mustSneakToActivate;
}
public ConfigSectionSuperAbilityCooldowns getSuperAbilityCooldowns() {
return superAbilityCooldowns;
}
public ConfigSectionSuperAbilityMaxLength getSuperAbilityMaxLength() {
return superAbilityMaxLength;
}
public ConfigSectionSuperAbilityLimits getSuperAbilityLimits() {
return superAbilityLimits;
}
public int getCooldownForSuper(SuperAbilityType superAbilityType)
{
switch(superAbilityType)
{
case BERSERK:
return superAbilityCooldowns.getBerserk();
case GREEN_TERRA:
return superAbilityCooldowns.getGreenTerra();
case TREE_FELLER:
return superAbilityCooldowns.getTreeFeller();
case BLAST_MINING:
return superAbilityCooldowns.getBlastMining();
case SUPER_BREAKER:
return superAbilityCooldowns.getSuperBreaker();
case SKULL_SPLITTER:
return superAbilityCooldowns.getSkullSplitter();
case SERRATED_STRIKES:
return superAbilityCooldowns.getSerratedStrikes();
case GIGA_DRILL_BREAKER:
return superAbilityCooldowns.getGigaDrillBreaker();
default:
mcMMO.p.getLogger().severe("Cooldown Parameter not found for "+superAbilityType.toString());
return 240;
}
}
public int getMaxLengthForSuper(SuperAbilityType superAbilityType)
{
switch(superAbilityType)
{
case BERSERK:
return superAbilityMaxLength.getBerserk();
case GREEN_TERRA:
return superAbilityMaxLength.getGreenTerra();
case TREE_FELLER:
return superAbilityMaxLength.getTreeFeller();
case SUPER_BREAKER:
return superAbilityMaxLength.getSuperBreaker();
case SKULL_SPLITTER:
return superAbilityMaxLength.getSkullSplitter();
case SERRATED_STRIKES:
return superAbilityMaxLength.getSerratedStrikes();
case GIGA_DRILL_BREAKER:
return superAbilityMaxLength.getGigaDrillBreaker();
default:
mcMMO.p.getLogger().severe("Max Length Parameter not found for "+superAbilityType.toString());
return 60;
}
}
}