Fixes some messages not being sent using the correct methods

This commit is contained in:
Kristian Knarvik 2022-08-10 01:04:54 +02:00
parent 1100f181be
commit 1eb9c370bc
2 changed files with 8 additions and 6 deletions

View File

@ -111,13 +111,14 @@ public class CommandCopy implements TabExecutor {
private boolean copyNextGenerationBook(BookMeta bookMeta, Player player, int copies) {
//Copy the vanilla behavior of refusing copying any further
if (bookMeta.getGeneration() == BookMeta.Generation.COPY_OF_COPY) {
player.sendMessage("You cannot copy this book any further. You must have the original or a direct copy.");
BooksWithoutBorders.sendErrorMessage(player, "You cannot copy this book any further. " +
"You must have the original or a direct copy.");
return false;
}
//Make sure the player can fit the book in their inventory
int nextAvailableSlot = player.getInventory().firstEmpty();
if (nextAvailableSlot == -1) {
player.sendMessage("You need an available slot in your inventory.");
BooksWithoutBorders.sendErrorMessage(player, "You need an available slot in your inventory.");
return false;
}
//Make sure the player can pay for the copying

View File

@ -185,7 +185,8 @@ public class SignEventListener implements Listener {
*/
private void generateGiveSign(SignChangeEvent event, String[] lines, Player player) {
if (lines[2].length() > 13 || lines[3].length() > 13) {
player.sendMessage(ChatColor.RED + "[Give] signs' 3rd and 4th lines must be 13 characters or less!");
BooksWithoutBorders.sendErrorMessage(player,
"[Give] signs' 3rd and 4th lines must be 13 characters or less!");
markGiveSignValidity(event, false);
return;
}
@ -265,7 +266,7 @@ public class SignEventListener implements Listener {
player.getInventory().setItem(hand, newBook);
player.closeInventory();
player.sendMessage(ChatColor.GREEN + "Book auto-decrypted!");
BooksWithoutBorders.sendSuccessMessage(player, "Book auto-decrypted!");
}
/**
@ -316,9 +317,9 @@ public class SignEventListener implements Listener {
if (newBook != null) {
player.getInventory().addItem(newBook);
player.sendMessage(ChatColor.GREEN + "Received book!");
BooksWithoutBorders.sendSuccessMessage(player, "Received book!");
} else {
player.sendMessage(ChatColor.RED + "Book failed to load!");
BooksWithoutBorders.sendErrorMessage(player, "Book failed to load!");
}
}