Fixes some problems with getting scrapper data
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2024-05-04 22:12:46 +02:00
parent 757fcdf139
commit e956c7dda7
3 changed files with 12 additions and 2 deletions

View File

@ -183,7 +183,7 @@ public class BlacksmithNPCSettings implements TraitSettings<BlacksmithSetting> {
* *
* @return <p>All items reforge-able by this NPC</p> * @return <p>All items reforge-able by this NPC</p>
*/ */
public List<Material> getItems() { public List<Material> getReforgeAbleItems() {
Object currentValue = currentValues.get(BlacksmithSetting.REFORGE_ABLE_ITEMS); Object currentValue = currentValues.get(BlacksmithSetting.REFORGE_ABLE_ITEMS);
if (currentValue == null || String.valueOf(currentValue).isEmpty()) { if (currentValue == null || String.valueOf(currentValue).isEmpty()) {
return globalBlacksmithSettings.getReforgeAbleItems(); return globalBlacksmithSettings.getReforgeAbleItems();

View File

@ -68,7 +68,7 @@ public class BlacksmithTrait extends CustomTrait<BlacksmithSetting> {
public void startSession(@NotNull Player player) { public void startSession(@NotNull Player player) {
ItemStack hand = player.getInventory().getItemInMainHand(); ItemStack hand = player.getInventory().getItemInMainHand();
//Refuse if not repairable, or if reforge-able items is set, but doesn't include the held item //Refuse if not repairable, or if reforge-able items is set, but doesn't include the held item
List<Material> reforgeAbleItems = config.getItems(); List<Material> reforgeAbleItems = config.getReforgeAbleItems();
boolean notHoldingAnvil = !this.config.getRepairAnvils() || !ItemHelper.isAnvil(hand.getType(), false); boolean notHoldingAnvil = !this.config.getRepairAnvils() || !ItemHelper.isAnvil(hand.getType(), false);
boolean notHoldingRepairable = !ItemHelper.isRepairable(hand) || boolean notHoldingRepairable = !ItemHelper.isRepairable(hand) ||

View File

@ -40,6 +40,16 @@ public class ScrapperTrait extends CustomTrait<ScrapperSetting> {
super.setTraitSettings(this.config); super.setTraitSettings(this.config);
} }
/**
* Gets the current settings for this NPC
*
* @return <p>The current settings for this NPC</p>
*/
@NotNull
public ScrapperNPCSettings getSettings() {
return config;
}
/** /**
* Loads all config values stored in citizens' config file for this NPC * Loads all config values stored in citizens' config file for this NPC
* *