diff --git a/src/main/java/com/gmail/nossr50/config/BonusDropManager.java b/src/main/java/com/gmail/nossr50/config/BonusDropManager.java index 149d3a208..f63bac50a 100644 --- a/src/main/java/com/gmail/nossr50/config/BonusDropManager.java +++ b/src/main/java/com/gmail/nossr50/config/BonusDropManager.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.config; +import com.gmail.nossr50.mcMMO; import org.bukkit.Material; import java.util.HashMap; @@ -32,7 +33,7 @@ public class BonusDropManager implements Unload { * Adds materials to the bonus drop whitelist * @param materials target material list */ - public void addToWhitelist(List materials) + public void addToWhitelistByMaterial(List materials) { for(Material material : materials) { @@ -40,6 +41,25 @@ public class BonusDropManager implements Unload { } } + /** + * Adds materials to the bonus drop whitelist + * @param materials target material list + */ + public void addToWhitelistByNameID(List materials) + { + for(String material : materials) + { + Material m = Material.matchMaterial(material); + if(m == null) + { + mcMMO.p.getLogger().severe("Error registering Bonus Drop -- Invalid Minecraft Name ID: "+material); + continue; + } + + registerMaterial(m, true); + } + } + /** * Adds a material to the bonus drop whitelist * @param material target material diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index 88bed0a1d..889e35752 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -379,9 +379,14 @@ public final class ConfigManager { */ public void registerBonusDrops() { - bonusDropManager.addToWhitelist(configMining.getBonusDrops()); - bonusDropManager.addToWhitelist(configHerbalism.getBonusDrops()); - bonusDropManager.addToWhitelist(configWoodcutting.getBonusDrops()); + bonusDropManager.addToWhitelistByNameID(getConfigMining().getBonusDrops()); + bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops()); + bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops()); + } + + public void validateConfigs() + { + } /* diff --git a/src/main/java/com/gmail/nossr50/config/Validation.java b/src/main/java/com/gmail/nossr50/config/Validation.java new file mode 100644 index 000000000..33f1f8e12 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/Validation.java @@ -0,0 +1,5 @@ +package com.gmail.nossr50.config; + +public interface Validation { + void validate(); +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/mining/ConfigMining.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/mining/ConfigMining.java index 9ea2240a4..ce4b4e5b3 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/mining/ConfigMining.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/mining/ConfigMining.java @@ -1,8 +1,54 @@ package com.gmail.nossr50.config.hocon.skills.mining; +import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; +import java.util.ArrayList; + +import static org.bukkit.Material.*; + @ConfigSerializable public class ConfigMining { + private static final ArrayList DEFAULT_BONUS_DROPS; + + static { + DEFAULT_BONUS_DROPS = new ArrayList<>(); + + DEFAULT_BONUS_DROPS.add(ANDESITE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(DIORITE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(GRANITE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(COAL_ORE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(COAL.getKey().toString()); + DEFAULT_BONUS_DROPS.add(DIAMOND_ORE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(DIAMOND.getKey().toString()); + DEFAULT_BONUS_DROPS.add(EMERALD_ORE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(EMERALD.getKey().toString()); + DEFAULT_BONUS_DROPS.add(END_STONE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(GLOWSTONE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(GLOWSTONE_DUST.getKey().toString()); + DEFAULT_BONUS_DROPS.add(GOLD_ORE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(IRON_ORE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(IRON_INGOT.getKey().toString()); + DEFAULT_BONUS_DROPS.add(LAPIS_ORE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(LAPIS_LAZULI.getKey().toString()); + DEFAULT_BONUS_DROPS.add(MOSSY_COBBLESTONE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(NETHERRACK.getKey().toString()); + DEFAULT_BONUS_DROPS.add(OBSIDIAN.getKey().toString()); + DEFAULT_BONUS_DROPS.add(NETHER_QUARTZ_ORE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(QUARTZ.getKey().toString()); + DEFAULT_BONUS_DROPS.add(REDSTONE_ORE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(REDSTONE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(SANDSTONE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(STONE.getKey().toString()); + DEFAULT_BONUS_DROPS.add(COBBLESTONE.getKey().toString()); + } + + @Setting(value = "Z-Bonus-Drops", comment = "Bonus drops will be allowed for these blocks." + + "\nUse Minecraft friendly names for entries, not Bukkit material names.") + private ArrayList bonusDrops = DEFAULT_BONUS_DROPS; + + public ArrayList getBonusDrops() { + return bonusDrops; + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/salvage/ConfigSalvage.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/salvage/ConfigSalvage.java index 85d3e57b4..d88f53681 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/salvage/ConfigSalvage.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/salvage/ConfigSalvage.java @@ -6,7 +6,6 @@ import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import java.util.ArrayList; -import java.util.List; @ConfigSerializable public class ConfigSalvage { diff --git a/src/main/java/com/gmail/nossr50/skills/repair/repairables/Repairable.java b/src/main/java/com/gmail/nossr50/skills/repair/repairables/Repairable.java index 5f66af73a..652090840 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/repairables/Repairable.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/repairables/Repairable.java @@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory; import com.gmail.nossr50.datatypes.skills.ItemType; import com.gmail.nossr50.util.ItemUtils; import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/salvageables/Salvageable.java b/src/main/java/com/gmail/nossr50/skills/salvage/salvageables/Salvageable.java index 3df741d61..3f3e31aac 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/salvageables/Salvageable.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/salvageables/Salvageable.java @@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory; import com.gmail.nossr50.datatypes.skills.ItemType; import com.gmail.nossr50.util.ItemUtils; import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; /** * Represents a 'Salvageable' item