wire up creatures config

This commit is contained in:
nossr50
2019-03-19 09:23:53 -07:00
parent 7cd8099d3c
commit 956b01a28e
15 changed files with 74 additions and 53 deletions

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -255,7 +253,7 @@ public class MainConfig extends ConfigValidated {
}*/
/* Mob Healthbar */
if (getMobHealthbarTime() == 0) {
if (mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayTimeSeconds() == 0) {
reason.add(MOB_HEALTHBAR + "." + DISPLAY_TIME + " cannot be 0! Set to -1 to disable or set a valid value.");
}
@ -462,23 +460,6 @@ public class MainConfig extends ConfigValidated {
return getBooleanValue(GENERAL, REFRESH_CHUNKS);
}
public boolean getMobHealthbarEnabled() {
return getBooleanValue(MOB_HEALTHBAR, ENABLED);
}
/* Mob Healthbar */
public MobHealthbarType getMobHealthbarDefault() {
try {
return MobHealthbarType.valueOf(getStringValue(MOB_HEALTHBAR, DISPLAY_TYPE, HEARTS).toUpperCase().trim());
} catch (IllegalArgumentException ex) {
return MobHealthbarType.HEARTS;
}
}
public int getMobHealthbarTime() {
return getIntValue(MOB_HEALTHBAR, DISPLAY_TIME);
}
/* Hardcore Mode */
public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) {
return getBooleanValue(HARDCORE, DEATH_STAT_LOSS, ENABLED, StringUtils.getCapitalized(primarySkillType.toString()));

View File

@ -1,6 +1,16 @@
package com.gmail.nossr50.config.hocon.mobs;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionCombat {
@Setting(value = "Mob-Health-Bars", comment = "Health bars appear over a mobs world model when they are damaged by a player," +
"\nTypically this is a visually representation of their health using hearts.")
private ConfigSectionHealthBars healthBars = new ConfigSectionHealthBars();
public ConfigSectionHealthBars getHealthBars() {
return healthBars;
}
}

View File

@ -1,6 +1,39 @@
package com.gmail.nossr50.config.hocon.mobs;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionHealthBars {
public static final boolean MOB_HEALTH_BARS_DEFAULT = true;
public static final int DISPLAY_TIME_SECONDS_DEFAULT = 3;
public static final String HEARTS = "HEARTS";
public static final String displayTypesList = "\nYou can use the following MobHealthBarType values: HEARTS, BAR";
@Setting(value = "Enable-Health-Bars", comment = "Turn this off to disable health bars appearing above mobs when damaged." +
"\nDefault value: "+MOB_HEALTH_BARS_DEFAULT)
private boolean enableHealthBars = MOB_HEALTH_BARS_DEFAULT;
@Setting(value = "Display-Bar-Type", comment = "The type of display to use for the mobs health bar." +
displayTypesList +
"\nDefault value: "+HEARTS)
private MobHealthbarType displayBarType = MobHealthbarType.HEARTS;
@Setting(value = "Display-Time-In-Seconds", comment = "How many seconds mob health bars should be displayed before being hidden." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
public boolean isEnableHealthBars() {
return enableHealthBars;
}
public MobHealthbarType getDisplayBarType() {
return displayBarType;
}
public int getDisplayTimeSeconds() {
return displayTimeSeconds;
}
}