mcMMO/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java
nossr50 fa33fa3d32 Revert 3 commits (work will be continued in branch)
Revert "Disabling mcMMO when the config breaks is dumb"

This reverts commit 86e7bfbf89f027fec63730fa5a5da1884ed8a098.

Revert "Config validation rewrite part 1"

This reverts commit 16e90da8fdfe49741074294b9d7cc6438f6d27a2.

Revert "Update changelog"

This reverts commit 0ccd89fad4897b4a15e36437bed0d2f9b4ef7544.
2022-03-17 13:49:46 -07:00

46 lines
1.2 KiB
Java

package com.gmail.nossr50.config.party;
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 BukkitConfig {
private static ItemWeightConfig instance;
private ItemWeightConfig() {
super("itemweights.yml");
}
public static ItemWeightConfig getInstance() {
if (instance == null) {
instance = new ItemWeightConfig();
}
return instance;
}
public int getItemWeight(Material material) {
return config.getInt("Item_Weights." + StringUtils.getPrettyItemString(material).replace(" ", "_"), config.getInt("Item_Weights.Default"));
}
public HashSet<Material> getMiscItems() {
HashSet<Material> miscItems = new HashSet<>();
for (String item : config.getStringList("Party_Shareables.Misc_Items")) {
Material material = Material.getMaterial(item.toUpperCase(Locale.ENGLISH));
if (material != null) {
miscItems.add(material);
}
}
return miscItems;
}
@Override
protected void loadKeys() {
}
}