diff --git a/Changelog.txt b/Changelog.txt index dbbeff792..f48887c4b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,9 +1,14 @@ Version 2.1.183 + treasures.yml now has separate settings for Drop_Level for Standard/Retro mode (see notes / this change is automatic) Updated Russian locale (thanks ImDaniX) Added Donkeys to beat lore (thanks QuantumToasted) Alchemy guide now correctly labels Rabbit's foot for potion of leaping (thanks mldriscoll) Fixed a bug where sweet berry bushes would give XP in situations where they shouldn't + NOTES: + Previously treasures.yml would take drop_level and multiply it by 10 if you were on Retro Mode, this is confusing so it has been changed + treasures.yml will update old entries to follow the new format automatically, please review them to make sure they match expected values, and if not edit them and save then reboot your server + Version 2.1.182 Players now receive XP from harvesting Sweet Berry bushes (double XP for harvesting fully grown berries) Fixed an error when using mcMMO with Featherboard that broke mcMMO skill boards when using certain commands diff --git a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java index f01f41940..66e107d09 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java @@ -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 { diff --git a/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java index 41fa349ce..bfd814889 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java @@ -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); } /* diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index 370f2baa3..6e02731c9 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -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> 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) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/treasure/Treasure.java b/src/main/java/com/gmail/nossr50/datatypes/treasure/Treasure.java index 04ce7cca7..013849de2 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/treasure/Treasure.java +++ b/src/main/java/com/gmail/nossr50/datatypes/treasure/Treasure.java @@ -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; } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index cc3143e5a..66d698d1c 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -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(); } diff --git a/src/main/resources/treasures.yml b/src/main/resources/treasures.yml index 24de2fb86..f791b7416 100755 --- a/src/main/resources/treasures.yml +++ b/src/main/resources/treasures.yml @@ -1,133 +1,174 @@ # # Settings for Excavation's Archaeology -# If you are in retro mode, Drop_Level is multiplied by 10. ### Excavation: CAKE: Amount: 1 XP: 3000 Drop_Chance: 0.05 - Drop_Level: 75 + Drop_Level: + Standard: 75 + Retro_Mode: 750 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] GUNPOWDER: Amount: 1 XP: 30 Drop_Chance: 10.0 - Drop_Level: 10 + Drop_Level: + Standard: 10 + Retro_Mode: 1000 Drops_From: [Gravel] BONE: Amount: 1 XP: 30 Drop_Chance: 10.0 - Drop_Level: 20 + Drop_Level: + Standard: 20 + Retro_Mode: 200 Drops_From: [Gravel] APPLE: Amount: 1 XP: 100 Drop_Chance: 0.1 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Grass_Block, Mycelium] SLIME_BALL: Amount: 1 XP: 100 Drop_Chance: 5.0 - Drop_Level: 15 + Drop_Level: + Standard: 15 + Retro_Mode: 150 Drops_From: [Clay] BUCKET: Amount: 1 XP: 100 Drop_Chance: 0.1 - Drop_Level: 50 + Drop_Level: + Standard: 50 + Retro_Mode: 500 Drops_From: [Clay] NETHERRACK: Amount: 1 XP: 30 Drop_Chance: 0.5 - Drop_Level: 85 + Drop_Level: + Standard: 85 + Retro_Mode: 850 Drops_From: [Gravel] RED_MUSHROOM: Amount: 1 XP: 80 Drop_Chance: 0.5 - Drop_Level: 50 + Drop_Level: + Standard: 50 + Retro_Mode: 500 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Mycelium] BROWN_MUSHROOM: Amount: 1 XP: 80 Drop_Chance: 0.5 - Drop_Level: 50 + Drop_Level: + Standard: 50 + Retro_Mode: 500 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Mycelium] EGG: Amount: 1 XP: 100 Drop_Chance: 1.0 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Grass_Block] SOUL_SAND: Amount: 1 XP: 80 Drop_Chance: 0.5 - Drop_Level: 65 + Drop_Level: + Standard: 65 + Retro_Mode: 650 Drops_From: [Sand, Red_Sand] CLOCK: Amount: 1 XP: 100 Drop_Chance: 0.1 - Drop_Level: 50 + Drop_Level: + Standard: 50 + Retro_Mode: 500 Drops_From: [Clay] COBWEB: Amount: 1 XP: 150 Drop_Chance: 5.0 - Drop_Level: 75 + Drop_Level: + Standard: 75 + Retro_Mode: 750 Drops_From: [Clay] STRING: Amount: 1 XP: 200 Drop_Chance: 5.0 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Clay] GLOWSTONE_DUST: Amount: 1 XP: 80 Drop_Chance: 5.0 - Drop_Level: 5 + Drop_Level: + Standard: 5 + Retro_Mode: 50 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Mycelium] MUSIC_DISC_13: Amount: 1 XP: 3000 Drop_Chance: 0.05 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] MUSIC_DISC_CAT: Amount: 1 XP: 3000 Drop_Chance: 0.05 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] DIAMOND: Amount: 1 XP: 1000 Drop_Chance: 0.13 - Drop_Level: 35 + Drop_Level: + Standard: 35 + Retro_Mode: 350 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] COCOA_BEANS: Amount: 1 XP: 100 Drop_Chance: 1.33 - Drop_Level: 35 + Drop_Level: + Standard: 35 + Retro_Mode: 350 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Mycelium] QUARTZ: Amount: 1 XP: 100 Drop_Chance: 0.5 - Drop_Level: 85 + Drop_Level: + Standard: 85 + Retro_Mode: 850 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand, Soul_Soil] NAME_TAG: Amount: 1 XP: 3000 Drop_Chance: 0.05 - Drop_Level: 25 + Drop_Level: + Standard: 25 + Retro_Mode: 250 Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand, Soul_Soil] # # Settings for Hylian Luck @@ -138,53 +179,71 @@ Hylian_Luck: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Bushes] PUMPKIN_SEEDS: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Bushes] COCOA_BEANS: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Bushes] CARROT: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Flowers] POTATO: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Flowers] APPLE: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Flowers] EMERALD: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Pots] DIAMOND: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Pots] GOLD_NUGGET: Amount: 1 XP: 0 Drop_Chance: 100.0 - Drop_Level: 0 + Drop_Level: + Standard: 0 + Retro_Mode: 0 Drops_From: [Pots] \ No newline at end of file