Improves console logging
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2024-07-29 18:32:08 +02:00
parent f3372a13a5
commit 0993fbe15f
15 changed files with 81 additions and 74 deletions

View File

@ -12,7 +12,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
/**
* A representation of the presets for different kinds of smiths
@ -133,8 +132,8 @@ public enum SmithPreset {
} catch (IllegalArgumentException exception) {
/* This case means that either the preset or the filter given is invalid, and thus the preset string should
be ignored to prevent any problems. */
BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, String.format("The smith preset %s is " +
"invalid, and will be ignored. Please fix it!", possiblePreset));
BlacksmithPlugin.warn(String.format("The smith preset %s is invalid, and will be ignored. Please fix it!",
possiblePreset));
return "";
}

View File

@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
/**
* A class which keeps track of all Blacksmith settings/config values for one NPC
@ -384,8 +383,7 @@ public class BlacksmithNPCSettings implements TraitSettings<BlacksmithSetting> {
if (enchantment != null) {
enchantmentBlockList.add(enchantment);
} else {
BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, "Unable to verify " + item +
" as a valid enchantment");
BlacksmithPlugin.warn("Unable to verify " + item + " as a valid enchantment");
}
}
return enchantmentBlockList;

View File

@ -19,7 +19,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
/**
* A class which keeps track of all default blacksmith NPC settings and all global blacksmith settings
@ -344,15 +343,14 @@ public class GlobalBlacksmithSettings implements Settings<BlacksmithSetting> {
ConfigurationSection enchantmentCostNode = fileConfiguration.getConfigurationSection(
getBase(BlacksmithSetting.ENCHANTMENT_COST.getPath()));
if (enchantmentCostNode == null) {
instance.getLogger().log(Level.WARNING, "Could not load enchantment prices. because the " +
"configuration section doesn't exist");
BlacksmithPlugin.warn("Could not load enchantment prices. because the configuration section doesn't exist");
return;
}
Map<String, String> relevantKeys = getRelevantKeys(enchantmentCostNode);
for (String key : relevantKeys.keySet()) {
String enchantmentName = relevantKeys.get(key);
Enchantment enchantment = InputParsingHelper.matchEnchantment(enchantmentName);
instance.getLogger().log(Level.WARNING, "loadEnchantmentPrices " + enchantmentName);
BlacksmithPlugin.warn("loadEnchantmentPrices " + enchantmentName);
setItemPrice(this.enchantmentCosts, enchantmentName, enchantment, enchantmentCostNode.getDouble(key));
}
}
@ -366,8 +364,7 @@ public class GlobalBlacksmithSettings implements Settings<BlacksmithSetting> {
ConfigurationSection basePerDurabilityPriceNode = fileConfiguration.getConfigurationSection(
getBase(BlacksmithSetting.PRICE_PER_DURABILITY_POINT.getPath()));
if (basePerDurabilityPriceNode == null) {
instance.getLogger().log(Level.WARNING, "Could not load per durability prices. because the " +
"configuration section doesn't exist");
BlacksmithPlugin.warn("Could not load per durability prices. because the configuration section doesn't exist");
return;
}
Map<String, String> relevantKeys = getRelevantKeys(basePerDurabilityPriceNode);
@ -394,8 +391,7 @@ public class GlobalBlacksmithSettings implements Settings<BlacksmithSetting> {
ConfigurationSection basePriceNode = fileConfiguration.getConfigurationSection(
getBase(BlacksmithSetting.BASE_PRICE.getPath()));
if (basePriceNode == null) {
instance.getLogger().log(Level.WARNING, "Could not load base prices, because the configuration " +
"section doesn't exist");
BlacksmithPlugin.warn("Could not load base prices, because the configuration section doesn't exist");
return;
}
Map<String, String> relevantKeys = getRelevantKeys(basePriceNode);
@ -442,7 +438,7 @@ public class GlobalBlacksmithSettings implements Settings<BlacksmithSetting> {
if (item != null) {
prices.put(item, price);
} else {
instance.getLogger().log(Level.WARNING, "Unable to find a material/enchantment matching " + itemName);
BlacksmithPlugin.warn("Unable to find a material/enchantment matching " + itemName);
}
}

View File

@ -16,7 +16,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
/**
* A class which keeps track of all default scrapper NPC settings and all global scrapper settings
@ -251,8 +250,7 @@ public class GlobalScrapperSettings implements Settings<ScrapperSetting> {
for (String trashSalvageInfo : allTrashSalvage) {
// Ignore invalid lines
if (!trashSalvageInfo.contains(":")) {
BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, String.format("The trash salvage " +
"configuration line %s is invalid", trashSalvageInfo));
BlacksmithPlugin.warn(String.format("The trash salvage configuration line %s is invalid", trashSalvageInfo));
continue;
}