Updates KnarLib
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2025-09-06 14:58:55 +02:00
parent 90d3c49c12
commit ca3d29d730
23 changed files with 186 additions and 655 deletions

View File

@@ -5,6 +5,7 @@ import net.knarcraft.blacksmith.BlacksmithPlugin;
import net.knarcraft.blacksmith.config.blacksmith.BlacksmithNPCSettings;
import net.knarcraft.blacksmith.event.BlacksmithReforgeFailEvent;
import net.knarcraft.blacksmith.event.BlacksmithReforgeSucceedEvent;
import net.knarcraft.blacksmith.formatting.NPCFormatter;
import net.knarcraft.blacksmith.manager.EconomyManager;
import net.knarcraft.blacksmith.util.InputParsingHelper;
import net.knarcraft.blacksmith.util.ItemHelper;
@@ -24,8 +25,6 @@ import java.util.Calendar;
import java.util.List;
import java.util.Random;
import static net.knarcraft.blacksmith.formatting.BlacksmithStringFormatter.sendNPCMessage;
/**
* A representation of the session between a player and a blacksmith
*/
@@ -70,12 +69,12 @@ public class ReforgeSession extends Session implements Runnable {
// Prevent player from switching items during session
ItemStack itemInHand = this.player.getInventory().getItemInMainHand();
if (!itemToReforge.equals(itemInHand)) {
sendNPCMessage(this.npc, this.player, this.config.getItemChangedMessage());
NPCFormatter.sendNPCMessage(this.npc, this.player, this.config.getItemChangedMessage());
return true;
}
// The player is unable to pay
if (EconomyManager.cannotPayForHeldItemReforge(this.player)) {
sendNPCMessage(this.npc, this.player, this.config.getInsufficientFundsMessage());
NPCFormatter.sendNPCMessage(this.npc, this.player, this.config.getInsufficientFundsMessage());
return true;
}
return false;
@@ -103,7 +102,7 @@ public class ReforgeSession extends Session implements Runnable {
@Override
public void run() {
boolean success = reforgeItem();
sendNPCMessage(this.npc, this.player, success ? this.config.getSuccessMessage() : this.config.getFailMessage());
NPCFormatter.sendNPCMessage(this.npc, this.player, success ? this.config.getSuccessMessage() : this.config.getFailMessage());
playSound(success ? Sound.BLOCK_ANVIL_USE : Sound.ENTITY_VILLAGER_NO);
//Stop the reforged item from displaying in the blacksmith's hand