Uses KnarLib for common tasks
This commit is contained in:
@ -8,6 +8,7 @@ import net.knarcraft.blacksmith.config.NPCSettings;
|
||||
import net.knarcraft.blacksmith.formatting.TimeFormatter;
|
||||
import net.knarcraft.blacksmith.manager.EconomyManager;
|
||||
import net.knarcraft.blacksmith.util.ItemHelper;
|
||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.EnchantmentTarget;
|
||||
@ -23,8 +24,7 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.knarcraft.blacksmith.formatting.StringFormatter.replacePlaceholder;
|
||||
import static net.knarcraft.blacksmith.formatting.StringFormatter.sendNPCMessage;
|
||||
import static net.knarcraft.blacksmith.formatting.BlacksmithStringFormatter.sendNPCMessage;
|
||||
|
||||
/**
|
||||
* The class representing the Blacksmith NPC trait
|
||||
@ -124,7 +124,7 @@ public class BlacksmithTrait extends Trait {
|
||||
if (!calendar.after(coolDowns.get(playerId))) {
|
||||
int secondDifference = (int) (coolDowns.get(playerId).getTimeInMillis() - calendar.getTimeInMillis()) / 1000;
|
||||
boolean exactTime = BlacksmithPlugin.getInstance().getSettings().getShowExactTime();
|
||||
sendNPCMessage(this.npc, player, replacePlaceholder(config.getCoolDownUnexpiredMessage(),
|
||||
sendNPCMessage(this.npc, player, StringFormatter.replacePlaceholder(config.getCoolDownUnexpiredMessage(),
|
||||
"{time}", TimeFormatter.formatTime(exactTime, secondDifference)));
|
||||
return false;
|
||||
}
|
||||
@ -157,7 +157,7 @@ public class BlacksmithTrait extends Trait {
|
||||
if (session.isRunning()) {
|
||||
int timeRemaining = (int) ((session.getFinishTime() - System.currentTimeMillis()) / 1000);
|
||||
boolean showExactTime = BlacksmithPlugin.getInstance().getSettings().getShowExactTime();
|
||||
sendNPCMessage(this.npc, player, replacePlaceholder(config.getBusyReforgingMessage(), "{time}",
|
||||
sendNPCMessage(this.npc, player, StringFormatter.replacePlaceholder(config.getBusyReforgingMessage(), "{time}",
|
||||
TimeFormatter.formatTime(showExactTime, timeRemaining)));
|
||||
return;
|
||||
}
|
||||
@ -180,7 +180,7 @@ public class BlacksmithTrait extends Trait {
|
||||
//Refuse if not repairable, or if reforge-able items is set, but doesn't include the held item
|
||||
List<Material> reforgeAbleItems = config.getReforgeAbleItems();
|
||||
if (!isRepairable(hand) || (!reforgeAbleItems.isEmpty() && !reforgeAbleItems.contains(hand.getType()))) {
|
||||
String invalidMessage = replacePlaceholder(config.getInvalidItemMessage(),
|
||||
String invalidMessage = StringFormatter.replacePlaceholder(config.getInvalidItemMessage(),
|
||||
"{title}", config.getBlacksmithTitle());
|
||||
sendNPCMessage(this.npc, player, invalidMessage);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user