mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Only grab List<String> if it's a proper list
This commit is contained in:
parent
4ab5e5e925
commit
049b76f651
@ -4,8 +4,6 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
|
||||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
|
import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
@ -415,12 +413,16 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a a List of type String from the Configuration file
|
* Returns the children of a specific node
|
||||||
* @param path path to the node
|
* @param path the path to the parent node
|
||||||
* @return a list of strings at the node, if null it will most likely zero initialize (empty list)
|
* @return the list of children for the target parent node
|
||||||
* @throws ObjectMappingException
|
|
||||||
*/
|
*/
|
||||||
public List<String> getStringValueList(String... path) throws ObjectMappingException {
|
public List<? extends ConfigurationNode> getChildren(String... path) {
|
||||||
return userRootNode.getList(TypeToken.of(String.class));
|
return userRootNode.getNode(path).getChildrenList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getListFromNode(String... path) throws ObjectMappingException
|
||||||
|
{
|
||||||
|
return userRootNode.getNode(path).getList(TypeToken.of(String.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
|||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -48,27 +48,27 @@ public class RepairConfig extends ConfigCollection {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
try {
|
|
||||||
//Grab the "keys" under the Repairables node
|
//Grab the "keys" under the Repairables node
|
||||||
ArrayList<String> keys = new ArrayList<>(getStringValueList(REPAIRABLES));
|
ArrayList<ConfigurationNode> repairChildrenNodes = new ArrayList<>(getChildren(REPAIRABLES));
|
||||||
|
|
||||||
//TODO: Remove Debug
|
//TODO: Remove Debug
|
||||||
if(keys.size() <= 0) {
|
if(repairChildrenNodes.size() <= 0) {
|
||||||
mcMMO.p.getLogger().severe("DEBUG: Repair MultiConfigContainer key list is empty");
|
mcMMO.p.getLogger().severe("DEBUG: Repair MultiConfigContainer key list is empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String key : keys) {
|
for (ConfigurationNode repairNode : repairChildrenNodes) {
|
||||||
// Validate all the things!
|
// Validate all the things!
|
||||||
List<String> errorMessages = new ArrayList<String>();
|
List<String> errorMessages = new ArrayList<String>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Match the name of the key to a Material constant definition
|
* Match the name of the key to a Material constant definition
|
||||||
*/
|
*/
|
||||||
Material itemMaterial = Material.matchMaterial(key);
|
String repairChildNodeName = repairNode.getString();
|
||||||
|
Material itemMaterial = Material.matchMaterial(repairChildNodeName);
|
||||||
|
|
||||||
if (itemMaterial == null) {
|
if (itemMaterial == null) {
|
||||||
mcMMO.p.getLogger().severe("Repair Invalid material: " + key);
|
mcMMO.p.getLogger().severe("Repair Invalid material: " + repairChildNodeName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,9 +76,9 @@ public class RepairConfig extends ConfigCollection {
|
|||||||
* Determine Repair Material Type
|
* Determine Repair Material Type
|
||||||
*/
|
*/
|
||||||
MaterialType repairMaterialType = MaterialType.OTHER;
|
MaterialType repairMaterialType = MaterialType.OTHER;
|
||||||
String repairMaterialTypeString = getRepairMaterialTypeString(key);
|
String repairMaterialTypeString = getRepairMaterialTypeString(repairChildNodeName);
|
||||||
|
|
||||||
if (hasNode(REPAIRABLES, key, MATERIAL_TYPE)) {
|
if (hasNode(REPAIRABLES, repairChildNodeName, MATERIAL_TYPE)) {
|
||||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isWoodTool(repairItem)) {
|
if (ItemUtils.isWoodTool(repairItem)) {
|
||||||
@ -109,40 +109,40 @@ public class RepairConfig extends ConfigCollection {
|
|||||||
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString.toUpperCase());
|
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString.toUpperCase());
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
errorMessages.add("Repair Config: " + key + " has an invalid " + MATERIAL_TYPE + " of " + repairMaterialTypeString);
|
errorMessages.add("Repair Config: " + repairChildNodeName + " has an invalid " + MATERIAL_TYPE + " of " + repairMaterialTypeString);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repair Material
|
// Repair Material
|
||||||
String repairMaterialName = getRepairMaterialStringName(key);
|
String repairMaterialName = getRepairMaterialStringName(repairChildNodeName);
|
||||||
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultMaterial() : Material.matchMaterial(repairMaterialName));
|
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultMaterial() : Material.matchMaterial(repairMaterialName));
|
||||||
|
|
||||||
if (repairMaterial == null) {
|
if (repairMaterial == null) {
|
||||||
errorMessages.add(key + " has an invalid repair material: " + repairMaterialName);
|
errorMessages.add(repairChildNodeName + " has an invalid repair material: " + repairMaterialName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maximum Durability
|
// Maximum Durability
|
||||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : getRepairableMaximumDurability(key));
|
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : getRepairableMaximumDurability(repairChildNodeName));
|
||||||
|
|
||||||
if (maximumDurability <= 0) {
|
if (maximumDurability <= 0) {
|
||||||
maximumDurability = getRepairableMaximumDurability(key);
|
maximumDurability = getRepairableMaximumDurability(repairChildNodeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maximumDurability <= 0) {
|
if (maximumDurability <= 0) {
|
||||||
errorMessages.add("Maximum durability of " + key + " must be greater than 0!");
|
errorMessages.add("Maximum durability of " + repairChildNodeName + " must be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item Type
|
// Item Type
|
||||||
ItemType repairItemType = ItemType.OTHER;
|
ItemType repairItemType = ItemType.OTHER;
|
||||||
String repairItemTypeString = "";
|
String repairItemTypeString = "";
|
||||||
|
|
||||||
if(hasNode(REPAIRABLES, key, ITEM_TYPE))
|
if(hasNode(REPAIRABLES, repairChildNodeName, ITEM_TYPE))
|
||||||
repairItemTypeString = getStringValue(REPAIRABLES, key, ITEM_TYPE);
|
repairItemTypeString = getStringValue(REPAIRABLES, repairChildNodeName, ITEM_TYPE);
|
||||||
else
|
else
|
||||||
repairItemTypeString = "OTHER";
|
repairItemTypeString = "OTHER";
|
||||||
|
|
||||||
if (!hasNode(REPAIRABLES, key, ITEM_TYPE) && itemMaterial != null) {
|
if (!hasNode(REPAIRABLES, repairChildNodeName, ITEM_TYPE) && itemMaterial != null) {
|
||||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isMinecraftTool(repairItem)) {
|
if (ItemUtils.isMinecraftTool(repairItem)) {
|
||||||
@ -157,22 +157,22 @@ public class RepairConfig extends ConfigCollection {
|
|||||||
repairItemType = ItemType.valueOf(repairItemTypeString);
|
repairItemType = ItemType.valueOf(repairItemTypeString);
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
errorMessages.add(key + " has an invalid ItemType of " + repairItemTypeString);
|
errorMessages.add(repairChildNodeName + " has an invalid ItemType of " + repairItemTypeString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte repairMetadata = -1;
|
byte repairMetadata = -1;
|
||||||
|
|
||||||
//Set the metadata byte
|
//Set the metadata byte
|
||||||
if(hasNode(REPAIRABLES, key, REPAIR_MATERIAL, METADATA))
|
if(hasNode(REPAIRABLES, repairChildNodeName, REPAIR_MATERIAL, METADATA))
|
||||||
repairMetadata = (byte) getIntValue(REPAIRABLES, key, REPAIR_MATERIAL, METADATA);
|
repairMetadata = (byte) getIntValue(REPAIRABLES, repairChildNodeName, REPAIR_MATERIAL, METADATA);
|
||||||
|
|
||||||
int minimumLevel = getIntValue(REPAIRABLES, key, MINIMUM_LEVEL);
|
int minimumLevel = getIntValue(REPAIRABLES, repairChildNodeName, MINIMUM_LEVEL);
|
||||||
|
|
||||||
double xpMultiplier = 1;
|
double xpMultiplier = 1;
|
||||||
|
|
||||||
if(hasNode(REPAIRABLES, key, XP_MULTIPLIER))
|
if(hasNode(REPAIRABLES, repairChildNodeName, XP_MULTIPLIER))
|
||||||
xpMultiplier = getDoubleValue(REPAIRABLES, key, XP_MULTIPLIER);
|
xpMultiplier = getDoubleValue(REPAIRABLES, repairChildNodeName, XP_MULTIPLIER);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ public class RepairConfig extends ConfigCollection {
|
|||||||
int minimumQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata);
|
int minimumQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata);
|
||||||
|
|
||||||
if (minimumQuantity <= 0) {
|
if (minimumQuantity <= 0) {
|
||||||
minimumQuantity = getIntValue(REPAIRABLES, key, MINIMUM_QUANTITY);
|
minimumQuantity = getIntValue(REPAIRABLES, repairChildNodeName, MINIMUM_QUANTITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -200,7 +200,7 @@ public class RepairConfig extends ConfigCollection {
|
|||||||
//Validate Minimum Quantity
|
//Validate Minimum Quantity
|
||||||
if (minimumQuantity <= 0) {
|
if (minimumQuantity <= 0) {
|
||||||
minimumQuantity = 2;
|
minimumQuantity = 2;
|
||||||
errorMessages.add("Minimum quantity for "+key+" in repair config should be above 0");
|
errorMessages.add("Minimum quantity for "+repairChildNodeName+" in repair config should be above 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
Repairable repairable = RepairableFactory.getRepairable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||||
@ -211,9 +211,6 @@ public class RepairConfig extends ConfigCollection {
|
|||||||
mcMMO.p.getLogger().warning(error);
|
mcMMO.p.getLogger().warning(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ObjectMappingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getRepairMaterialTypeString(String key) {
|
private String getRepairMaterialTypeString(String key) {
|
||||||
|
@ -8,7 +8,7 @@ import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
|||||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -44,20 +44,19 @@ public class SalvageConfig extends ConfigCollection {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
|
|
||||||
try {
|
|
||||||
//Grab the "keys" under the Repairables node
|
//Grab the "keys" under the Repairables node
|
||||||
ArrayList<String> keys = new ArrayList<>(getStringValueList(SALVAGEABLES));
|
ArrayList<ConfigurationNode> salvageChildrenNodes = new ArrayList<>(getChildren(SALVAGEABLES));
|
||||||
|
|
||||||
for (String key : keys) {
|
for (ConfigurationNode salvageChildNode : salvageChildrenNodes) {
|
||||||
// Validate all the things!
|
// Validate all the things!
|
||||||
List<String> errorMessages = new ArrayList<String>();
|
List<String> errorMessages = new ArrayList<String>();
|
||||||
|
|
||||||
// ItemStack Material
|
// ItemStack Material
|
||||||
Material itemMaterial = Material.matchMaterial(key);
|
String salvageChildNodeName = salvageChildNode.getString();
|
||||||
|
Material itemMaterial = Material.matchMaterial(salvageChildNodeName);
|
||||||
|
|
||||||
if (itemMaterial == null) {
|
if (itemMaterial == null) {
|
||||||
errorMessages.add("Salvage Config: Invalid material - " + key);
|
errorMessages.add("Salvage Config: Invalid material - " + salvageChildNodeName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,12 +65,12 @@ public class SalvageConfig extends ConfigCollection {
|
|||||||
|
|
||||||
String salvageMaterialTypeString;
|
String salvageMaterialTypeString;
|
||||||
|
|
||||||
if(hasNode(SALVAGEABLES, key, MATERIAL_TYPE))
|
if(hasNode(SALVAGEABLES, salvageChildNodeName, MATERIAL_TYPE))
|
||||||
salvageMaterialTypeString = getStringValue(SALVAGEABLES, key, MATERIAL_TYPE);
|
salvageMaterialTypeString = getStringValue(SALVAGEABLES, salvageChildNodeName, MATERIAL_TYPE);
|
||||||
else
|
else
|
||||||
salvageMaterialTypeString = "OTHER";
|
salvageMaterialTypeString = "OTHER";
|
||||||
|
|
||||||
if (!hasNode(SALVAGEABLES, key, MATERIAL_TYPE)) {
|
if (!hasNode(SALVAGEABLES, salvageChildNodeName, MATERIAL_TYPE)) {
|
||||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isWoodTool(salvageItem)) {
|
if (ItemUtils.isWoodTool(salvageItem)) {
|
||||||
@ -93,16 +92,16 @@ public class SalvageConfig extends ConfigCollection {
|
|||||||
try {
|
try {
|
||||||
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase());
|
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase());
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
errorMessages.add("Salvage Config: " + key + " has an invalid MaterialType of " + salvageMaterialTypeString);
|
errorMessages.add("Salvage Config: " + salvageChildNodeName + " has an invalid MaterialType of " + salvageMaterialTypeString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Salvage Material
|
// Salvage Material
|
||||||
String salvageMaterialName = getStringValue(SALVAGEABLES, key, SALVAGE_MATERIAL);
|
String salvageMaterialName = getStringValue(SALVAGEABLES, salvageChildNodeName, SALVAGE_MATERIAL);
|
||||||
Material salvageMaterial = (salvageMaterialName == null ? salvageMaterialType.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
Material salvageMaterial = (salvageMaterialName == null ? salvageMaterialType.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
||||||
|
|
||||||
if (salvageMaterial == null) {
|
if (salvageMaterial == null) {
|
||||||
errorMessages.add(key + " has an invalid salvage material: " + salvageMaterialName);
|
errorMessages.add(salvageChildNodeName + " has an invalid salvage material: " + salvageMaterialName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,12 +113,12 @@ public class SalvageConfig extends ConfigCollection {
|
|||||||
|
|
||||||
String salvageItemTypeString;
|
String salvageItemTypeString;
|
||||||
|
|
||||||
if(hasNode(SALVAGEABLES, key, ITEM_TYPE))
|
if(hasNode(SALVAGEABLES, salvageChildNodeName, ITEM_TYPE))
|
||||||
salvageItemTypeString = getStringValue(SALVAGEABLES, key, ITEM_TYPE);
|
salvageItemTypeString = getStringValue(SALVAGEABLES, salvageChildNodeName, ITEM_TYPE);
|
||||||
else
|
else
|
||||||
salvageItemTypeString = "OTHER";
|
salvageItemTypeString = "OTHER";
|
||||||
|
|
||||||
if (!hasNode(SALVAGEABLES, key, ITEM_TYPE)) {
|
if (!hasNode(SALVAGEABLES, salvageChildNodeName, ITEM_TYPE)) {
|
||||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isMinecraftTool(salvageItem)) {
|
if (ItemUtils.isMinecraftTool(salvageItem)) {
|
||||||
@ -131,26 +130,26 @@ public class SalvageConfig extends ConfigCollection {
|
|||||||
try {
|
try {
|
||||||
salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase());
|
salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase());
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
errorMessages.add("Salvage Config: " + key + " has an invalid " + ITEM_TYPE + " of " + salvageItemTypeString);
|
errorMessages.add("Salvage Config: " + salvageChildNodeName + " has an invalid " + ITEM_TYPE + " of " + salvageItemTypeString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte salvageMetadata = -1;
|
byte salvageMetadata = -1;
|
||||||
|
|
||||||
if(hasNode(SALVAGEABLES, key, SALVAGE_MATERIAL, METADATA))
|
if(hasNode(SALVAGEABLES, salvageChildNodeName, SALVAGE_MATERIAL, METADATA))
|
||||||
salvageMetadata = (byte) getIntValue(SALVAGEABLES, key, SALVAGE_MATERIAL, METADATA);
|
salvageMetadata = (byte) getIntValue(SALVAGEABLES, salvageChildNodeName, SALVAGE_MATERIAL, METADATA);
|
||||||
|
|
||||||
int minimumLevel = getIntValue(SALVAGEABLES, key, MINIMUM_LEVEL);
|
int minimumLevel = getIntValue(SALVAGEABLES, salvageChildNodeName, MINIMUM_LEVEL);
|
||||||
double xpMultiplier = 1;
|
double xpMultiplier = 1;
|
||||||
|
|
||||||
if(hasNode(SALVAGEABLES, key, XP_MULTIPLIER))
|
if(hasNode(SALVAGEABLES, salvageChildNodeName, XP_MULTIPLIER))
|
||||||
xpMultiplier = getDoubleValue(SALVAGEABLES, key, XP_MULTIPLIER);
|
xpMultiplier = getDoubleValue(SALVAGEABLES, salvageChildNodeName, XP_MULTIPLIER);
|
||||||
|
|
||||||
// Maximum Quantity
|
// Maximum Quantity
|
||||||
int maximumQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata);
|
int maximumQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata);
|
||||||
|
|
||||||
if(hasNode(SALVAGEABLES, key, MAXIMUM_QUANTITY))
|
if(hasNode(SALVAGEABLES, salvageChildNodeName, MAXIMUM_QUANTITY))
|
||||||
maximumQuantity = getIntValue(SALVAGEABLES, key, MAXIMUM_QUANTITY);
|
maximumQuantity = getIntValue(SALVAGEABLES, salvageChildNodeName, MAXIMUM_QUANTITY);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -173,10 +172,6 @@ public class SalvageConfig extends ConfigCollection {
|
|||||||
mcMMO.p.getLogger().warning(issue);
|
mcMMO.p.getLogger().warning(issue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (ObjectMappingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import ninja.leaping.configurate.objectmapping.Setting;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarStyle;
|
import org.bukkit.boss.BarStyle;
|
||||||
|
@ -66,7 +66,7 @@ public class ItemWeightConfig extends Config {
|
|||||||
HashSet<Material> miscItems = new HashSet<Material>();
|
HashSet<Material> miscItems = new HashSet<Material>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (String item : getStringValueList(PARTY_SHAREABLES, MISC_ITEMS)) {
|
for (String item : getListFromNode(PARTY_SHAREABLES, MISC_ITEMS)) {
|
||||||
Material material = Material.getMaterial(item.toUpperCase());
|
Material material = Material.getMaterial(item.toUpperCase());
|
||||||
|
|
||||||
if (material != null) {
|
if (material != null) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.config.skills.alchemy;
|
package com.gmail.nossr50.config.skills.alchemy;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.ConfigCollection;
|
import com.gmail.nossr50.config.ConfigCollection;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -98,14 +97,14 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
|
|
||||||
private void loadConcoctions() {
|
private void loadConcoctions() {
|
||||||
try {
|
try {
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierOne, getStringValueList(CONCOCTIONS, TIER_ONE_INGREDIENTS));
|
loadConcoctionsTier(concoctionsIngredientsTierOne, getListFromNode(CONCOCTIONS, TIER_ONE_INGREDIENTS));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierTwo, getStringValueList(CONCOCTIONS, TIER_TWO_INGREDIENTS));
|
loadConcoctionsTier(concoctionsIngredientsTierTwo, getListFromNode(CONCOCTIONS, TIER_TWO_INGREDIENTS));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierThree, getStringValueList(CONCOCTIONS, TIER_THREE_INGREDIENTS));
|
loadConcoctionsTier(concoctionsIngredientsTierThree, getListFromNode(CONCOCTIONS, TIER_THREE_INGREDIENTS));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierFour, getStringValueList(CONCOCTIONS, TIER_FOUR_INGREDIENTS));
|
loadConcoctionsTier(concoctionsIngredientsTierFour, getListFromNode(CONCOCTIONS, TIER_FOUR_INGREDIENTS));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierFive, getStringValueList(CONCOCTIONS, TIER_FIVE_INGREDIENTS));
|
loadConcoctionsTier(concoctionsIngredientsTierFive, getListFromNode(CONCOCTIONS, TIER_FIVE_INGREDIENTS));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierSix, getStringValueList(CONCOCTIONS, TIER_SIX_INGREDIENTS));
|
loadConcoctionsTier(concoctionsIngredientsTierSix, getListFromNode(CONCOCTIONS, TIER_SIX_INGREDIENTS));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierSeven, getStringValueList(CONCOCTIONS, TIER_SEVEN_INGREDIENTS));
|
loadConcoctionsTier(concoctionsIngredientsTierSeven, getListFromNode(CONCOCTIONS, TIER_SEVEN_INGREDIENTS));
|
||||||
loadConcoctionsTier(concoctionsIngredientsTierEight, getStringValueList(CONCOCTIONS, TIER_EIGHT_INGREDIENTS));
|
loadConcoctionsTier(concoctionsIngredientsTierEight, getListFromNode(CONCOCTIONS, TIER_EIGHT_INGREDIENTS));
|
||||||
|
|
||||||
concoctionsIngredientsTierTwo.addAll(concoctionsIngredientsTierOne);
|
concoctionsIngredientsTierTwo.addAll(concoctionsIngredientsTierOne);
|
||||||
concoctionsIngredientsTierThree.addAll(concoctionsIngredientsTierTwo);
|
concoctionsIngredientsTierThree.addAll(concoctionsIngredientsTierTwo);
|
||||||
@ -114,15 +113,14 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
concoctionsIngredientsTierSix.addAll(concoctionsIngredientsTierFive);
|
concoctionsIngredientsTierSix.addAll(concoctionsIngredientsTierFive);
|
||||||
concoctionsIngredientsTierSeven.addAll(concoctionsIngredientsTierSix);
|
concoctionsIngredientsTierSeven.addAll(concoctionsIngredientsTierSix);
|
||||||
concoctionsIngredientsTierEight.addAll(concoctionsIngredientsTierSeven);
|
concoctionsIngredientsTierEight.addAll(concoctionsIngredientsTierSeven);
|
||||||
|
|
||||||
} catch (ObjectMappingException e) {
|
} catch (ObjectMappingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConcoctionsTier(List<ItemStack> ingredientList, List<String> ingredientStrings) {
|
private void loadConcoctionsTier(List<ItemStack> ingredientList, List<String> ingredients) {
|
||||||
if (ingredientStrings != null && ingredientStrings.size() > 0) {
|
if (ingredients != null && ingredients.size() > 0) {
|
||||||
for (String ingredientString : ingredientStrings) {
|
for (String ingredientString : ingredients) {
|
||||||
ItemStack ingredient = loadIngredient(ingredientString);
|
ItemStack ingredient = loadIngredient(ingredientString);
|
||||||
|
|
||||||
if (ingredient != null) {
|
if (ingredient != null) {
|
||||||
@ -140,9 +138,9 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
int pass = 0;
|
int pass = 0;
|
||||||
int fail = 0;
|
int fail = 0;
|
||||||
|
|
||||||
try {
|
for (ConfigurationNode potionNode : getChildren(POTIONS)) {
|
||||||
for (String potionName : getStringValueList(POTIONS)) {
|
|
||||||
//Grab the child node corresponding to this potion
|
//Grab the child node corresponding to this potion
|
||||||
|
String potionName = potionNode.getString();
|
||||||
AlchemyPotion potion = loadPotion(getUserRootNode().getNode(POTIONS, potionName));
|
AlchemyPotion potion = loadPotion(getUserRootNode().getNode(POTIONS, potionName));
|
||||||
|
|
||||||
if (potion != null) {
|
if (potion != null) {
|
||||||
@ -154,9 +152,6 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.debug("Loaded " + pass + " Alchemy potions, skipped " + fail + ".");
|
mcMMO.p.debug("Loaded " + pass + " Alchemy potions, skipped " + fail + ".");
|
||||||
} catch (ObjectMappingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.config.MainConfig;
|
|||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.player.UniqueDataType;
|
import com.gmail.nossr50.datatypes.player.UniqueDataType;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
@ -2,14 +2,12 @@ package com.gmail.nossr50.party;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.MainConfig;
|
import com.gmail.nossr50.config.MainConfig;
|
||||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyLeader;
|
import com.gmail.nossr50.datatypes.party.PartyLeader;
|
||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent;
|
import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.fishing;
|
package com.gmail.nossr50.skills.fishing;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
|
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
Loading…
Reference in New Issue
Block a user