Adds tons of changes to messages
This commit is contained in:
@ -21,6 +21,8 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.knarcraft.blacksmith.util.MessageFormatter.sendNPCMessage;
|
||||
|
||||
/**
|
||||
* The class representing the Blacksmith NPC trait
|
||||
*/
|
||||
@ -115,7 +117,7 @@ public class BlacksmithTrait extends Trait {
|
||||
//Deny if on cool-down, or remove cool-down if expired
|
||||
if (coolDowns.get(player.getUniqueId()) != null) {
|
||||
if (!Calendar.getInstance().after(coolDowns.get(player.getUniqueId()))) {
|
||||
player.sendMessage(config.getCoolDownUnexpiredMessage());
|
||||
sendNPCMessage(this.npc, player, config.getCoolDownUnexpiredMessage());
|
||||
return false;
|
||||
}
|
||||
coolDowns.remove(player.getUniqueId());
|
||||
@ -139,13 +141,13 @@ public class BlacksmithTrait extends Trait {
|
||||
public void continueSession(Player player) {
|
||||
//Another player is using the blacksmith
|
||||
if (!session.isInSession(player)) {
|
||||
player.sendMessage(config.getBusyWithPlayerMessage());
|
||||
sendNPCMessage(this.npc, player, config.getBusyWithPlayerMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
//The blacksmith is already reforging for the player
|
||||
if (session.isRunning()) {
|
||||
player.sendMessage(config.getBusyReforgingMessage());
|
||||
sendNPCMessage(this.npc, player, config.getBusyReforgingMessage());
|
||||
return;
|
||||
}
|
||||
if (session.endSession()) {
|
||||
@ -167,7 +169,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()))) {
|
||||
player.sendMessage(config.getInvalidItemMessage());
|
||||
sendNPCMessage(this.npc, player, config.getInvalidItemMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -178,7 +180,7 @@ public class BlacksmithTrait extends Trait {
|
||||
//Tell the player the cost of repairing the item
|
||||
String cost = EconomyManager.formatCost(player);
|
||||
String itemName = hand.getType().name().toLowerCase().replace('_', ' ');
|
||||
player.sendMessage(config.getCostMessage().replace("<price>", cost).replace("<item>", itemName));
|
||||
sendNPCMessage(this.npc, player, config.getCostMessage().replace("<price>", cost).replace("<item>", itemName));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,7 +190,7 @@ public class BlacksmithTrait extends Trait {
|
||||
* @param player <p>The player that initiated the reforge</p>
|
||||
*/
|
||||
private void reforge(NPC npc, Player player) {
|
||||
player.sendMessage(config.getStartReforgeMessage());
|
||||
sendNPCMessage(this.npc, player, config.getStartReforgeMessage());
|
||||
EconomyManager.withdraw(player);
|
||||
session.beginReforge();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
@ -17,6 +17,8 @@ import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static net.knarcraft.blacksmith.util.MessageFormatter.sendNPCMessage;
|
||||
|
||||
/**
|
||||
* A representation of the session between a player and a blacksmith
|
||||
*/
|
||||
@ -57,7 +59,7 @@ public class ReforgeSession implements Runnable {
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendMessage(reforgeItem() ? config.getSuccessMessage() : config.getFailMessage());
|
||||
sendNPCMessage(this.npc, player, reforgeItem() ? config.getSuccessMessage() : config.getFailMessage());
|
||||
|
||||
//Stop the re-forged item from displaying in the blacksmith's hand
|
||||
if (npc.getEntity() instanceof Player) {
|
||||
@ -191,12 +193,12 @@ public class ReforgeSession implements Runnable {
|
||||
// Prevent player from switching items during session
|
||||
ItemStack itemInHand = player.getInventory().getItemInMainHand();
|
||||
if (!itemToReforge.equals(itemInHand)) {
|
||||
player.sendMessage(config.getItemChangedMessage());
|
||||
sendNPCMessage(this.npc, player, config.getItemChangedMessage());
|
||||
return true;
|
||||
}
|
||||
// The player is unable to pay
|
||||
if (!EconomyManager.canPay(player)) {
|
||||
player.sendMessage(config.getInsufficientFundsMessage());
|
||||
sendNPCMessage(this.npc, player, config.getInsufficientFundsMessage());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user