mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
treasures.yml now has specific entries for Standard/Retro
This commit is contained in:
@ -43,7 +43,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
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);
|
||||
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); //TODO: Doesn't make sense to default to 4 for everything
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -164,7 +164,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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.config.treasure;
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
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,6 +15,7 @@ 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;
|
||||
@ -21,6 +23,9 @@ import java.util.List;
|
||||
public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
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 LEGACY_DROP_LEVEL = ".Drop_Level";
|
||||
private static TreasureConfig instance;
|
||||
|
||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<>();
|
||||
@ -60,6 +65,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
private void loadTreasures(String type) {
|
||||
boolean updatedFile = false;
|
||||
boolean isExcavation = type.equals("Excavation");
|
||||
boolean isHylian = type.equals("Hylian_Luck");
|
||||
|
||||
@ -103,7 +109,29 @@ 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");
|
||||
int legacyDropLevel = config.getInt(type + "." + treasureName + LEGACY_DROP_LEVEL, -1);
|
||||
int dropLevel = -1;
|
||||
|
||||
if(legacyDropLevel >= 0) {
|
||||
//Config needs to be updated to be more specific
|
||||
mcMMO.p.getLogger().info("(" + treasureName + ") Updating Drop_Level in treasures.yml for treasure to match new expected format");
|
||||
config.set(type + "." + treasureName + LEGACY_DROP_LEVEL, null);
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, legacyDropLevel * 10);
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel);
|
||||
updatedFile = true;
|
||||
}
|
||||
|
||||
if(mcMMO.isRetroModeEnabled()) {
|
||||
dropLevel = config.getInt(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, 0);
|
||||
} else {
|
||||
dropLevel = config.getInt(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, 0);
|
||||
}
|
||||
|
||||
if(dropLevel < 0) {
|
||||
mcMMO.p.getLogger().info("Treasure drop level wasn't valid, using a default value.");
|
||||
//Set it to the "max" if we don't have a drop level
|
||||
dropLevel = 0;
|
||||
}
|
||||
|
||||
if (xp < 0) {
|
||||
reason.add(treasureName + " has an invalid XP value: " + xp);
|
||||
@ -113,9 +141,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 +244,15 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Apply our fix
|
||||
if(updatedFile) {
|
||||
try {
|
||||
config.save(getFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddHylianTreasure(String dropper, HylianTreasure treasure) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.datatypes.treasure;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public abstract class Treasure {
|
||||
@ -41,10 +40,6 @@ public abstract class Treasure {
|
||||
}
|
||||
|
||||
public int getDropLevel() {
|
||||
//If they are in retro mode all requirements are scaled up by 10
|
||||
if(Config.getInstance().getIsRetroMode())
|
||||
return dropLevel * 10;
|
||||
|
||||
return dropLevel;
|
||||
}
|
||||
|
||||
|
@ -163,6 +163,9 @@ public class mcMMO extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
try {
|
||||
//Store this value so other plugins can check it
|
||||
isRetroModeEnabled = Config.getInstance().getIsRetroMode();
|
||||
|
||||
//Platform Manager
|
||||
platformManager = new PlatformManager();
|
||||
|
||||
@ -190,9 +193,6 @@ public class mcMMO extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
//Store this value so other plugins can check it
|
||||
isRetroModeEnabled = Config.getInstance().getIsRetroMode();
|
||||
|
||||
if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) {
|
||||
checkModConfigs();
|
||||
}
|
||||
|
Reference in New Issue
Block a user