From 1eb9c370bc451aefee883e6537bffee92173464c Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Wed, 10 Aug 2022 01:04:54 +0200 Subject: [PATCH] Fixes some messages not being sent using the correct methods --- .../bookswithoutborders/command/CommandCopy.java | 5 +++-- .../bookswithoutborders/listener/SignEventListener.java | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/knarcraft/bookswithoutborders/command/CommandCopy.java b/src/main/java/net/knarcraft/bookswithoutborders/command/CommandCopy.java index 31c0025..2b998ed 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/command/CommandCopy.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/command/CommandCopy.java @@ -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 diff --git a/src/main/java/net/knarcraft/bookswithoutborders/listener/SignEventListener.java b/src/main/java/net/knarcraft/bookswithoutborders/listener/SignEventListener.java index 0ba81fa..709325e 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/listener/SignEventListener.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/listener/SignEventListener.java @@ -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!"); } }