Add PVP/PVE settings to core skill config

This commit is contained in:
nossr50 2019-06-06 05:58:44 -07:00
parent 3e75026281
commit 51a57429b6
3 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,30 @@
package com.gmail.nossr50.config.hocon.skills.coreskills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import java.util.HashMap;
@ConfigSerializable
public class ConfigCoreSkillCombatMap {
private static final HashMap<PrimarySkillType, Boolean> COMBAT_TOGGLE_DEFAULT;
static {
COMBAT_TOGGLE_DEFAULT = new HashMap<>();
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
COMBAT_TOGGLE_DEFAULT.put(primarySkillType, true);
}
}
@Setting(value = "Combat-Toggles")
private HashMap<PrimarySkillType, Boolean> combatToggleMap = COMBAT_TOGGLE_DEFAULT;
public HashMap<PrimarySkillType, Boolean> getCombatToggleMap() {
return combatToggleMap;
}
}

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.config.hocon.skills.coreskills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -10,6 +11,10 @@ public class ConfigCoreSkills {
"\nCore skills are ones built into mcMMO")
private ConfigCoreSkillsAcrobatics configCoreSkillsAcrobatics = new ConfigCoreSkillsAcrobatics();
@Setting(value = "Combat-Settings", comment = "Determine whether or not a skills effects can activate in PVP or PVE" +
"\nIf a skill has no combat interactions, the toggle for it will still exists in case I ever do add combat interactions for the skill.")
private ConfigCoreSkillsCombatToggles combatToggles = new ConfigCoreSkillsCombatToggles();
public boolean isRollEnabled() {
return configCoreSkillsAcrobatics.isRollEnabled();
}
@ -21,4 +26,24 @@ public class ConfigCoreSkills {
public boolean isAcrobaticsEnabled() {
return getConfigCoreSkillsAcrobatics().isAcrobaticsEnabled();
}
public ConfigCoreSkillsCombatToggles getCombatToggles() {
return combatToggles;
}
public ConfigCoreSkillCombatMap getPve() {
return combatToggles.getPve();
}
public ConfigCoreSkillCombatMap getPvp() {
return combatToggles.getPvp();
}
public boolean isPVEEnabled(PrimarySkillType primarySkillType) {
return combatToggles.isPVEEnabled(primarySkillType);
}
public boolean isPVPEnabled(PrimarySkillType primarySkillType) {
return combatToggles.isPVPEnabled(primarySkillType);
}
}

View File

@ -0,0 +1,34 @@
package com.gmail.nossr50.config.hocon.skills.coreskills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigCoreSkillsCombatToggles {
@Setting(value = "PVE-Toggles", comment = "When set to false, offensive combat related abilities from a skill will not trigger in PVE." +
"\nPVE = Player Versus Environment" +
"\nEnvironment is stuff like Monsters, Animals")
private ConfigCoreSkillCombatMap pve = new ConfigCoreSkillCombatMap();
@Setting(value = "PVE-Toggles", comment = "When set to false, offensive combat related abilities from a skill will not trigger in PVP." +
"\nPVP = Player Versus Player")
private ConfigCoreSkillCombatMap pvp = new ConfigCoreSkillCombatMap();
public ConfigCoreSkillCombatMap getPve() {
return pve;
}
public ConfigCoreSkillCombatMap getPvp() {
return pvp;
}
public boolean isPVEEnabled(PrimarySkillType primarySkillType) {
return pve.getCombatToggleMap().get(primarySkillType);
}
public boolean isPVPEnabled(PrimarySkillType primarySkillType) {
return pvp.getCombatToggleMap().get(primarySkillType);
}
}