mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
Mining Bonus Drop registration
This commit is contained in:
parent
5c6f0e8cbf
commit
ecce631527
@ -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<Material> materials)
|
||||
public void addToWhitelistByMaterial(List<Material> 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<String> 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
|
||||
|
@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
5
src/main/java/com/gmail/nossr50/config/Validation.java
Normal file
5
src/main/java/com/gmail/nossr50/config/Validation.java
Normal file
@ -0,0 +1,5 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
public interface Validation {
|
||||
void validate();
|
||||
}
|
@ -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<String> 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<String> bonusDrops = DEFAULT_BONUS_DROPS;
|
||||
|
||||
public ArrayList<String> getBonusDrops() {
|
||||
return bonusDrops;
|
||||
}
|
||||
}
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user