mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 12:35:27 +02:00
Merge master into endgame branch to prepare merge for beta 2.2.000 update
This commit is contained in:
@@ -6,23 +6,20 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
private static AdvancedConfig instance;
|
||||
public class AdvancedConfig extends BukkitConfig {
|
||||
|
||||
private AdvancedConfig() {
|
||||
super("advanced.yml");
|
||||
public AdvancedConfig(File dataFolder) {
|
||||
super("advanced.yml", dataFolder);
|
||||
validate();
|
||||
}
|
||||
|
||||
public static AdvancedConfig getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new AdvancedConfig();
|
||||
}
|
||||
|
||||
return instance;
|
||||
@Override
|
||||
public void initDefaults() {
|
||||
config.addDefault("Skills.General.StartingLevel", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,15 +65,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!");
|
||||
}
|
||||
|
||||
/* ALCHEMY */
|
||||
/*if (getCatalysisUnlockLevel() < 0) {
|
||||
reason.add("Skills.Alchemy.Catalysis.UnlockLevel should be at least 0!");
|
||||
}
|
||||
|
||||
if (getCatalysisMaxBonusLevel() <= getCatalysisUnlockLevel()) {
|
||||
reason.add("Skills.Alchemy.Catalysis.MaxBonusLevel should be greater than Skills.Alchemy.Catalysis.UnlockLevel!");
|
||||
}*/
|
||||
|
||||
if (getCatalysisMinSpeed() <= 0) {
|
||||
reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!");
|
||||
}
|
||||
@@ -85,21 +73,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!");
|
||||
}
|
||||
|
||||
/*List<Alchemy.Tier> alchemyTierList = Arrays.asList(Alchemy.Tier.values());
|
||||
for (Alchemy.Tier tier : alchemyTierList) {
|
||||
if (getConcoctionsTierLevel(tier) < 0) {
|
||||
reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be at least 0!");
|
||||
}
|
||||
|
||||
if (tier != Alchemy.Tier.fromNumerical(Alchemy.Tier.values().length)) {
|
||||
Alchemy.Tier nextTier = alchemyTierList.get(alchemyTierList.indexOf(tier) - 1);
|
||||
|
||||
if (getConcoctionsTierLevel(tier) > getConcoctionsTierLevel(nextTier)) {
|
||||
reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Alchemy.Rank_Levels.Rank_" + nextrank + "!");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/* ARCHERY */
|
||||
|
||||
if (getSkillShotRankDamageMultiplier() <= 0) {
|
||||
@@ -131,8 +104,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* AXES */
|
||||
if(getAxeMasteryRankDamageMultiplier() < 0)
|
||||
{
|
||||
if (getAxeMasteryRankDamageMultiplier() < 0) {
|
||||
reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
|
||||
}
|
||||
|
||||
@@ -310,25 +282,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* SWORDS */
|
||||
if (getMaximumProbability(SubSkillType.SWORDS_RUPTURE) < 1) {
|
||||
reason.add("Skills.Swords.Rupture.ChanceMax should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaxBonusLevel(SubSkillType.SWORDS_RUPTURE) < 1) {
|
||||
reason.add("Skills.Swords.Rupture.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getRuptureMaxTicks() < 1) {
|
||||
reason.add("Skills.Swords.Rupture.MaxTicks should be at least 1!");
|
||||
}
|
||||
|
||||
if (getRuptureMaxTicks() < getRuptureBaseTicks()) {
|
||||
reason.add("Skills.Swords.Rupture.MaxTicks should be at least Skills.Swords.Rupture.BaseTicks!");
|
||||
}
|
||||
|
||||
if (getRuptureBaseTicks() < 1) {
|
||||
reason.add("Skills.Swords.Rupture.BaseTicks should be at least 1!");
|
||||
}
|
||||
|
||||
if (getMaximumProbability(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) {
|
||||
reason.add("Skills.Swords.CounterAttack.ChanceMax should be at least 1!");
|
||||
@@ -455,12 +408,18 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
protected void loadKeys() {
|
||||
}
|
||||
|
||||
/* GENERAL */
|
||||
|
||||
public boolean canApplyLimitBreakPVE() { return config.getBoolean("Skills.General.LimitBreak.AllowPVE", false); }
|
||||
public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 1); }
|
||||
public boolean canApplyLimitBreakPVE() {
|
||||
return config.getBoolean("Skills.General.LimitBreak.AllowPVE", false);
|
||||
}
|
||||
|
||||
public int getStartingLevel() {
|
||||
return config.getInt("Skills.General.StartingLevel", 1);
|
||||
}
|
||||
|
||||
public boolean allowPlayerTips() {
|
||||
return config.getBoolean("Feedback.PlayerTips", true);
|
||||
@@ -469,10 +428,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
/**
|
||||
* This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
|
||||
* It returns a different value depending on whether or not the server is in retro mode
|
||||
*
|
||||
* @return the level at which abilities stop increasing in length
|
||||
*/
|
||||
public int getAbilityLengthCap() {
|
||||
if(!mcMMO.isRetroModeEnabled())
|
||||
if (!mcMMO.isRetroModeEnabled())
|
||||
return config.getInt("Skills.General.Ability.Length.Standard.CapLevel", 50);
|
||||
else
|
||||
return config.getInt("Skills.General.Ability.Length.RetroMode.CapLevel", 500);
|
||||
@@ -481,27 +441,32 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
/**
|
||||
* This returns the frequency at which abilities will increase in length
|
||||
* It returns a different value depending on whether or not the server is in retro mode
|
||||
*
|
||||
* @return the number of levels required per ability length increase
|
||||
*/
|
||||
public int getAbilityLength() {
|
||||
if(!mcMMO.isRetroModeEnabled())
|
||||
if (!mcMMO.isRetroModeEnabled())
|
||||
return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5);
|
||||
else
|
||||
return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50);
|
||||
}
|
||||
|
||||
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
|
||||
public int getEnchantBuff() {
|
||||
return config.getInt("Skills.General.Ability.EnchantBuff", 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grabs the max bonus level for a skill used in RNG calculations
|
||||
* All max level values in the config are multiplied by 10 if the server is in retro mode as the values in the config are based around the new 1-100 skill system scaling
|
||||
* A value of 10 in the file will be returned as 100 for retro mode servers to accommodate the change in scaling
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
*
|
||||
* @return the level at which this skills max benefits will be reached on the curve
|
||||
*/
|
||||
public int getMaxBonusLevel(SubSkillType subSkillType) {
|
||||
String keyPath = subSkillType.getAdvConfigAddress() + ".MaxBonusLevel.";
|
||||
return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath+"RetroMode", 1000) : config.getInt(keyPath+"Standard", 100);
|
||||
return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath + "RetroMode", 1000) : config.getInt(keyPath + "Standard", 100);
|
||||
}
|
||||
|
||||
public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) {
|
||||
@@ -513,35 +478,29 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
return config.getDouble(subSkillType.getAdvConfigAddress() + ".ChanceMax", 100.0D);
|
||||
}
|
||||
|
||||
public double getMaximumProbability(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public double getMaximumProbability(AbstractSubSkill abstractSubSkill) {
|
||||
return getMaximumProbability(abstractSubSkill.getSubSkillType());
|
||||
}
|
||||
|
||||
/* Notification Settings */
|
||||
|
||||
public boolean doesSkillCommandSendBlankLines()
|
||||
{
|
||||
public boolean doesSkillCommandSendBlankLines() {
|
||||
return config.getBoolean("Feedback.SkillCommand.BlankLinesAboveHeader", true);
|
||||
}
|
||||
|
||||
public boolean doesNotificationUseActionBar(NotificationType notificationType)
|
||||
{
|
||||
return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled", true);
|
||||
public boolean doesNotificationUseActionBar(NotificationType notificationType) {
|
||||
return config.getBoolean("Feedback.ActionBarNotifications." + notificationType.toString() + ".Enabled", true);
|
||||
}
|
||||
|
||||
public boolean doesNotificationSendCopyToChat(NotificationType notificationType)
|
||||
{
|
||||
return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".SendCopyOfMessageToChat", false);
|
||||
public boolean doesNotificationSendCopyToChat(NotificationType notificationType) {
|
||||
return config.getBoolean("Feedback.ActionBarNotifications." + notificationType.toString() + ".SendCopyOfMessageToChat", false);
|
||||
}
|
||||
|
||||
public boolean useTitlesForXPEvent()
|
||||
{
|
||||
public boolean useTitlesForXPEvent() {
|
||||
return config.getBoolean("Feedback.Events.XP.SendTitles", true);
|
||||
}
|
||||
|
||||
public boolean sendAbilityNotificationToOtherPlayers()
|
||||
{
|
||||
public boolean sendAbilityNotificationToOtherPlayers() {
|
||||
return config.getBoolean("Feedback.Events.AbilityActivation.SendNotificationToOtherPlayers", true);
|
||||
}
|
||||
|
||||
@@ -560,6 +519,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Used to color our details header in our JSON Hover Object tooltips
|
||||
*
|
||||
* @return the ChatColor for this element
|
||||
*/
|
||||
/*public ChatColor getJSONStatHoverDetailsColor()
|
||||
@@ -608,7 +568,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
{
|
||||
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
|
||||
}*/
|
||||
|
||||
private ChatColor getChatColorFromKey(String keyLocation) {
|
||||
String colorName = config.getString(keyLocation);
|
||||
|
||||
@@ -649,174 +608,334 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Some SubSkills have the ability to retain classic functionality
|
||||
*
|
||||
* @param subSkillType SubSkillType with classic functionality
|
||||
*
|
||||
* @return true if the subskill is in classic mode
|
||||
*/
|
||||
public boolean isSubSkillClassic(SubSkillType subSkillType)
|
||||
{
|
||||
return config.getBoolean(subSkillType.getAdvConfigAddress()+".Classic");
|
||||
public boolean isSubSkillClassic(SubSkillType subSkillType) {
|
||||
return config.getBoolean(subSkillType.getAdvConfigAddress() + ".Classic");
|
||||
}
|
||||
|
||||
/* ACROBATICS */
|
||||
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
|
||||
public double getDodgeDamageModifier() {
|
||||
return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D); }
|
||||
public double getRollDamageThreshold() {
|
||||
return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D);
|
||||
}
|
||||
|
||||
public double getGracefulRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D); }
|
||||
public double getGracefulRollDamageThreshold() {
|
||||
return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D);
|
||||
}
|
||||
|
||||
/* ALCHEMY */
|
||||
/*public int getCatalysisUnlockLevel() { return config.getInt("Skills.Alchemy.Catalysis.UnlockLevel", 100); }*/
|
||||
public int getCatalysisMaxBonusLevel() { return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000); }
|
||||
public int getCatalysisMaxBonusLevel() {
|
||||
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000);
|
||||
}
|
||||
|
||||
public double getCatalysisMinSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D); }
|
||||
public double getCatalysisMaxSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D); }
|
||||
public double getCatalysisMinSpeed() {
|
||||
return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D);
|
||||
}
|
||||
|
||||
public double getCatalysisMaxSpeed() {
|
||||
return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D);
|
||||
}
|
||||
|
||||
//public int getConcoctionsTierLevel(Alchemy.Tier tier) { return config.getInt("Skills.Alchemy.Rank_Levels.Rank_" + rank); }
|
||||
|
||||
/* ARCHERY */
|
||||
public double getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
|
||||
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
|
||||
public double getSkillShotRankDamageMultiplier() {
|
||||
return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D);
|
||||
}
|
||||
|
||||
public double getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
|
||||
public double getSkillShotDamageMax() {
|
||||
return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D);
|
||||
}
|
||||
|
||||
public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
|
||||
public double getDazeBonusDamage() {
|
||||
return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D);
|
||||
}
|
||||
|
||||
public double getForceMultiplier() {
|
||||
return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D);
|
||||
}
|
||||
|
||||
/* AXES */
|
||||
public double getAxeMasteryRankDamageMultiplier() { return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D); }
|
||||
public double getAxeMasteryRankDamageMultiplier() {
|
||||
return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D);
|
||||
}
|
||||
|
||||
public double getCriticalStrikesPVPModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D); }
|
||||
public double getCriticalStrikesPVEModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D); }
|
||||
public double getCriticalStrikesPVPModifier() {
|
||||
return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D);
|
||||
}
|
||||
|
||||
public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D); }
|
||||
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D); }
|
||||
public double getGreaterImpactBonusDamage() { return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D); }
|
||||
public double getCriticalStrikesPVEModifier() {
|
||||
return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); }
|
||||
public double getImpactDurabilityDamageMultiplier() { return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D); }
|
||||
public double getGreaterImpactChance() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D);
|
||||
}
|
||||
|
||||
public double getSkullSplitterModifier() { return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D); }
|
||||
public double getGreaterImpactModifier() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D);
|
||||
}
|
||||
|
||||
public double getGreaterImpactBonusDamage() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D);
|
||||
}
|
||||
|
||||
public double getImpactChance() {
|
||||
return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D);
|
||||
}
|
||||
|
||||
public double getImpactDurabilityDamageMultiplier() {
|
||||
return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D);
|
||||
}
|
||||
|
||||
public double getSkullSplitterModifier() {
|
||||
return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
//Nothing to configure, everything is already configurable in config.yml
|
||||
|
||||
/* FISHING */
|
||||
//public int getFishingTierLevel(int rank) { return config.getInt("Skills.Fishing.Rank_Levels.Rank_" + rank); }
|
||||
public double getShakeChance(int rank) { return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank); }
|
||||
public int getFishingVanillaXPModifier(int rank) { return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank); }
|
||||
public double getShakeChance(int rank) {
|
||||
return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getFishingReductionMinWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Min_Wait", 10);}
|
||||
public int getFishingReductionMaxWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Max_Wait", 30);}
|
||||
public int getFishingBoatReductionMinWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Min_Wait", 10);}
|
||||
public int getFishingBoatReductionMaxWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Max_Wait", 30);}
|
||||
public int getFishingReductionMinWaitCap() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Min_Wait", 40);}
|
||||
public int getFishingReductionMaxWaitCap() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Max_Wait", 100);}
|
||||
public int getFishermanDietRankChange() { return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200); }
|
||||
public int getFishingVanillaXPModifier(int rank) {
|
||||
return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank);
|
||||
}
|
||||
|
||||
/*public int getIceFishingUnlockLevel() { return config.getInt("Skills.Fishing.IceFishing.UnlockLevel", 50); }
|
||||
public int getFishingReductionMinWaitTicks() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Min_Wait", 10);
|
||||
}
|
||||
|
||||
public int getMasterAnglerUnlockLevel() {return config.getInt("Skills.Fishing.MasterAngler.UnlockLevel", 125); }*/
|
||||
public double getMasterAnglerBoatModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0); }
|
||||
public double getMasterAnglerBiomeModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0); }
|
||||
public int getFishingReductionMaxWaitTicks() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Max_Wait", 30);
|
||||
}
|
||||
|
||||
public int getFishingBoatReductionMinWaitTicks() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Min_Wait", 10);
|
||||
}
|
||||
|
||||
public int getFishingBoatReductionMaxWaitTicks() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Max_Wait", 30);
|
||||
}
|
||||
|
||||
public int getFishingReductionMinWaitCap() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Min_Wait", 40);
|
||||
}
|
||||
|
||||
public int getFishingReductionMaxWaitCap() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Max_Wait", 100);
|
||||
}
|
||||
|
||||
public int getFishermanDietRankChange() {
|
||||
return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200);
|
||||
}
|
||||
|
||||
|
||||
public double getMasterAnglerBoatModifier() {
|
||||
return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0);
|
||||
}
|
||||
|
||||
public double getMasterAnglerBiomeModifier() {
|
||||
return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0);
|
||||
}
|
||||
|
||||
/* HERBALISM */
|
||||
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200); }
|
||||
public int getFarmerDietRankChange() {
|
||||
return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200);
|
||||
}
|
||||
|
||||
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200); }
|
||||
public int getGreenThumbStageChange() {
|
||||
return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200);
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
public boolean getDoubleDropSilkTouchEnabled() { return config.getBoolean("Skills.Mining.DoubleDrops.SilkTouch", true); }
|
||||
public boolean getAllowMiningTripleDrops() { return config.getBoolean("Skills.Mining.SuperBreaker.AllowTripleDrops", true); }
|
||||
public int getBlastMiningRankLevel(int rank) { return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank); }
|
||||
public double getBlastDamageDecrease(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank); }
|
||||
public double getOreBonus(int rank) { return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank); }
|
||||
public double getDebrisReduction(int rank) { return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank); }
|
||||
public int getDropMultiplier(int rank) { return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank); }
|
||||
public double getBlastRadiusModifier(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank); }
|
||||
public boolean getDoubleDropSilkTouchEnabled() {
|
||||
return config.getBoolean("Skills.Mining.DoubleDrops.SilkTouch", true);
|
||||
}
|
||||
|
||||
public boolean getAllowMiningTripleDrops() {
|
||||
return config.getBoolean("Skills.Mining.SuperBreaker.AllowTripleDrops", true);
|
||||
}
|
||||
|
||||
public int getBlastMiningRankLevel(int rank) {
|
||||
return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getBlastDamageDecrease(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getOreBonus(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getDebrisReduction(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getDropMultiplier(int rank) {
|
||||
return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getBlastRadiusModifier(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank);
|
||||
}
|
||||
|
||||
/* REPAIR */
|
||||
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
|
||||
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100); }
|
||||
public double getRepairMasteryMaxBonus() {
|
||||
return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D);
|
||||
}
|
||||
|
||||
/* Arcane Forging */
|
||||
//public int getArcaneForgingRankLevel(int rank) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank); }
|
||||
public int getRepairMasteryMaxLevel() {
|
||||
return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100);
|
||||
}
|
||||
|
||||
public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true); }
|
||||
public double getArcaneForgingKeepEnchantsChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank); }
|
||||
public boolean getAllowEnchantedRepairMaterials() {
|
||||
return config.getBoolean("Skills.Repair.Use_Enchanted_Materials", false);
|
||||
}
|
||||
|
||||
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); }
|
||||
public double getArcaneForgingDowngradeChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank); }
|
||||
public boolean getArcaneForgingEnchantLossEnabled() {
|
||||
return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true);
|
||||
}
|
||||
|
||||
/* SALVAGE */
|
||||
//public double getSalvageMaxPercentage() { return config.getDouble("Skills.Salvage.MaxPercentage", 100.0D); }
|
||||
//public int getSalvageMaxPercentageLevel() { return config.getInt("Skills.Salvage.MaxPercentageLevel", 1000); }
|
||||
public double getArcaneForgingKeepEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank);
|
||||
}
|
||||
|
||||
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); }
|
||||
public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); }
|
||||
public boolean getArcaneForgingDowngradeEnabled() {
|
||||
return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true);
|
||||
}
|
||||
|
||||
//public int getArcaneSalvageRankLevel(int rank) { return config.getInt("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + rank); }
|
||||
public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank); }
|
||||
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); }
|
||||
public double getArcaneForgingDowngradeChance(int rank) {
|
||||
return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank);
|
||||
}
|
||||
|
||||
public boolean getArcaneSalvageEnchantDowngradeEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true);
|
||||
}
|
||||
|
||||
public boolean getArcaneSalvageEnchantLossEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true);
|
||||
}
|
||||
|
||||
public double getArcaneSalvageExtractFullEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank);
|
||||
}
|
||||
|
||||
/* SMELTING */
|
||||
public int getBurnModifierMaxLevel() {
|
||||
if(mcMMO.isRetroModeEnabled())
|
||||
if (mcMMO.isRetroModeEnabled())
|
||||
return config.getInt("Skills.Smelting.FuelEfficiency.RetroMode.MaxBonusLevel", 1000);
|
||||
else
|
||||
return config.getInt("Skills.Smelting.FuelEfficiency.Standard.MaxBonusLevel", 100);
|
||||
}
|
||||
|
||||
/*public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); }*/
|
||||
public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); }
|
||||
|
||||
public int getSmeltingRankLevel(int rank) { return config.getInt("Skills.Smelting.Rank_Levels.Rank_" + rank); }
|
||||
|
||||
public int getSmeltingVanillaXPBoostMultiplier(int rank) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank); }
|
||||
public double getFluxMiningChance() {
|
||||
return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D);
|
||||
}
|
||||
|
||||
/* SWORDS */
|
||||
public double getRuptureDamagePlayer() { return config.getDouble("Skills.Swords.Rupture.DamagePlayer", 1.0); }
|
||||
public double getRuptureDamageMobs() { return config.getDouble("Skills.Swords.Rupture.DamageMobs", 2.0); }
|
||||
public double getRuptureTickDamage(boolean isTargetPlayer, int rank) {
|
||||
String root = "Skills.Swords.Rupture.Rupture_Mechanics.Tick_Interval_Damage.Against_";
|
||||
String targetType = isTargetPlayer ? "Players" : "Mobs";
|
||||
String key = root + targetType + ".Rank_" + rank;
|
||||
|
||||
public int getRuptureMaxTicks() { return config.getInt("Skills.Swords.Rupture.MaxTicks", 8); }
|
||||
public int getRuptureBaseTicks() { return config.getInt("Skills.Swords.Rupture.BaseTicks", 2); }
|
||||
return config.getDouble(key, 1.0D);
|
||||
}
|
||||
|
||||
public double getCounterModifier() { return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D); }
|
||||
public int getRuptureDurationSeconds(boolean isTargetPlayer) {
|
||||
String root = "Skills.Swords.Rupture.Rupture_Mechanics.Duration_In_Seconds.Against_";
|
||||
String targetType = isTargetPlayer ? "Players" : "Mobs";
|
||||
return config.getInt(root + targetType, 5);
|
||||
}
|
||||
|
||||
public double getSerratedStrikesModifier() { return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D); }
|
||||
public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5); }
|
||||
public double getRuptureExplosionDamage(boolean isTargetPlayer, int rank) {
|
||||
String root = "Skills.Swords.Rupture.Rupture_Mechanics.Explosion_Damage.Against_";
|
||||
String targetType = isTargetPlayer ? "Players" : "Mobs";
|
||||
String key = root + targetType + ".Rank_" + rank;
|
||||
|
||||
return config.getDouble(key, 40.0D);
|
||||
}
|
||||
|
||||
public double getRuptureChanceToApplyOnHit(int rank) {
|
||||
String root = "Skills.Swords.Rupture.Rupture_Mechanics.Chance_To_Apply_On_Hit.Rank_";
|
||||
return config.getDouble(root + rank, 33);
|
||||
}
|
||||
|
||||
public double getCounterModifier() {
|
||||
return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getSerratedStrikesModifier() {
|
||||
return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D);
|
||||
}
|
||||
|
||||
public int getSerratedStrikesTicks() {
|
||||
return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5);
|
||||
}
|
||||
|
||||
/* TAMING */
|
||||
//public int getGoreRuptureTicks() { return config.getInt("Skills.Taming.Gore.RuptureTicks", 2); }
|
||||
public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); }
|
||||
public double getGoreModifier() {
|
||||
return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D);
|
||||
}
|
||||
|
||||
/*public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood.UnlockLevel", 50); }*/
|
||||
public double getFastFoodChance() { return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D); }
|
||||
public double getPummelChance() { return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D); }
|
||||
public double getFastFoodChance() {
|
||||
return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D);
|
||||
}
|
||||
|
||||
//public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware.UnlockLevel", 100); }
|
||||
public double getPummelChance() {
|
||||
return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D);
|
||||
}
|
||||
|
||||
/*public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur.UnlockLevel", 250); }*/
|
||||
public double getThickFurModifier() { return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D); }
|
||||
public double getThickFurModifier() {
|
||||
return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D);
|
||||
}
|
||||
|
||||
/*public int getHolyHoundUnlock() {return config.getInt("Skills.Taming.HolyHound.UnlockLevel", 375); }*/
|
||||
public double getShockProofModifier() {
|
||||
return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D);
|
||||
}
|
||||
|
||||
/*public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof.UnlockLevel", 500); }*/
|
||||
public double getShockProofModifier() { return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D); }
|
||||
public double getSharpenedClawsBonus() {
|
||||
return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D);
|
||||
}
|
||||
|
||||
/*public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); }*/
|
||||
public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); }
|
||||
public double getMinHorseJumpStrength() {
|
||||
return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D);
|
||||
}
|
||||
|
||||
public double getMinHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D); }
|
||||
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
|
||||
public double getMaxHorseJumpStrength() {
|
||||
return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D);
|
||||
}
|
||||
|
||||
/* UNARMED */
|
||||
|
||||
public boolean isSteelArmDamageCustom() { return config.getBoolean("Skills.Unarmed.SteelArmStyle.Damage_Override", false); }
|
||||
public boolean isSteelArmDamageCustom() {
|
||||
return config.getBoolean("Skills.Unarmed.SteelArmStyle.Damage_Override", false);
|
||||
}
|
||||
|
||||
public double getSteelArmOverride(int rank, double def) {
|
||||
String key = "Rank_" + rank;
|
||||
return config.getDouble("Skills.Unarmed.SteelArmStyle.Override." + key, def);
|
||||
}
|
||||
public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); }
|
||||
|
||||
public boolean getDisarmProtected() {
|
||||
return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false);
|
||||
}
|
||||
|
||||
/* WOODCUTTING */
|
||||
public boolean isKnockOnWoodXPOrbEnabled() { return config.getBoolean("Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops", true); }
|
||||
public boolean isKnockOnWoodXPOrbEnabled() {
|
||||
return config.getBoolean("Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops", true);
|
||||
}
|
||||
}
|
||||
|
@@ -1,27 +1,38 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
public AutoUpdateConfigLoader(String relativePath, String fileName, File dataFolder) {
|
||||
super(relativePath, fileName, dataFolder);
|
||||
}
|
||||
|
||||
public AutoUpdateConfigLoader(String fileName, File dataFolder) {
|
||||
super(fileName, dataFolder);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AutoUpdateConfigLoader(String relativePath, String fileName) {
|
||||
super(relativePath, fileName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AutoUpdateConfigLoader(String fileName) {
|
||||
super(fileName);
|
||||
}
|
||||
|
||||
protected void saveConfig() {
|
||||
try {
|
||||
plugin.getLogger().info("Saving changes to config file - "+fileName);
|
||||
mcMMO.p.getLogger().info("Saving changes to config file - " + fileName);
|
||||
config.options().indent(2);
|
||||
config.save(configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -29,119 +40,64 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
}
|
||||
|
||||
protected @NotNull FileConfiguration getInternalConfig() {
|
||||
return YamlConfiguration.loadConfiguration(plugin.getResourceAsReader(fileName));
|
||||
return YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader(fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadFile() {
|
||||
super.loadFile();
|
||||
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResourceAsReader(fileName));
|
||||
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader(fileName));
|
||||
|
||||
Set<String> configKeys = config.getKeys(true);
|
||||
Set<String> internalConfigKeys = internalConfig.getKeys(true);
|
||||
|
||||
boolean needSave = false;
|
||||
|
||||
// keys present in current config file that are not in the template
|
||||
Set<String> oldKeys = new HashSet<>(configKeys);
|
||||
oldKeys.removeAll(internalConfigKeys);
|
||||
|
||||
if (!oldKeys.isEmpty()) {
|
||||
mcMMO.p.debug("old key(s) in \"" + fileName + "\"");
|
||||
for (String key : oldKeys) {
|
||||
mcMMO.p.debug(" old-key:" + key);
|
||||
}
|
||||
}
|
||||
|
||||
// keys present in template that are not in current file
|
||||
Set<String> newKeys = new HashSet<>(internalConfigKeys);
|
||||
newKeys.removeAll(configKeys);
|
||||
|
||||
// Don't need a re-save if we have old keys sticking around?
|
||||
// Would be less saving, but less... correct?
|
||||
if (!newKeys.isEmpty() || !oldKeys.isEmpty()) {
|
||||
if (!newKeys.isEmpty()) {
|
||||
needSave = true;
|
||||
}
|
||||
|
||||
for (String key : oldKeys) {
|
||||
plugin.debug("Detected potentially unused key: " + key);
|
||||
//config.set(key, null);
|
||||
}
|
||||
|
||||
for (String key : newKeys) {
|
||||
plugin.debug("Adding new key: " + key + " = " + internalConfig.get(key));
|
||||
mcMMO.p.debug("Adding new key: " + key + " = " + internalConfig.get(key));
|
||||
config.set(key, internalConfig.get(key));
|
||||
}
|
||||
|
||||
if (needSave) {
|
||||
// Get Bukkit's version of an acceptable config with new keys, and no old keys
|
||||
String output = config.saveToString();
|
||||
|
||||
// Convert to the superior 4 space indentation
|
||||
output = output.replace(" ", " ");
|
||||
|
||||
// Rip out Bukkit's attempt to save comments at the top of the file
|
||||
while (output.replaceAll("[//s]", "").startsWith("#")) {
|
||||
output = output.substring(output.indexOf('\n', output.indexOf('#')) + 1);
|
||||
}
|
||||
|
||||
// Read the internal config to get comments, then put them in the new one
|
||||
try {
|
||||
// Read internal
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getResource(fileName)));
|
||||
LinkedHashMap<String, String> comments = new LinkedHashMap<>();
|
||||
StringBuilder temp = new StringBuilder();
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.contains("#")) {
|
||||
temp.append(line).append("\n");
|
||||
}
|
||||
else if (line.contains(":")) {
|
||||
line = line.substring(0, line.indexOf(":") + 1);
|
||||
if (temp.length() > 0) {
|
||||
if(comments.containsKey(line)) {
|
||||
int index = 0;
|
||||
while(comments.containsKey(line + index)) {
|
||||
index++;
|
||||
}
|
||||
|
||||
line = line + index;
|
||||
}
|
||||
|
||||
comments.put(line, temp.toString());
|
||||
temp = new StringBuilder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dump to the new one
|
||||
HashMap<String, Integer> indexed = new HashMap<>();
|
||||
for (String key : comments.keySet()) {
|
||||
String actualkey = key.substring(0, key.indexOf(":") + 1);
|
||||
|
||||
int index = 0;
|
||||
if(indexed.containsKey(actualkey)) {
|
||||
index = indexed.get(actualkey);
|
||||
}
|
||||
boolean isAtTop = !output.contains("\n" + actualkey);
|
||||
index = output.indexOf((isAtTop ? "" : "\n") + actualkey, index);
|
||||
|
||||
if (index >= 0) {
|
||||
output = output.substring(0, index) + "\n" + comments.get(key) + output.substring(isAtTop ? index : index + 1);
|
||||
indexed.put(actualkey, index + comments.get(key).length() + actualkey.length() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Save it
|
||||
|
||||
if (dataFolder == null) {
|
||||
mcMMO.p.getLogger().severe("Data folder should never be null!");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String saveName = fileName;
|
||||
// At this stage we cannot guarantee that Config has been loaded, so we do the check directly here
|
||||
if (!plugin.getConfig().getBoolean("General.Config_Update_Overwrite", true)) {
|
||||
if (!mcMMO.p.getConfig().getBoolean("General.Config_Update_Overwrite", true)) {
|
||||
saveName += ".new";
|
||||
}
|
||||
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(plugin.getDataFolder(), saveName)));
|
||||
writer.write(output);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
File newSaveFile = new File(dataFolder, saveName);
|
||||
YamlConfiguration yamlConfiguration = config;
|
||||
yamlConfiguration.options().indent(4);
|
||||
yamlConfiguration.save(newSaveFile);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
220
src/main/java/com/gmail/nossr50/config/BukkitConfig.java
Normal file
220
src/main/java/com/gmail/nossr50/config/BukkitConfig.java
Normal file
@@ -0,0 +1,220 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class BukkitConfig {
|
||||
public static final String CONFIG_PATCH_PREFIX = "ConfigPatchVersion:";
|
||||
public static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 2";
|
||||
public static final char COMMENT_PREFIX = '#';
|
||||
protected final String fileName;
|
||||
protected final File configFile;
|
||||
protected YamlConfiguration config;
|
||||
protected @NotNull
|
||||
final File dataFolder;
|
||||
|
||||
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
|
||||
mcMMO.p.getLogger().info("[config] Initializing config: " + fileName);
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, fileName);
|
||||
// purgeComments(true);
|
||||
this.config = initConfig();
|
||||
initDefaults();
|
||||
updateFile();
|
||||
mcMMO.p.getLogger().info("[config] Config initialized: " + fileName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public BukkitConfig(@NotNull String fileName) {
|
||||
this(fileName, mcMMO.p.getDataFolder());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize default values for the config
|
||||
*/
|
||||
public void initDefaults() {}
|
||||
|
||||
/**
|
||||
* Update the file on the disk by copying out any new and missing defaults
|
||||
*/
|
||||
public void updateFile() {
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private YamlConfiguration initConfig() {
|
||||
if (!configFile.exists()) {
|
||||
mcMMO.p.getLogger().info("[config] User config file not found, copying a default config to disk: " + fileName);
|
||||
mcMMO.p.saveResource(fileName, false);
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("[config] Loading config from disk: " + fileName);
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.options().indent(4);
|
||||
|
||||
try {
|
||||
config.options().parseComments(true);
|
||||
} catch (NoSuchMethodError e) {
|
||||
//e.printStackTrace();
|
||||
// mcMMO.p.getLogger().severe("Your Spigot/CraftBukkit API is out of date, update your server software!");
|
||||
}
|
||||
|
||||
config.options().copyDefaults(true);
|
||||
|
||||
try {
|
||||
config.load(configFile);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
protected abstract void loadKeys();
|
||||
|
||||
protected boolean validateKeys() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean noErrorsInConfig(List<String> issues) {
|
||||
for (String issue : issues) {
|
||||
mcMMO.p.getLogger().warning(issue);
|
||||
}
|
||||
|
||||
return issues.isEmpty();
|
||||
}
|
||||
|
||||
protected void validate() {
|
||||
if (validateKeys()) {
|
||||
mcMMO.p.debug("No errors found in " + fileName + "!");
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
||||
mcMMO.p.noErrorsInConfigFiles = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void backup() {
|
||||
mcMMO.p.getLogger().severe("You are using an old version of the " + fileName + " file.");
|
||||
mcMMO.p.getLogger().severe("Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
|
||||
|
||||
configFile.renameTo(new File(configFile.getPath() + ".old"));
|
||||
|
||||
if (mcMMO.p.getResource(fileName) != null) {
|
||||
mcMMO.p.saveResource(fileName, true);
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().warning("Reloading " + fileName + " with new values...");
|
||||
initConfig();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return configFile;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Somewhere between December 2021-January 2022 Spigot updated their
|
||||
// * SnakeYAML dependency/API and due to our own crappy legacy code
|
||||
// * this introduced a very problematic bug where comments got duplicated
|
||||
// * <p>
|
||||
// * This method hotfixes the problem by just deleting any existing comments
|
||||
// * it's ugly, but it gets the job done
|
||||
// *
|
||||
// * @param silentFail when true mcMMO will report errors during the patch process or debug information
|
||||
// * the option to have it fail silently is because mcMMO wants to check files before they are parsed as a file with a zillion comments will fail to even load
|
||||
// */
|
||||
// private void purgeComments(boolean silentFail) {
|
||||
// if(!configFile.exists())
|
||||
// return;
|
||||
//
|
||||
// int dupedLines = 0, lineCount = 0, lineCountAfter = 0;
|
||||
// try (FileReader fileReader = new FileReader(configFile);
|
||||
// BufferedReader bufferedReader = new BufferedReader(fileReader)) {
|
||||
// StringBuilder stringBuilder = new StringBuilder();
|
||||
// String line;
|
||||
// Set<String> seenBefore = new HashSet<>();
|
||||
//
|
||||
// stringBuilder.append(CURRENT_CONFIG_PATCH_VER).append(System.lineSeparator());
|
||||
// boolean noPatchNeeded = false;
|
||||
//
|
||||
// // While not at the end of the file
|
||||
// while ((line = bufferedReader.readLine()) != null) {
|
||||
// lineCount++;
|
||||
//
|
||||
// if(line.startsWith(CURRENT_CONFIG_PATCH_VER)) {
|
||||
// noPatchNeeded = true;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// //Older version, don't append this line
|
||||
// if(line.startsWith(CONFIG_PATCH_PREFIX))
|
||||
// continue;
|
||||
//
|
||||
// if (isFirstCharAsciiCharacter(line, COMMENT_PREFIX)) {
|
||||
// if(seenBefore.contains(line))
|
||||
// dupedLines++;
|
||||
// else
|
||||
// seenBefore.add(line);
|
||||
//
|
||||
// continue; //Delete the line by not appending it
|
||||
// }
|
||||
//
|
||||
// stringBuilder
|
||||
// .append(line) //Convert existing files into two-spaced format
|
||||
// .append(System.lineSeparator());
|
||||
// lineCountAfter++;
|
||||
// }
|
||||
//
|
||||
// if(noPatchNeeded)
|
||||
// return;
|
||||
//
|
||||
// if(lineCount == 0 && !silentFail) {
|
||||
// mcMMO.p.getLogger().info("[config patcher] Config line count: " + lineCount);
|
||||
// throw new InvalidConfigurationException("[config patcher] Patching of config file resulted in an empty file, this will not be saved. Contact the mcMMO devs!");
|
||||
// }
|
||||
//
|
||||
// if(dupedLines > 0 && !silentFail) {
|
||||
// mcMMO.p.getLogger().info("[config patcher] Found "+dupedLines+" duplicate comments in config file: " + configFile.getName());
|
||||
// mcMMO.p.getLogger().info("[config patcher] Purging the duplicate comments... (Nothing is broken, this is just info used for debugging)");
|
||||
// mcMMO.p.getLogger().info("[config patcher] Line count before: "+lineCount);
|
||||
// mcMMO.p.getLogger().info("[config patcher] Line count after: "+lineCountAfter);
|
||||
// }
|
||||
//
|
||||
// // Write out the *patched* file
|
||||
// // AKA the file without any comments
|
||||
// try (FileWriter fileWriter = new FileWriter(configFile)) {
|
||||
// fileWriter.write(stringBuilder.toString());
|
||||
// }
|
||||
// } catch (IOException | InvalidConfigurationException ex) {
|
||||
// mcMMO.p.getLogger().severe("Failed to patch config file: " + configFile.getName());
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
private boolean isFirstCharAsciiCharacter(String line, char character) {
|
||||
if(line == null || line.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for(Character c : line.toCharArray()) {
|
||||
if(c.equals(' '))
|
||||
continue;
|
||||
|
||||
return c.equals(character);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ChatConfig extends AutoUpdateConfigLoader {
|
||||
public class ChatConfig extends BukkitConfig {
|
||||
private static ChatConfig instance;
|
||||
|
||||
private ChatConfig() {
|
||||
@@ -41,7 +41,9 @@ public class ChatConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Whether or not to use display names for players in target {@link ChatChannel}
|
||||
*
|
||||
* @param chatChannel target chat channel
|
||||
*
|
||||
* @return true if display names should be used
|
||||
*/
|
||||
public boolean useDisplayNames(@NotNull ChatChannel chatChannel) {
|
||||
|
@@ -1,43 +1,59 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ConfigLoader {
|
||||
protected static final mcMMO plugin = mcMMO.p;
|
||||
protected String fileName;
|
||||
protected final File configFile;
|
||||
protected FileConfiguration config;
|
||||
protected final @NotNull File dataFolder;
|
||||
protected String fileName;
|
||||
protected YamlConfiguration config;
|
||||
|
||||
public ConfigLoader(String relativePath, String fileName) {
|
||||
public ConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName);
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, relativePath + File.separator + fileName);
|
||||
loadFile();
|
||||
}
|
||||
|
||||
public ConfigLoader(String fileName, @NotNull File dataFolder) {
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, fileName);
|
||||
loadFile();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConfigLoader(String relativePath, String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(mcMMO.p.getDataFolder(), relativePath + File.separator + fileName);
|
||||
this.dataFolder = mcMMO.p.getDataFolder();
|
||||
loadFile();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConfigLoader(String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(plugin.getDataFolder(), fileName);
|
||||
configFile = new File(mcMMO.p.getDataFolder(), fileName);
|
||||
this.dataFolder = mcMMO.p.getDataFolder();
|
||||
loadFile();
|
||||
}
|
||||
|
||||
protected void loadFile() {
|
||||
if (!configFile.exists()) {
|
||||
plugin.debug("Creating mcMMO " + fileName + " File...");
|
||||
mcMMO.p.getLogger().info("Creating mcMMO " + fileName + " File...");
|
||||
|
||||
try {
|
||||
plugin.saveResource(fileName, false); // Normal files
|
||||
mcMMO.p.saveResource(fileName, false); // Normal files
|
||||
} catch (IllegalArgumentException ex) {
|
||||
mcMMO.p.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
plugin.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files
|
||||
}
|
||||
}
|
||||
else {
|
||||
plugin.debug("Loading mcMMO " + fileName + " File...");
|
||||
} else {
|
||||
mcMMO.p.getLogger().info("Loading mcMMO " + fileName + " File...");
|
||||
}
|
||||
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
@@ -51,7 +67,7 @@ public abstract class ConfigLoader {
|
||||
|
||||
protected boolean noErrorsInConfig(List<String> issues) {
|
||||
for (String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
mcMMO.p.getLogger().warning(issue);
|
||||
}
|
||||
|
||||
return issues.isEmpty();
|
||||
@@ -59,12 +75,11 @@ public abstract class ConfigLoader {
|
||||
|
||||
protected void validate() {
|
||||
if (validateKeys()) {
|
||||
plugin.debug("No errors found in " + fileName + "!");
|
||||
}
|
||||
else {
|
||||
plugin.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||
plugin.getServer().getPluginManager().disablePlugin(plugin);
|
||||
plugin.noErrorsInConfigFiles = false;
|
||||
mcMMO.p.debug("No errors found in " + fileName + "!");
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
||||
mcMMO.p.noErrorsInConfigFiles = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,16 +88,16 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
|
||||
public void backup() {
|
||||
plugin.getLogger().warning("You are using an old version of the " + fileName + " file.");
|
||||
plugin.getLogger().warning("Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
|
||||
mcMMO.p.getLogger().warning("You are using an old version of the " + fileName + " file.");
|
||||
mcMMO.p.getLogger().warning("Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
|
||||
|
||||
configFile.renameTo(new File(configFile.getPath() + ".old"));
|
||||
|
||||
if (plugin.getResource(fileName) != null) {
|
||||
plugin.saveResource(fileName, true);
|
||||
if (mcMMO.p.getResource(fileName) != null) {
|
||||
mcMMO.p.saveResource(fileName, true);
|
||||
}
|
||||
|
||||
plugin.getLogger().warning("Reloading " + fileName + " with new values...");
|
||||
mcMMO.p.getLogger().warning("Reloading " + fileName + " with new values...");
|
||||
loadFile();
|
||||
loadKeys();
|
||||
}
|
||||
|
@@ -4,28 +4,26 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
|
||||
public class CoreSkillsConfig extends AutoUpdateConfigLoader {
|
||||
public class CoreSkillsConfig extends BukkitConfig {
|
||||
private static CoreSkillsConfig instance;
|
||||
|
||||
public CoreSkillsConfig()
|
||||
{
|
||||
public CoreSkillsConfig() {
|
||||
super("coreskills.yml");
|
||||
validate();
|
||||
}
|
||||
|
||||
public static CoreSkillsConfig getInstance() {
|
||||
if (instance == null)
|
||||
instance = new CoreSkillsConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static CoreSkillsConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
return new CoreSkillsConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
|
||||
@@ -39,21 +37,23 @@ public class CoreSkillsConfig extends AutoUpdateConfigLoader {
|
||||
/**
|
||||
* Whether or not a skill is enabled
|
||||
* Defaults true
|
||||
*
|
||||
* @param abstractSubSkill SubSkill definition to check
|
||||
*
|
||||
* @return true if subskill is enabled
|
||||
*/
|
||||
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
return config.getBoolean(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString())+"."+ abstractSubSkill.getConfigKeyName()+".Enabled", true);
|
||||
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill) {
|
||||
return config.getBoolean(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()) + "." + abstractSubSkill.getConfigKeyName() + ".Enabled", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not this primary skill is enabled
|
||||
*
|
||||
* @param primarySkillType target primary skill
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType)
|
||||
{
|
||||
return config.getBoolean(StringUtils.getCapitalized(primarySkillType.toString())+".Enabled", true);
|
||||
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
|
||||
return config.getBoolean(StringUtils.getCapitalized(primarySkillType.toString()) + ".Enabled", true);
|
||||
}
|
||||
}
|
||||
|
1008
src/main/java/com/gmail/nossr50/config/GeneralConfig.java
Normal file
1008
src/main/java/com/gmail/nossr50/config/GeneralConfig.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,6 @@ public class HiddenConfig {
|
||||
private static HiddenConfig instance;
|
||||
private final String fileName;
|
||||
private YamlConfiguration config;
|
||||
private boolean chunkletsEnabled;
|
||||
private int conversionRate;
|
||||
private boolean useEnchantmentBuffs;
|
||||
|
||||
@@ -30,15 +29,11 @@ public class HiddenConfig {
|
||||
InputStreamReader reader = mcMMO.p.getResourceAsReader(fileName);
|
||||
if (reader != null) {
|
||||
config = YamlConfiguration.loadConfiguration(reader);
|
||||
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
|
||||
conversionRate = config.getInt("Options.ConversionRate", 1);
|
||||
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getChunkletsEnabled() {
|
||||
return chunkletsEnabled;
|
||||
}
|
||||
|
||||
public int getConversionRate() {
|
||||
return conversionRate;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.util.compat.layers.persistentdata.MobMetaFlagType;
|
||||
import com.gmail.nossr50.metadata.MobMetaFlagType;
|
||||
|
||||
public class PersistentDataConfig extends AutoUpdateConfigLoader {
|
||||
public class PersistentDataConfig extends BukkitConfig {
|
||||
private static PersistentDataConfig instance;
|
||||
|
||||
private PersistentDataConfig() {
|
||||
@@ -34,4 +34,9 @@ public class PersistentDataConfig extends AutoUpdateConfigLoader {
|
||||
return config.getBoolean(key, false);
|
||||
}
|
||||
|
||||
public boolean useBlockTracker() {
|
||||
return config.getBoolean("mcMMO_Region_System.Enabled", true);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -2,6 +2,7 @@ package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -11,26 +12,24 @@ import java.util.List;
|
||||
public class RankConfig extends AutoUpdateConfigLoader {
|
||||
private static RankConfig instance;
|
||||
|
||||
public RankConfig()
|
||||
{
|
||||
public RankConfig() {
|
||||
super("skillranks.yml");
|
||||
validate();
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static RankConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
public static RankConfig getInstance() {
|
||||
if (instance == null)
|
||||
return new RankConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
List<String> reason = new ArrayList<>();
|
||||
@@ -45,12 +44,13 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
* @param rank the rank we are checking
|
||||
* @param rank the rank we are checking
|
||||
*
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank)
|
||||
{
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank) {
|
||||
String key = subSkillType.getRankConfigAddress();
|
||||
|
||||
return findRankByRootAddress(rank, key);
|
||||
@@ -58,37 +58,41 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
* @param rank the rank we are checking
|
||||
* @param rank the rank we are checking
|
||||
*
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank, boolean retroMode)
|
||||
{
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank, boolean retroMode) {
|
||||
String key = getRankAddressKey(subSkillType, rank, retroMode);
|
||||
return config.getInt(key, getInternalConfig().getInt(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
*
|
||||
* @param abstractSubSkill target subskill
|
||||
* @param rank the rank we are checking
|
||||
* @param rank the rank we are checking
|
||||
*
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(AbstractSubSkill abstractSubSkill, int rank)
|
||||
{
|
||||
String key = abstractSubSkill.getPrimaryKeyName()+"."+abstractSubSkill.getConfigKeyName();
|
||||
public int getSubSkillUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
String key = abstractSubSkill.getPrimaryKeyName() + "." + abstractSubSkill.getConfigKeyName();
|
||||
|
||||
return findRankByRootAddress(rank, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
* @param key root address of the subskill in the rankskills.yml file
|
||||
*
|
||||
* @param key root address of the subskill in the rankskills.yml file
|
||||
* @param rank the rank we are checking
|
||||
*
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
private int findRankByRootAddress(int rank, String key) {
|
||||
String scalingKey = Config.getInstance().getIsRetroMode() ? ".RetroMode." : ".Standard.";
|
||||
String scalingKey = mcMMO.p.getGeneralConfig().getIsRetroMode() ? ".RetroMode." : ".Standard.";
|
||||
|
||||
String targetRank = "Rank_" + rank;
|
||||
|
||||
@@ -126,60 +130,55 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
String key = getRankAddressKey(subSkillType, rank, retroMode);
|
||||
int defaultValue = getInternalConfig().getInt(key);
|
||||
config.set(key, defaultValue);
|
||||
plugin.getLogger().info(key +" SET -> " + defaultValue);
|
||||
mcMMO.p.getLogger().info(key + " SET -> " + defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for valid keys for subskill ranks
|
||||
*/
|
||||
private void checkKeys(@NotNull List<String> reasons)
|
||||
{
|
||||
private void checkKeys(@NotNull List<String> reasons) {
|
||||
HashSet<SubSkillType> badSkillSetup = new HashSet<>();
|
||||
|
||||
|
||||
//For now we will only check ranks of stuff I've overhauled
|
||||
checkConfig(reasons, badSkillSetup, true);
|
||||
checkConfig(reasons, badSkillSetup, false);
|
||||
|
||||
//Fix bad entries
|
||||
if(badSkillSetup.isEmpty())
|
||||
if (badSkillSetup.isEmpty())
|
||||
return;
|
||||
|
||||
plugin.getLogger().info("(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
|
||||
mcMMO.p.getLogger().info("(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
|
||||
|
||||
for(SubSkillType subSkillType : badSkillSetup) {
|
||||
plugin.getLogger().info("(FIXING CONFIG) Resetting rank config settings for skill named - "+subSkillType.toString());
|
||||
for (SubSkillType subSkillType : badSkillSetup) {
|
||||
mcMMO.p.getLogger().info("(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString());
|
||||
fixBadEntries(subSkillType);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkConfig(@NotNull List<String> reasons, @NotNull HashSet<SubSkillType> badSkillSetup, boolean retroMode) {
|
||||
for(SubSkillType subSkillType : SubSkillType.values())
|
||||
{
|
||||
for (SubSkillType subSkillType : SubSkillType.values()) {
|
||||
//Keeping track of the rank requirements and making sure there are no logical errors
|
||||
int curRank = 0;
|
||||
int prevRank = 0;
|
||||
|
||||
for(int x = 0; x < subSkillType.getNumRanks(); x++)
|
||||
{
|
||||
int index = x+1;
|
||||
for (int x = 0; x < subSkillType.getNumRanks(); x++) {
|
||||
int index = x + 1;
|
||||
|
||||
if(curRank > 0)
|
||||
if (curRank > 0)
|
||||
prevRank = curRank;
|
||||
|
||||
curRank = getSubSkillUnlockLevel(subSkillType, index, retroMode);
|
||||
|
||||
//Do we really care if its below 0? Probably not
|
||||
if(curRank < 0)
|
||||
{
|
||||
reasons.add("(CONFIG ISSUE) " + subSkillType.toString() + " should not have any ranks that require a negative level!");
|
||||
if (curRank < 0) {
|
||||
reasons.add("(CONFIG ISSUE) " + subSkillType + " should not have any ranks that require a negative level!");
|
||||
badSkillSetup.add(subSkillType);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(prevRank > curRank)
|
||||
{
|
||||
if (prevRank > curRank) {
|
||||
//We're going to allow this but we're going to warn them
|
||||
plugin.getLogger().info("(CONFIG ISSUE) You have the ranks for the subskill "+ subSkillType.toString()+" set up poorly, sequential ranks should have ascending requirements");
|
||||
mcMMO.p.getLogger().info("(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements");
|
||||
badSkillSetup.add(subSkillType);
|
||||
}
|
||||
}
|
||||
@@ -187,9 +186,8 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
private void fixBadEntries(@NotNull SubSkillType subSkillType) {
|
||||
for(int x = 0; x < subSkillType.getNumRanks(); x++)
|
||||
{
|
||||
int index = x+1;
|
||||
for (int x = 0; x < subSkillType.getNumRanks(); x++) {
|
||||
int index = x + 1;
|
||||
|
||||
//Reset Retromode entries
|
||||
resetRankValue(subSkillType, index, true);
|
||||
|
@@ -1,46 +1,41 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
|
||||
public class SoundConfig extends AutoUpdateConfigLoader {
|
||||
public class SoundConfig extends BukkitConfig {
|
||||
private static SoundConfig instance;
|
||||
|
||||
public SoundConfig()
|
||||
{
|
||||
public SoundConfig() {
|
||||
super("sounds.yml");
|
||||
validate();
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static SoundConfig getInstance() {
|
||||
if (instance == null)
|
||||
return new SoundConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static SoundConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
return new SoundConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
for(SoundType soundType : SoundType.values())
|
||||
{
|
||||
if(config.getDouble("Sounds."+soundType.toString()+".Volume") < 0)
|
||||
{
|
||||
plugin.getLogger().info("[mcMMO] Sound volume cannot be below 0 for "+soundType.toString());
|
||||
for (SoundType soundType : SoundType.values()) {
|
||||
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
|
||||
mcMMO.p.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Sounds with custom pitching don't use pitch values
|
||||
if(!soundType.usesCustomPitch())
|
||||
{
|
||||
if(config.getDouble("Sounds."+soundType.toString()+".Pitch") < 0)
|
||||
{
|
||||
plugin.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for "+soundType.toString());
|
||||
if (!soundType.usesCustomPitch()) {
|
||||
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
|
||||
mcMMO.p.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -48,23 +43,22 @@ public class SoundConfig extends AutoUpdateConfigLoader {
|
||||
return true;
|
||||
}
|
||||
|
||||
public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
|
||||
public float getMasterVolume() {
|
||||
return (float) config.getDouble("Sounds.MasterVolume", 1.0);
|
||||
}
|
||||
|
||||
public float getVolume(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Volume";
|
||||
public float getVolume(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Volume";
|
||||
return (float) config.getDouble(key);
|
||||
}
|
||||
|
||||
public float getPitch(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Pitch";
|
||||
public float getPitch(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Pitch";
|
||||
return (float) config.getDouble(key);
|
||||
}
|
||||
|
||||
public boolean getIsEnabled(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Enabled";
|
||||
public boolean getIsEnabled(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Enabled";
|
||||
return config.getBoolean(key, true);
|
||||
}
|
||||
}
|
||||
|
@@ -15,20 +15,28 @@ public class WorldBlacklist {
|
||||
|
||||
private final String blackListFileName = "world_blacklist.txt";
|
||||
|
||||
public WorldBlacklist(mcMMO plugin)
|
||||
{
|
||||
public WorldBlacklist(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
blacklist = new ArrayList<>();
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
public static boolean isWorldBlacklisted(World world) {
|
||||
|
||||
for (String s : blacklist) {
|
||||
if (world.getName().equalsIgnoreCase(s))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
//Make the blacklist file if it doesn't exist
|
||||
File blackListFile = new File(plugin.getDataFolder() + File.separator + blackListFileName);
|
||||
|
||||
try {
|
||||
if(!blackListFile.exists())
|
||||
if (!blackListFile.exists())
|
||||
blackListFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -48,12 +56,11 @@ public class WorldBlacklist {
|
||||
|
||||
String currentLine;
|
||||
|
||||
while((currentLine = bufferedReader.readLine()) != null)
|
||||
{
|
||||
if(currentLine.length() == 0)
|
||||
while ((currentLine = bufferedReader.readLine()) != null) {
|
||||
if (currentLine.length() == 0)
|
||||
continue;
|
||||
|
||||
if(!blacklist.contains(currentLine))
|
||||
if (!blacklist.contains(currentLine))
|
||||
blacklist.add(currentLine);
|
||||
}
|
||||
|
||||
@@ -66,11 +73,11 @@ public class WorldBlacklist {
|
||||
closeRead(fileReader);
|
||||
}
|
||||
|
||||
plugin.getLogger().info(blacklist.size()+" entries in mcMMO World Blacklist");
|
||||
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
||||
}
|
||||
|
||||
private void closeRead(Reader reader) {
|
||||
if(reader != null) {
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
@@ -78,16 +85,4 @@ public class WorldBlacklist {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isWorldBlacklisted(World world)
|
||||
{
|
||||
|
||||
for(String s : blacklist)
|
||||
{
|
||||
if(world.getName().equalsIgnoreCase(s))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.experience;
|
||||
|
||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||
import com.gmail.nossr50.config.BukkitConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
@@ -17,7 +17,7 @@ import org.bukkit.entity.EntityType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
public class ExperienceConfig extends BukkitConfig {
|
||||
private static ExperienceConfig instance;
|
||||
|
||||
private ExperienceConfig() {
|
||||
@@ -25,6 +25,12 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
validate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initDefaults() {
|
||||
config.addDefault("ExploitFix.Combat.XPCeiling.Enabled", true);
|
||||
config.addDefault("ExploitFix.Combat.XPCeiling.Damage_Limit", 100);
|
||||
}
|
||||
|
||||
public static ExperienceConfig getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ExperienceConfig();
|
||||
@@ -34,7 +40,8 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
protected void loadKeys() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
@@ -139,81 +146,182 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return noErrorsInConfig(reason);
|
||||
}
|
||||
|
||||
public boolean isEarlyGameBoostEnabled() { return config.getBoolean("EarlyGameBoost.Enabled", true); }
|
||||
public boolean isEarlyGameBoostEnabled() {
|
||||
return config.getBoolean("EarlyGameBoost.Enabled", true);
|
||||
}
|
||||
|
||||
/*
|
||||
* FORMULA SETTINGS
|
||||
*/
|
||||
|
||||
/* EXPLOIT TOGGLES */
|
||||
public boolean isSnowExploitPrevented() { return config.getBoolean("ExploitFix.SnowGolemExcavation", true); }
|
||||
public boolean isEndermanEndermiteFarmingPrevented() { return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true); }
|
||||
public boolean isPistonCheatingPrevented() { return config.getBoolean("ExploitFix.PistonCheating", true); }
|
||||
public boolean isPistonExploitPrevented() { return config.getBoolean("ExploitFix.Pistons", false); }
|
||||
public boolean allowUnsafeEnchantments() { return config.getBoolean("ExploitFix.UnsafeEnchantments", false); }
|
||||
public boolean isCOTWBreedingPrevented() { return config.getBoolean("ExploitFix.COTWBreeding", true); }
|
||||
public boolean isNPCInteractionPrevented() { return config.getBoolean("ExploitFix.PreventPluginNPCInteraction", true); }
|
||||
public boolean isSnowExploitPrevented() {
|
||||
return config.getBoolean("ExploitFix.SnowGolemExcavation", true);
|
||||
}
|
||||
|
||||
public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); }
|
||||
public boolean isAcrobaticsExploitingPrevented() { return config.getBoolean("ExploitFix.Acrobatics", true); }
|
||||
public boolean isTreeFellerXPReduced() { return config.getBoolean("ExploitFix.TreeFellerReducedXP", true); }
|
||||
public boolean isEndermanEndermiteFarmingPrevented() {
|
||||
return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true);
|
||||
}
|
||||
|
||||
public boolean isPistonCheatingPrevented() {
|
||||
return config.getBoolean("ExploitFix.PistonCheating", true);
|
||||
}
|
||||
|
||||
public boolean isPistonExploitPrevented() {
|
||||
return config.getBoolean("ExploitFix.Pistons", false);
|
||||
}
|
||||
|
||||
public boolean allowUnsafeEnchantments() {
|
||||
return config.getBoolean("ExploitFix.UnsafeEnchantments", false);
|
||||
}
|
||||
|
||||
public boolean isCOTWBreedingPrevented() {
|
||||
return config.getBoolean("ExploitFix.COTWBreeding", true);
|
||||
}
|
||||
|
||||
public boolean isNPCInteractionPrevented() {
|
||||
return config.getBoolean("ExploitFix.PreventPluginNPCInteraction", true);
|
||||
}
|
||||
|
||||
public boolean isFishingExploitingPrevented() {
|
||||
return config.getBoolean("ExploitFix.Fishing", true);
|
||||
}
|
||||
|
||||
public int getFishingExploitingOptionMoveRange() {
|
||||
return config.getInt("Fishing_ExploitFix_Options.MoveRange", 3);
|
||||
}
|
||||
|
||||
public int getFishingExploitingOptionOverFishLimit() {
|
||||
return config.getInt("Fishing_ExploitFix_Options.OverFishLimit", 10);
|
||||
}
|
||||
|
||||
public boolean isAcrobaticsExploitingPrevented() {
|
||||
return config.getBoolean("ExploitFix.Acrobatics", true);
|
||||
}
|
||||
|
||||
public boolean isTreeFellerXPReduced() {
|
||||
return config.getBoolean("ExploitFix.TreeFellerReducedXP", true);
|
||||
}
|
||||
|
||||
/* Curve settings */
|
||||
public FormulaType getFormulaType() { return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve")); }
|
||||
public boolean getCumulativeCurveEnabled() { return config.getBoolean("Experience_Formula.Cumulative_Curve", false); }
|
||||
public FormulaType getFormulaType() {
|
||||
return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve"));
|
||||
}
|
||||
|
||||
public boolean getCumulativeCurveEnabled() {
|
||||
return config.getBoolean("Experience_Formula.Cumulative_Curve", false);
|
||||
}
|
||||
|
||||
/* Curve values */
|
||||
public double getMultiplier(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier"); }
|
||||
public int getBase(FormulaType type) { return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base"); }
|
||||
public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent"); }
|
||||
public double getMultiplier(FormulaType type) {
|
||||
return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier");
|
||||
}
|
||||
|
||||
public int getBase(FormulaType type) {
|
||||
return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base");
|
||||
}
|
||||
|
||||
public double getExponent(FormulaType type) {
|
||||
return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent");
|
||||
}
|
||||
|
||||
/* Global modifier */
|
||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
|
||||
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience_Formula.Multiplier.Global", value); }
|
||||
public double getExperienceGainsGlobalMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Multiplier.Global", 1.0);
|
||||
}
|
||||
|
||||
public void setExperienceGainsGlobalMultiplier(double value) {
|
||||
config.set("Experience_Formula.Multiplier.Global", value);
|
||||
}
|
||||
|
||||
/* PVP modifier */
|
||||
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0); }
|
||||
public double getPlayerVersusPlayerXP() {
|
||||
return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0);
|
||||
}
|
||||
|
||||
/* Spawned Mob modifier */
|
||||
public double getSpawnedMobXpMultiplier() { return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0); }
|
||||
public double getEggXpMultiplier() { return config.getDouble("Experience_Formula.Eggs.Multiplier", 0.0); }
|
||||
public double getTamedMobXpMultiplier() { return config.getDouble("Experience_Formula.Player_Tamed.Multiplier", 0.0); }
|
||||
public double getNetherPortalXpMultiplier() { return config.getDouble("Experience_Formula.Nether_Portal.Multiplier", 0.0); }
|
||||
public double getBredMobXpMultiplier() { return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0); }
|
||||
public double getSpawnedMobXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getEggXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Eggs.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getTamedMobXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Player_Tamed.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getNetherPortalXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Nether_Portal.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getBredMobXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0);
|
||||
}
|
||||
|
||||
/* Skill modifiers */
|
||||
public double getFormulaSkillModifier(PrimarySkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
|
||||
public double getFormulaSkillModifier(PrimarySkillType skill) {
|
||||
return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString()));
|
||||
}
|
||||
|
||||
/* Custom XP perk */
|
||||
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
||||
public double getCustomXpPerkBoost() {
|
||||
return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25);
|
||||
}
|
||||
|
||||
/* Diminished Returns */
|
||||
public float getDiminishedReturnsCap() { return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D); }
|
||||
public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
||||
public int getDiminishedReturnsThreshold(PrimarySkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
||||
public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
||||
public float getDiminishedReturnsCap() {
|
||||
return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D);
|
||||
}
|
||||
|
||||
public boolean getDiminishedReturnsEnabled() {
|
||||
return config.getBoolean("Diminished_Returns.Enabled", false);
|
||||
}
|
||||
|
||||
public int getDiminishedReturnsThreshold(PrimarySkillType skill) {
|
||||
return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000);
|
||||
}
|
||||
|
||||
public int getDiminishedReturnsTimeInterval() {
|
||||
return config.getInt("Diminished_Returns.Time_Interval", 10);
|
||||
}
|
||||
|
||||
/* Conversion */
|
||||
public double getExpModifier() { return config.getDouble("Conversion.Exp_Modifier", 1); }
|
||||
public double getExpModifier() {
|
||||
return config.getDouble("Conversion.Exp_Modifier", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience_Values.PVP.Rewards", true); }
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() {
|
||||
return config.getBoolean("Experience_Values.PVP.Rewards", true);
|
||||
}
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public double getCombatXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); }
|
||||
public double getAnimalsXP() { return config.getDouble("Experience_Values.Combat.Multiplier.Animals", 1.0); }
|
||||
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
public double getCombatXP(EntityType entity) {
|
||||
return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
|
||||
}
|
||||
|
||||
public double getAnimalsXP(EntityType entity) {
|
||||
return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP());
|
||||
}
|
||||
|
||||
public double getAnimalsXP() {
|
||||
return config.getDouble("Experience_Values.Combat.Multiplier.Animals", 1.0);
|
||||
}
|
||||
|
||||
public boolean hasCombatXP(EntityType entity) {
|
||||
return config.contains("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, Material material)
|
||||
{
|
||||
public int getXp(PrimarySkillType skill, Material material) {
|
||||
//TODO: Temporary measure to fix an exploit caused by a yet to be fixed Spigot bug (as of 7/3/2020)
|
||||
if(material.toString().equalsIgnoreCase("LILY_PAD"))
|
||||
if (material.toString().equalsIgnoreCase("LILY_PAD"))
|
||||
return 0;
|
||||
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
@@ -230,8 +338,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, BlockState blockState)
|
||||
{
|
||||
public int getXp(PrimarySkillType skill, BlockState blockState) {
|
||||
Material data = blockState.getType();
|
||||
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
@@ -248,8 +355,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, Block block)
|
||||
{
|
||||
public int getXp(PrimarySkillType skill, Block block) {
|
||||
Material data = block.getType();
|
||||
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
@@ -266,8 +372,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, BlockData data)
|
||||
{
|
||||
public int getXp(PrimarySkillType skill, BlockData data) {
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
if (config.contains(explicitString))
|
||||
@@ -281,8 +386,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data)
|
||||
{
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data) {
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
if (config.contains(explicitString))
|
||||
@@ -294,8 +398,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data)
|
||||
{
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data) {
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
if (config.contains(explicitString))
|
||||
@@ -311,32 +414,42 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
* Experience Bar Stuff
|
||||
*/
|
||||
|
||||
public boolean isPartyExperienceBarsEnabled()
|
||||
{
|
||||
public boolean isPartyExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Update.Party", true);
|
||||
}
|
||||
|
||||
public boolean isPassiveGainsExperienceBarsEnabled()
|
||||
{
|
||||
public boolean isPassiveGainsExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Update.Passive", true);
|
||||
}
|
||||
|
||||
public boolean getDoExperienceBarsAlwaysUpdateTitle()
|
||||
{
|
||||
public boolean getDoExperienceBarsAlwaysUpdateTitle() {
|
||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.Enable", false) || getAddExtraDetails();
|
||||
}
|
||||
|
||||
public boolean getAddExtraDetails() { return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);}
|
||||
public boolean isExperienceBarsEnabled() { return config.getBoolean("Experience_Bars.Enable", true); }
|
||||
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Enable", true);}
|
||||
public boolean getAddExtraDetails() {
|
||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);
|
||||
}
|
||||
public boolean useCombatHPCeiling() {
|
||||
return config.getBoolean("ExploitFix.Combat.XPCeiling.Enabled", true);
|
||||
}
|
||||
|
||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType)
|
||||
{
|
||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
|
||||
public int getCombatHPCeiling() {
|
||||
return config.getInt("ExploitFix.Combat.XPCeiling.HP_Modifier_Limit", 100);
|
||||
}
|
||||
|
||||
for(BarColor barColor : BarColor.values())
|
||||
{
|
||||
if(barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
public boolean isExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Enable", true);
|
||||
}
|
||||
|
||||
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) {
|
||||
return config.getBoolean("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Enable", true);
|
||||
}
|
||||
|
||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType) {
|
||||
String colorValueFromConfig = config.getString("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Color");
|
||||
|
||||
for (BarColor barColor : BarColor.values()) {
|
||||
if (barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
return barColor;
|
||||
}
|
||||
|
||||
@@ -344,13 +457,11 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return BarColor.WHITE;
|
||||
}
|
||||
|
||||
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType)
|
||||
{
|
||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".BarStyle");
|
||||
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType) {
|
||||
String colorValueFromConfig = config.getString("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".BarStyle");
|
||||
|
||||
for(BarStyle barStyle : BarStyle.values())
|
||||
{
|
||||
if(barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
for (BarStyle barStyle : BarStyle.values()) {
|
||||
if (barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
return barStyle;
|
||||
}
|
||||
|
||||
@@ -359,29 +470,51 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Acrobatics */
|
||||
public int getDodgeXPModifier() { return config.getInt("Experience_Values.Acrobatics.Dodge", 120); }
|
||||
public int getRollXPModifier() { return config.getInt("Experience_Values.Acrobatics.Roll", 80); }
|
||||
public int getFallXPModifier() { return config.getInt("Experience_Values.Acrobatics.Fall", 120); }
|
||||
public int getDodgeXPModifier() {
|
||||
return config.getInt("Experience_Values.Acrobatics.Dodge", 120);
|
||||
}
|
||||
|
||||
public double getFeatherFallXPModifier() { return config.getDouble("Experience_Values.Acrobatics.FeatherFall_Multiplier", 2.0); }
|
||||
public int getRollXPModifier() {
|
||||
return config.getInt("Experience_Values.Acrobatics.Roll", 80);
|
||||
}
|
||||
|
||||
public int getFallXPModifier() {
|
||||
return config.getInt("Experience_Values.Acrobatics.Fall", 120);
|
||||
}
|
||||
|
||||
public double getFeatherFallXPModifier() {
|
||||
return config.getDouble("Experience_Values.Acrobatics.FeatherFall_Multiplier", 2.0);
|
||||
}
|
||||
|
||||
/* Alchemy */
|
||||
public double getPotionXP(PotionStage stage) { return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
|
||||
public double getPotionXP(PotionStage stage) {
|
||||
return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D);
|
||||
}
|
||||
|
||||
/* Archery */
|
||||
public double getArcheryDistanceMultiplier() { return config.getDouble("Experience_Values.Archery.Distance_Multiplier", 0.025); }
|
||||
public double getArcheryDistanceMultiplier() {
|
||||
return config.getDouble("Experience_Values.Archery.Distance_Multiplier", 0.025);
|
||||
}
|
||||
|
||||
public int getFishingShakeXP() { return config.getInt("Experience_Values.Fishing.Shake", 50); }
|
||||
public int getFishingShakeXP() {
|
||||
return config.getInt("Experience_Values.Fishing.Shake", 50);
|
||||
}
|
||||
|
||||
/* Repair */
|
||||
public double getRepairXPBase() { return config.getDouble("Experience_Values.Repair.Base", 1000.0); }
|
||||
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience_Values.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||
public double getRepairXPBase() {
|
||||
return config.getDouble("Experience_Values.Repair.Base", 1000.0);
|
||||
}
|
||||
|
||||
public double getRepairXP(MaterialType repairMaterialType) {
|
||||
return config.getDouble("Experience_Values.Repair." + StringUtils.getCapitalized(repairMaterialType.toString()));
|
||||
}
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXP(EntityType type)
|
||||
{
|
||||
public int getTamingXP(EntityType type) {
|
||||
return config.getInt("Experience_Values.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
||||
}
|
||||
|
||||
public boolean preventStoneLavaFarming() { return config.getBoolean("ExploitFix.LavaStoneAndCobbleFarming", true);}
|
||||
public boolean preventStoneLavaFarming() {
|
||||
return config.getBoolean("ExploitFix.LavaStoneAndCobbleFarming", true);
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package com.gmail.nossr50.config.mods;
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||
import org.bukkit.Material;
|
||||
@@ -13,14 +14,12 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomArmorConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customBoots = new ArrayList<>();
|
||||
public List<Material> customBoots = new ArrayList<>();
|
||||
public List<Material> customChestplates = new ArrayList<>();
|
||||
public List<Material> customHelmets = new ArrayList<>();
|
||||
public List<Material> customLeggings = new ArrayList<>();
|
||||
|
||||
public List<Material> customHelmets = new ArrayList<>();
|
||||
public List<Material> customLeggings = new ArrayList<>();
|
||||
public List<Repairable> repairables = new ArrayList<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomArmorConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@@ -62,7 +61,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
Material armorMaterial = Material.matchMaterial(armorName);
|
||||
|
||||
if (armorMaterial == null) {
|
||||
plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + armorName);
|
||||
mcMMO.p.getLogger().warning("Invalid material name. This item will be skipped. - " + armorName);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -70,7 +69,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
Material repairMaterial = Material.matchMaterial(config.getString(armorType + "." + armorName + ".Repair_Material", ""));
|
||||
|
||||
if (repairable && (repairMaterial == null)) {
|
||||
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + armorName);
|
||||
mcMMO.p.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + armorName);
|
||||
repairable = false;
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
@@ -11,17 +12,15 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomBlockConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
public List<Material> customOres = new ArrayList<>();
|
||||
public List<Material> customLogs = new ArrayList<>();
|
||||
public List<Material> customLeaves = new ArrayList<>();
|
||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
public List<Material> customOres = new ArrayList<>();
|
||||
public List<Material> customLogs = new ArrayList<>();
|
||||
public List<Material> customLeaves = new ArrayList<>();
|
||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomBlockConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@@ -66,7 +65,7 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
Material blockMaterial = Material.matchMaterial(blockInfo[0]);
|
||||
|
||||
if (blockMaterial == null) {
|
||||
plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + blockInfo[0]);
|
||||
mcMMO.p.getLogger().warning("Invalid material name. This item will be skipped. - " + blockInfo[0]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -84,12 +83,10 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
customOres.add(blockMaterial);
|
||||
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||
}
|
||||
else if (skillType.equals("Woodcutting")) {
|
||||
} else if (skillType.equals("Woodcutting")) {
|
||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
||||
customLogs.add(blockMaterial);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
customLeaves.add(blockMaterial);
|
||||
xp = 0; // Leaves don't grant XP
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.apache.commons.lang.ClassUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -10,7 +11,7 @@ import java.util.HashMap;
|
||||
|
||||
public class CustomEntityConfig extends ConfigLoader {
|
||||
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
|
||||
|
||||
protected CustomEntityConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@@ -30,10 +31,9 @@ public class CustomEntityConfig extends ConfigLoader {
|
||||
|
||||
try {
|
||||
clazz = ClassUtils.getClass(className);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
plugin.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
|
||||
plugin.getLogger().warning("This custom entity may not function properly.");
|
||||
} catch (ClassNotFoundException e) {
|
||||
mcMMO.p.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
|
||||
mcMMO.p.getLogger().warning("This custom entity may not function properly.");
|
||||
}
|
||||
|
||||
String entityTypeName = entityName.replace("_", ".");
|
||||
@@ -48,7 +48,7 @@ public class CustomEntityConfig extends ConfigLoader {
|
||||
int callOfTheWildAmount = config.getInt(entityName + ".COTW_Material_Amount");
|
||||
|
||||
if (canBeSummoned && (callOfTheWildMaterial == null || callOfTheWildAmount == 0)) {
|
||||
plugin.getLogger().warning("Incomplete Call of the Wild information. This entity will not be able to be summoned by Call of the Wild.");
|
||||
mcMMO.p.getLogger().warning("Incomplete Call of the Wild information. This entity will not be able to be summoned by Call of the Wild.");
|
||||
canBeSummoned = false;
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,7 @@ import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||
import org.bukkit.Material;
|
||||
@@ -15,18 +16,15 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomToolConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customAxes = new ArrayList<>();
|
||||
public List<Material> customBows = new ArrayList<>();
|
||||
public List<Material> customHoes = new ArrayList<>();
|
||||
public List<Material> customAxes = new ArrayList<>();
|
||||
public List<Material> customBows = new ArrayList<>();
|
||||
public List<Material> customHoes = new ArrayList<>();
|
||||
public List<Material> customPickaxes = new ArrayList<>();
|
||||
public List<Material> customShovels = new ArrayList<>();
|
||||
public List<Material> customSwords = new ArrayList<>();
|
||||
|
||||
public List<Material> customShovels = new ArrayList<>();
|
||||
public List<Material> customSwords = new ArrayList<>();
|
||||
public HashMap<Material, CustomTool> customToolMap = new HashMap<>();
|
||||
|
||||
public List<Repairable> repairables = new ArrayList<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
protected CustomToolConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@@ -70,7 +68,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
Material toolMaterial = Material.matchMaterial(toolName);
|
||||
|
||||
if (toolMaterial == null) {
|
||||
plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + toolName);
|
||||
mcMMO.p.getLogger().warning("Invalid material name. This item will be skipped. - " + toolName);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -78,7 +76,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
Material repairMaterial = Material.matchMaterial(config.getString(toolType + "." + toolName + ".Repair_Material", ""));
|
||||
|
||||
if (repairable && (repairMaterial == null)) {
|
||||
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + toolName);
|
||||
mcMMO.p.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + toolName);
|
||||
repairable = false;
|
||||
}
|
||||
|
||||
|
@@ -1,13 +1,13 @@
|
||||
package com.gmail.nossr50.config.party;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.BukkitConfig;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ItemWeightConfig extends ConfigLoader {
|
||||
public class ItemWeightConfig extends BukkitConfig {
|
||||
private static ItemWeightConfig instance;
|
||||
|
||||
private ItemWeightConfig() {
|
||||
@@ -40,5 +40,6 @@ public class ItemWeightConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
protected void loadKeys() {
|
||||
}
|
||||
}
|
||||
|
@@ -95,8 +95,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
if (potion != null) {
|
||||
potionMap.put(potionName, potion);
|
||||
pass++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
@@ -114,13 +113,13 @@ public class PotionConfig extends ConfigLoader {
|
||||
*/
|
||||
private AlchemyPotion loadPotion(ConfigurationSection potion_section) {
|
||||
try {
|
||||
|
||||
|
||||
|
||||
String name = potion_section.getString("Name");
|
||||
if (name != null) {
|
||||
name = ChatColor.translateAlternateColorCodes('&', name);
|
||||
}
|
||||
|
||||
|
||||
PotionData data;
|
||||
if (!potion_section.contains("PotionData")) { // Backwards config compatability
|
||||
short dataValue = Short.parseShort(potion_section.getName());
|
||||
@@ -130,7 +129,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
ConfigurationSection potionData = potion_section.getConfigurationSection("PotionData");
|
||||
data = new PotionData(PotionType.valueOf(potionData.getString("PotionType", "WATER")), potionData.getBoolean("Extended", false), potionData.getBoolean("Upgraded", false));
|
||||
}
|
||||
|
||||
|
||||
Material material = Material.POTION;
|
||||
String mat = potion_section.getString("Material", null);
|
||||
if (mat != null) {
|
||||
@@ -155,18 +154,16 @@ public class PotionConfig extends ConfigLoader {
|
||||
|
||||
if (type != null) {
|
||||
effects.add(new PotionEffect(type, duration, amplifier));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Failed to parse effect for potion " + name + ": " + effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Color color;
|
||||
if (potion_section.contains("Color")) {
|
||||
color = Color.fromRGB(potion_section.getInt("Color"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
color = this.generateColor(effects);
|
||||
}
|
||||
|
||||
@@ -176,16 +173,14 @@ public class PotionConfig extends ConfigLoader {
|
||||
ItemStack ingredient = loadIngredient(child);
|
||||
if (ingredient != null) {
|
||||
children.put(ingredient, potion_section.getConfigurationSection("Children").getString(child));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Failed to parse child for potion " + name + ": " + child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new AlchemyPotion(material, data, name, lore, effects, color, children);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
mcMMO.p.getLogger().warning("Failed to load Alchemy potion: " + potion_section.getName());
|
||||
return null;
|
||||
}
|
||||
@@ -243,7 +238,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
public AlchemyPotion getPotion(String name) {
|
||||
return potionMap.get(name);
|
||||
}
|
||||
|
||||
|
||||
public AlchemyPotion getPotion(ItemStack item) {
|
||||
for (AlchemyPotion potion : potionMap.values()) {
|
||||
if (potion.isSimilar(item)) {
|
||||
@@ -252,7 +247,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Color generateColor(List<PotionEffect> effects) {
|
||||
if (effects != null && !effects.isEmpty()) {
|
||||
List<Color> colors = new ArrayList<>();
|
||||
@@ -270,7 +265,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Color calculateAverageColor(List<Color> colors) {
|
||||
int red = 0;
|
||||
int green = 0;
|
||||
@@ -280,7 +275,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
green += color.getGreen();
|
||||
blue += color.getBlue();
|
||||
}
|
||||
return Color.fromRGB(red/colors.size(), green/colors.size(), blue/colors.size());
|
||||
return Color.fromRGB(red / colors.size(), green / colors.size(), blue / colors.size());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.skills.repair;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.BukkitConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -13,9 +13,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class RepairConfig extends ConfigLoader {
|
||||
private List<Repairable> repairables;
|
||||
public class RepairConfig extends BukkitConfig {
|
||||
private final HashSet<String> notSupported;
|
||||
private List<Repairable> repairables;
|
||||
|
||||
public RepairConfig(String fileName) {
|
||||
super(fileName);
|
||||
@@ -62,33 +62,25 @@ public class RepairConfig extends ConfigLoader {
|
||||
|
||||
if (ItemUtils.isWoodTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(repairItem)) {
|
||||
} else if (ItemUtils.isStoneTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.STONE;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(repairItem)) {
|
||||
} else if (ItemUtils.isStringTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.STRING;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(repairItem)) {
|
||||
} else if (ItemUtils.isLeatherArmor(repairItem)) {
|
||||
repairMaterialType = MaterialType.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
||||
} else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.IRON;
|
||||
}
|
||||
else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
||||
} else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.GOLD;
|
||||
}
|
||||
else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
||||
} else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.DIAMOND;
|
||||
} else if (ItemUtils.isNetheriteArmor(repairItem) || ItemUtils.isNetheriteTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.NETHERITE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString);
|
||||
}
|
||||
}
|
||||
@@ -122,16 +114,13 @@ public class RepairConfig extends ConfigLoader {
|
||||
|
||||
if (ItemUtils.isMinecraftTool(repairItem)) {
|
||||
repairItemType = ItemType.TOOL;
|
||||
}
|
||||
else if (ItemUtils.isArmor(repairItem)) {
|
||||
} else if (ItemUtils.isArmor(repairItem)) {
|
||||
repairItemType = ItemType.ARMOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
repairItemType = ItemType.valueOf(repairItemTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + repairItemTypeString);
|
||||
}
|
||||
}
|
||||
@@ -146,7 +135,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
// Minimum Quantity
|
||||
int minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity");
|
||||
|
||||
if(minimumQuantity == 0) {
|
||||
if (minimumQuantity == 0) {
|
||||
minimumQuantity = -1;
|
||||
}
|
||||
|
||||
@@ -158,13 +147,13 @@ public class RepairConfig extends ConfigLoader {
|
||||
//Report unsupported
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if(notSupported.size() > 0) {
|
||||
if (notSupported.size() > 0) {
|
||||
stringBuilder.append("mcMMO found the following materials in the Repair config that are not supported by the version of Minecraft running on this server: ");
|
||||
|
||||
for (Iterator<String> iterator = notSupported.iterator(); iterator.hasNext(); ) {
|
||||
String unsupportedMaterial = iterator.next();
|
||||
|
||||
if(!iterator.hasNext()) {
|
||||
if (!iterator.hasNext()) {
|
||||
stringBuilder.append(unsupportedMaterial);
|
||||
} else {
|
||||
stringBuilder.append(unsupportedMaterial).append(", ");
|
||||
@@ -182,7 +171,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
|
||||
private boolean noErrorsInRepairable(List<String> issues) {
|
||||
for (String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
mcMMO.p.getLogger().warning(issue);
|
||||
}
|
||||
|
||||
return issues.isEmpty();
|
||||
|
@@ -1,28 +1,28 @@
|
||||
package com.gmail.nossr50.config.skills.repair;
|
||||
|
||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.util.FixSpellingNetheriteUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RepairConfigManager {
|
||||
private final List<Repairable> repairables = new ArrayList<>();
|
||||
public static final String REPAIR_VANILLA_YML = "repair.vanilla.yml";
|
||||
private static final Collection<Repairable> repairables = new HashSet<>();
|
||||
|
||||
public RepairConfigManager(mcMMO plugin) {
|
||||
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");
|
||||
File dataFolder = plugin.getDataFolder();
|
||||
File vanilla = new File(dataFolder, "repair.vanilla.yml");
|
||||
|
||||
if (!vanilla.exists()) {
|
||||
plugin.saveResource("repair.vanilla.yml", false);
|
||||
}
|
||||
RepairConfig mainRepairConfig = new RepairConfig(REPAIR_VANILLA_YML);
|
||||
repairables.addAll(mainRepairConfig.getLoadedRepairables());
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
if(fileName.equals(REPAIR_VANILLA_YML))
|
||||
continue;
|
||||
|
||||
if (!pattern.matcher(fileName).matches()) {
|
||||
continue;
|
||||
}
|
||||
@@ -33,19 +33,12 @@ public class RepairConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_SPELLING_NETHERITE_REPAIR)) {
|
||||
//Check spelling mistakes (early versions of 1.16 support had Netherite misspelled)
|
||||
plugin.getLogger().info("Checking for certain invalid material names in Repair config...");
|
||||
FixSpellingNetheriteUtil.processFileCheck(mcMMO.p, fileName, UpgradeType.FIX_SPELLING_NETHERITE_REPAIR);
|
||||
}
|
||||
|
||||
RepairConfig rConfig = new RepairConfig(fileName);
|
||||
repairables.addAll(rConfig.getLoadedRepairables());
|
||||
}
|
||||
}
|
||||
|
||||
public List<Repairable> getLoadedRepairables() {
|
||||
public Collection<Repairable> getLoadedRepairables() {
|
||||
return repairables;
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.skills.salvage;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.BukkitConfig;
|
||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
@@ -16,9 +16,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class SalvageConfig extends ConfigLoader {
|
||||
private List<Salvageable> salvageables;
|
||||
public class SalvageConfig extends BukkitConfig {
|
||||
private final HashSet<String> notSupported;
|
||||
private Set<Salvageable> salvageables;
|
||||
|
||||
public SalvageConfig(String fileName) {
|
||||
super(fileName);
|
||||
@@ -28,7 +28,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
salvageables = new ArrayList<>();
|
||||
salvageables = new HashSet<>();
|
||||
|
||||
if (!config.isConfigurationSection("Salvageables")) {
|
||||
mcMMO.p.getLogger().severe("Could not find Salvageables section in " + fileName);
|
||||
@@ -40,10 +40,10 @@ public class SalvageConfig extends ConfigLoader {
|
||||
|
||||
//Original version of 1.16 support had maximum quantities that were bad, this fixes it
|
||||
|
||||
if(mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
|
||||
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
|
||||
mcMMO.p.getLogger().info("Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
||||
for(String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
||||
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4);
|
||||
for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
||||
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); //TODO: Doesn't make sense to default to 4 for everything
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -78,33 +78,25 @@ public class SalvageConfig extends ConfigLoader {
|
||||
|
||||
if (ItemUtils.isWoodTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(salvageItem)) {
|
||||
} else if (ItemUtils.isStoneTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STONE;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(salvageItem)) {
|
||||
} else if (ItemUtils.isStringTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STRING;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
||||
} else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
||||
} else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.IRON;
|
||||
}
|
||||
else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) {
|
||||
} else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.GOLD;
|
||||
}
|
||||
else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
|
||||
} else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.DIAMOND;
|
||||
} else if (ItemUtils.isNetheriteTool(salvageItem) || ItemUtils.isNetheriteArmor(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.NETHERITE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + salvageMaterialTypeString);
|
||||
}
|
||||
}
|
||||
@@ -130,16 +122,13 @@ public class SalvageConfig extends ConfigLoader {
|
||||
|
||||
if (ItemUtils.isMinecraftTool(salvageItem)) {
|
||||
salvageItemType = ItemType.TOOL;
|
||||
}
|
||||
else if (ItemUtils.isArmor(salvageItem)) {
|
||||
} else if (ItemUtils.isArmor(salvageItem)) {
|
||||
salvageItemType = ItemType.ARMOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + salvageItemTypeString);
|
||||
}
|
||||
}
|
||||
@@ -176,13 +165,13 @@ public class SalvageConfig extends ConfigLoader {
|
||||
//Report unsupported
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if(notSupported.size() > 0) {
|
||||
if (notSupported.size() > 0) {
|
||||
stringBuilder.append("mcMMO found the following materials in the Salvage config that are not supported by the version of Minecraft running on this server: ");
|
||||
|
||||
for (Iterator<String> iterator = notSupported.iterator(); iterator.hasNext(); ) {
|
||||
String unsupportedMaterial = iterator.next();
|
||||
|
||||
if(!iterator.hasNext()) {
|
||||
if (!iterator.hasNext()) {
|
||||
stringBuilder.append(unsupportedMaterial);
|
||||
} else {
|
||||
stringBuilder.append(unsupportedMaterial).append(", ");
|
||||
@@ -194,18 +183,18 @@ public class SalvageConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Salvageable> getLoadedSalvageables() {
|
||||
return salvageables == null ? new ArrayList<>() : salvageables;
|
||||
protected Collection<Salvageable> getLoadedSalvageables() {
|
||||
return salvageables == null ? new HashSet<>() : salvageables;
|
||||
}
|
||||
|
||||
private boolean noErrorsInSalvageable(List<String> issues) {
|
||||
if (!issues.isEmpty()) {
|
||||
plugin.getLogger().warning("Errors have been found in: " + fileName);
|
||||
plugin.getLogger().warning("The following issues were found:");
|
||||
mcMMO.p.getLogger().warning("Errors have been found in: " + fileName);
|
||||
mcMMO.p.getLogger().warning("The following issues were found:");
|
||||
}
|
||||
|
||||
for (String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
mcMMO.p.getLogger().warning(issue);
|
||||
}
|
||||
|
||||
return issues.isEmpty();
|
||||
|
@@ -1,9 +1,7 @@
|
||||
package com.gmail.nossr50.config.skills.salvage;
|
||||
|
||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.util.FixSpellingNetheriteUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -11,18 +9,21 @@ import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SalvageConfigManager {
|
||||
private final List<Salvageable> salvageables = new ArrayList<>();
|
||||
public static final String SALVAGE_VANILLA_YML = "salvage.vanilla.yml";
|
||||
private final List<Salvageable> salvageables = new ArrayList<>(); //TODO: Collision checking, make the list a set
|
||||
|
||||
|
||||
public SalvageConfigManager(mcMMO plugin) {
|
||||
Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml");
|
||||
File dataFolder = plugin.getDataFolder();
|
||||
File vanilla = new File(dataFolder, "salvage.vanilla.yml");
|
||||
|
||||
if (!vanilla.exists()) {
|
||||
plugin.saveResource("salvage.vanilla.yml", false);
|
||||
}
|
||||
SalvageConfig mainSalvageConfig = new SalvageConfig(SALVAGE_VANILLA_YML);
|
||||
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
if(fileName.equals(SALVAGE_VANILLA_YML))
|
||||
continue;
|
||||
|
||||
if (!pattern.matcher(fileName).matches()) {
|
||||
continue;
|
||||
}
|
||||
@@ -33,20 +34,12 @@ public class SalvageConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_SPELLING_NETHERITE_SALVAGE)) {
|
||||
//Check spelling mistakes (early versions of 1.16 support had Netherite misspelled)
|
||||
plugin.getLogger().info("Checking for certain invalid material names in Salvage config...");
|
||||
FixSpellingNetheriteUtil.processFileCheck(mcMMO.p, fileName, UpgradeType.FIX_SPELLING_NETHERITE_SALVAGE);
|
||||
}
|
||||
|
||||
|
||||
SalvageConfig salvageConfig = new SalvageConfig(fileName);
|
||||
salvageables.addAll(salvageConfig.getLoadedSalvageables());
|
||||
}
|
||||
}
|
||||
|
||||
public List<Salvageable> getLoadedSalvageables() {
|
||||
return salvageables;
|
||||
return new ArrayList<>(salvageables);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.treasure;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.BukkitConfig;
|
||||
import com.gmail.nossr50.datatypes.treasure.*;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.EnchantmentUtils;
|
||||
@@ -18,14 +18,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class FishingTreasureConfig extends ConfigLoader {
|
||||
public class FishingTreasureConfig extends BukkitConfig {
|
||||
|
||||
public static final String FILENAME = "fishing_treasures.yml";
|
||||
private static FishingTreasureConfig instance;
|
||||
|
||||
public @NotNull HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
|
||||
public @NotNull HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
|
||||
public @NotNull HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<>();
|
||||
public @NotNull HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<>();
|
||||
public @NotNull HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<>();
|
||||
|
||||
private FishingTreasureConfig() {
|
||||
super(FILENAME);
|
||||
@@ -45,33 +45,39 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
protected boolean validateKeys() {
|
||||
// Validate all the settings!
|
||||
List<String> reason = new ArrayList<>();
|
||||
for (String tier : config.getConfigurationSection("Enchantment_Drop_Rates").getKeys(false)) {
|
||||
double totalEnchantDropRate = 0;
|
||||
double totalItemDropRate = 0;
|
||||
ConfigurationSection enchantment_drop_rates = config.getConfigurationSection("Enchantment_Drop_Rates");
|
||||
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
double enchantDropRate = config.getDouble("Enchantment_Drop_Rates." + tier + "." + rarity.toString());
|
||||
double itemDropRate = config.getDouble("Item_Drop_Rates." + tier + "." + rarity.toString());
|
||||
if(enchantment_drop_rates != null) {
|
||||
for (String tier : enchantment_drop_rates.getKeys(false)) {
|
||||
double totalEnchantDropRate = 0;
|
||||
double totalItemDropRate = 0;
|
||||
|
||||
if ((enchantDropRate < 0.0 || enchantDropRate > 100.0)) {
|
||||
reason.add("The enchant drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
double enchantDropRate = config.getDouble("Enchantment_Drop_Rates." + tier + "." + rarity.toString());
|
||||
double itemDropRate = config.getDouble("Item_Drop_Rates." + tier + "." + rarity);
|
||||
|
||||
if ((enchantDropRate < 0.0 || enchantDropRate > 100.0)) {
|
||||
reason.add("The enchant drop rate for " + tier + " items that are " + rarity + "should be between 0.0 and 100.0!");
|
||||
}
|
||||
|
||||
if (itemDropRate < 0.0 || itemDropRate > 100.0) {
|
||||
reason.add("The item drop rate for " + tier + " items that are " + rarity + "should be between 0.0 and 100.0!");
|
||||
}
|
||||
|
||||
totalEnchantDropRate += enchantDropRate;
|
||||
totalItemDropRate += itemDropRate;
|
||||
}
|
||||
|
||||
if (itemDropRate < 0.0 || itemDropRate > 100.0) {
|
||||
reason.add("The item drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
||||
if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
|
||||
reason.add("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!");
|
||||
}
|
||||
|
||||
totalEnchantDropRate += enchantDropRate;
|
||||
totalItemDropRate += itemDropRate;
|
||||
}
|
||||
|
||||
if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
|
||||
reason.add("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!");
|
||||
}
|
||||
|
||||
if (totalItemDropRate < 0 || totalItemDropRate > 100.0) {
|
||||
reason.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!");
|
||||
if (totalItemDropRate < 0 || totalItemDropRate > 100.0) {
|
||||
reason.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Your fishing treasures config is empty, is this intentional? Delete it to regenerate.");
|
||||
}
|
||||
|
||||
return noErrorsInConfig(reason);
|
||||
@@ -89,7 +95,7 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
|
||||
for (EntityType entity : EntityType.values()) {
|
||||
if (entity.isAlive()) {
|
||||
loadTreasures("Shake." + entity.toString());
|
||||
loadTreasures("Shake." + entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +170,7 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
if (dropLevel < 0) {
|
||||
reason.add(treasureName + " has an invalid Drop_Level: " + dropLevel);
|
||||
reason.add("Fishing Config: " + treasureName + " has an invalid Drop_Level: " + dropLevel);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -175,7 +181,7 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
if (isFishing) {
|
||||
String rarityStr = config.getString(type + "." + treasureName + ".Rarity");
|
||||
|
||||
if(rarityStr != null) {
|
||||
if (rarityStr != null) {
|
||||
rarity = Rarity.getRarity(rarityStr);
|
||||
} else {
|
||||
mcMMO.p.getLogger().severe("Please edit your config and add a Rarity definition for - " + treasureName);
|
||||
@@ -192,7 +198,7 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
|
||||
String customName = null;
|
||||
|
||||
if(hasCustomName(type, treasureName)) {
|
||||
if (hasCustomName(type, treasureName)) {
|
||||
customName = config.getString(type + "." + treasureName + ".Custom_Name");
|
||||
}
|
||||
|
||||
@@ -204,7 +210,7 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
item = new ItemStack(mat, amount, data);
|
||||
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
||||
|
||||
if(itemMeta == null) {
|
||||
if (itemMeta == null) {
|
||||
mcMMO.p.getLogger().severe("Item meta when adding potion to fishing treasure was null, contact the mcMMO devs!");
|
||||
continue;
|
||||
}
|
||||
@@ -232,7 +238,7 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
}
|
||||
} else if(material == Material.ENCHANTED_BOOK) {
|
||||
} else if (material == Material.ENCHANTED_BOOK) {
|
||||
//If any whitelisted enchants exist we use whitelist-based matching
|
||||
item = new ItemStack(material, 1);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
@@ -276,7 +282,6 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (noErrorsInConfig(reason)) {
|
||||
if (isFishing) {
|
||||
addFishingTreasure(rarity, new FishingTreasure(item, xp));
|
||||
@@ -307,26 +312,27 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
/**
|
||||
* Matches enchantments on a list (user provided string) to known enchantments in the Spigot API
|
||||
* Any matches are added to the passed set
|
||||
*
|
||||
* @param enchantListStr the users string list of enchantments
|
||||
* @param permissiveList the permissive list of enchantments
|
||||
*/
|
||||
private void matchAndFillSet(@NotNull List<String> enchantListStr, @NotNull Set<Enchantment> permissiveList) {
|
||||
if(enchantListStr.isEmpty()) {
|
||||
if (enchantListStr.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(String str : enchantListStr) {
|
||||
for (String str : enchantListStr) {
|
||||
boolean foundMatch = false;
|
||||
for(Enchantment enchantment : Enchantment.values()) {
|
||||
if(enchantment.getKey().getKey().equalsIgnoreCase(str)) {
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
if (enchantment.getKey().getKey().equalsIgnoreCase(str)) {
|
||||
permissiveList.add(enchantment);
|
||||
foundMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!foundMatch) {
|
||||
mcMMO.p.getLogger().info("[Fishing Treasure Init] Could not find any enchantments which matched the user defined enchantment named: "+str);
|
||||
if (!foundMatch) {
|
||||
mcMMO.p.getLogger().info("[Fishing Treasure Init] Could not find any enchantments which matched the user defined enchantment named: " + str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,11 +350,11 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
for (String enchantmentName : enchantmentSection.getKeys(false)) {
|
||||
int level = config.getInt("Enchantments_Rarity." + rarity.toString() + "." + enchantmentName);
|
||||
int level = config.getInt("Enchantments_Rarity." + rarity + "." + enchantmentName);
|
||||
Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
||||
|
||||
if (enchantment == null) {
|
||||
plugin.getLogger().warning("Skipping invalid enchantment in " + FILENAME + ": " + enchantmentName);
|
||||
mcMMO.p.getLogger().warning("Skipping invalid enchantment in " + FILENAME + ": " + enchantmentName);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -374,10 +380,10 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
public double getItemDropRate(int tier, @NotNull Rarity rarity) {
|
||||
return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
||||
return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity);
|
||||
}
|
||||
|
||||
public double getEnchantmentDropRate(int tier, @NotNull Rarity rarity) {
|
||||
return config.getDouble("Enchantment_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
||||
return config.getDouble("Enchantment_Drop_Rates.Tier_" + tier + "." + rarity);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
package com.gmail.nossr50.config.treasure;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.BukkitConfig;
|
||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@@ -14,17 +15,24 @@ import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class TreasureConfig extends ConfigLoader {
|
||||
public class TreasureConfig extends BukkitConfig {
|
||||
|
||||
public static final String FILENAME = "treasures.yml";
|
||||
public static final String LEVEL_REQUIREMENT_RETRO_MODE = ".Level_Requirement.Retro_Mode";
|
||||
public static final String LEVEL_REQUIREMENT_STANDARD_MODE = ".Level_Requirement.Standard_Mode";
|
||||
public static final String WRONG_KEY_VALUE_STANDARD = ".Drop_Level.Standard_Mode";
|
||||
public static final String WRONG_KEY_VALUE_RETRO = ".Drop_Level.Retro_Mode";
|
||||
public static final String LEGACY_DROP_LEVEL = ".Drop_Level";
|
||||
public static final String WRONG_KEY_ROOT = ".Drop_Level";
|
||||
private static TreasureConfig instance;
|
||||
|
||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<>();
|
||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<>();
|
||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<>();
|
||||
|
||||
private TreasureConfig() {
|
||||
super(FILENAME);
|
||||
@@ -60,6 +68,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
private void loadTreasures(String type) {
|
||||
boolean shouldWeUpdateFile = false;
|
||||
boolean isExcavation = type.equals("Excavation");
|
||||
boolean isHylian = type.equals("Hylian_Luck");
|
||||
|
||||
@@ -103,7 +112,39 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
int xp = config.getInt(type + "." + treasureName + ".XP");
|
||||
double dropChance = config.getDouble(type + "." + treasureName + ".Drop_Chance");
|
||||
int dropLevel = config.getInt(type + "." + treasureName + ".Drop_Level");
|
||||
DropLevelKeyConversionType conversionType;
|
||||
|
||||
//Check for legacy drop level values and convert
|
||||
if (getWrongKeyValue(type, treasureName, DropLevelKeyConversionType.LEGACY) != -1) {
|
||||
//Legacy Drop level, needs to be converted
|
||||
shouldWeUpdateFile = processAutomaticKeyConversion(type, shouldWeUpdateFile, treasureName, DropLevelKeyConversionType.LEGACY);
|
||||
}
|
||||
|
||||
//Check for a bad key that was accidentally shipped out to some users
|
||||
if (getWrongKeyValue(type, treasureName, DropLevelKeyConversionType.WRONG_KEY_STANDARD) != -1) {
|
||||
//Partially converted to the new system, I had a dyslexic moment so some configs have this
|
||||
shouldWeUpdateFile = processAutomaticKeyConversion(type, shouldWeUpdateFile, treasureName, DropLevelKeyConversionType.WRONG_KEY_STANDARD);
|
||||
}
|
||||
|
||||
//Check for a bad key that was accidentally shipped out to some users
|
||||
if (getWrongKeyValue(type, treasureName, DropLevelKeyConversionType.WRONG_KEY_RETRO) != -1) {
|
||||
//Partially converted to the new system, I had a dyslexic moment so some configs have this
|
||||
shouldWeUpdateFile = processAutomaticKeyConversion(type, shouldWeUpdateFile, treasureName, DropLevelKeyConversionType.WRONG_KEY_RETRO);
|
||||
}
|
||||
|
||||
int dropLevel = -1;
|
||||
|
||||
if (mcMMO.isRetroModeEnabled()) {
|
||||
dropLevel = config.getInt(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, -1);
|
||||
} else {
|
||||
dropLevel = config.getInt(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, -1);
|
||||
}
|
||||
|
||||
if (dropLevel == -1) {
|
||||
mcMMO.p.getLogger().severe("Could not find a Level_Requirement entry for treasure " + treasureName);
|
||||
mcMMO.p.getLogger().severe("Skipping treasure");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (xp < 0) {
|
||||
reason.add(treasureName + " has an invalid XP value: " + xp);
|
||||
@@ -113,10 +154,6 @@ public class TreasureConfig extends ConfigLoader {
|
||||
reason.add(treasureName + " has an invalid Drop_Chance: " + dropChance);
|
||||
}
|
||||
|
||||
if (dropLevel < 0) {
|
||||
reason.add(treasureName + " has an invalid Drop_Level: " + dropLevel);
|
||||
}
|
||||
|
||||
/*
|
||||
* Itemstack
|
||||
*/
|
||||
@@ -219,6 +256,62 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Apply our fix
|
||||
if (shouldWeUpdateFile) {
|
||||
try {
|
||||
config.save(getFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean processAutomaticKeyConversion(String type, boolean shouldWeUpdateTheFile, String treasureName, DropLevelKeyConversionType conversionType) {
|
||||
switch (conversionType) {
|
||||
case LEGACY:
|
||||
int legacyDropLevel = getWrongKeyValue(type, treasureName, conversionType); //Legacy only had one value, Retro Mode didn't have a setting
|
||||
//Config needs to be updated to be more specific
|
||||
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: Legacy] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
||||
config.set(type + "." + treasureName + LEGACY_DROP_LEVEL, null); //Remove legacy entry
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, legacyDropLevel * 10); //Multiply by 10 for Retro
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel);
|
||||
shouldWeUpdateTheFile = true;
|
||||
break;
|
||||
case WRONG_KEY_STANDARD:
|
||||
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: STANDARD] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
||||
int wrongKeyValueStandard = getWrongKeyValue(type, treasureName, conversionType);
|
||||
config.set(type + "." + treasureName + WRONG_KEY_ROOT, null); //We also kill the Retro key here as we have enough information for setting in values if needed
|
||||
|
||||
if (wrongKeyValueStandard != -1) {
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, wrongKeyValueStandard);
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, wrongKeyValueStandard * 10); //Multiply by 10 for Retro
|
||||
}
|
||||
|
||||
shouldWeUpdateTheFile = true;
|
||||
break;
|
||||
case WRONG_KEY_RETRO:
|
||||
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: RETRO] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
|
||||
int wrongKeyValueRetro = getWrongKeyValue(type, treasureName, conversionType);
|
||||
config.set(type + "." + treasureName + WRONG_KEY_ROOT, null); //We also kill the Retro key here as we have enough information for setting in values if needed
|
||||
|
||||
if (wrongKeyValueRetro != -1) {
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, wrongKeyValueRetro);
|
||||
}
|
||||
|
||||
shouldWeUpdateTheFile = true;
|
||||
break;
|
||||
}
|
||||
return shouldWeUpdateTheFile;
|
||||
}
|
||||
|
||||
private int getWrongKeyValue(String type, String treasureName, DropLevelKeyConversionType dropLevelKeyConversionType) {
|
||||
return switch (dropLevelKeyConversionType) {
|
||||
case LEGACY -> config.getInt(type + "." + treasureName + LEGACY_DROP_LEVEL, -1);
|
||||
case WRONG_KEY_STANDARD -> config.getInt(type + "." + treasureName + WRONG_KEY_VALUE_STANDARD, -1);
|
||||
case WRONG_KEY_RETRO -> config.getInt(type + "." + treasureName + WRONG_KEY_VALUE_RETRO, -1);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
private void AddHylianTreasure(String dropper, HylianTreasure treasure) {
|
||||
@@ -226,4 +319,10 @@ public class TreasureConfig extends ConfigLoader {
|
||||
hylianMap.put(dropper, new ArrayList<>());
|
||||
hylianMap.get(dropper).add(treasure);
|
||||
}
|
||||
|
||||
private enum DropLevelKeyConversionType {
|
||||
LEGACY,
|
||||
WRONG_KEY_STANDARD,
|
||||
WRONG_KEY_RETRO
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user