diff --git a/src/main/java/com/Acrobot/ChestShop/Configuration/Messages.java b/src/main/java/com/Acrobot/ChestShop/Configuration/Messages.java index 1a6f9d2..391842a 100644 --- a/src/main/java/com/Acrobot/ChestShop/Configuration/Messages.java +++ b/src/main/java/com/Acrobot/ChestShop/Configuration/Messages.java @@ -62,6 +62,7 @@ public class Messages { @PrecededBySpace public static String PROTECTED_SHOP = "Successfully protected the shop with LWC!"; + public static String PROTECTED_SHOP_SIGN = "Successfully protected the shop sign with LWC!"; public static String SHOP_CREATED = "Shop successfully created!"; public static String SHOP_FEE_PAID = "You have been charged %amount"; public static String SHOP_REFUNDED = "You have been refunded %amount."; diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java b/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java index ed49c09..b0a1b86 100644 --- a/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java +++ b/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java @@ -44,15 +44,25 @@ public class LightweightChestProtection implements Listener { Sign sign = event.getSign(); Container connectedContainer = event.getContainer(); + String message = null; if (Properties.PROTECT_SIGN_WITH_LWC) { - if (!Security.protect(player, sign.getBlock(), event.getOwnerAccount() != null ? event.getOwnerAccount().getUuid() : player.getUniqueId(), Properties.LWC_SIGN_PROTECTION_TYPE)) { - player.sendMessage(Messages.prefix(Messages.NOT_ENOUGH_PROTECTIONS)); + if (Security.protect(player, sign.getBlock(), event.getOwnerAccount() != null ? event.getOwnerAccount().getUuid() : player.getUniqueId(), Properties.LWC_SIGN_PROTECTION_TYPE)) { + message = Messages.PROTECTED_SHOP_SIGN; + } else { + message = Messages.NOT_ENOUGH_PROTECTIONS; } } - if (Properties.PROTECT_CHEST_WITH_LWC && connectedContainer != null - && Security.protect(player, connectedContainer.getBlock(), event.getOwnerAccount() != null ? event.getOwnerAccount().getUuid() : player.getUniqueId(), Properties.LWC_CHEST_PROTECTION_TYPE)) { - player.sendMessage(Messages.prefix(Messages.PROTECTED_SHOP)); + if (Properties.PROTECT_CHEST_WITH_LWC && connectedContainer != null) { + if (Security.protect(player, connectedContainer.getBlock(), event.getOwnerAccount() != null ? event.getOwnerAccount().getUuid() : player.getUniqueId(), Properties.LWC_CHEST_PROTECTION_TYPE)) { + message = Messages.PROTECTED_SHOP; + } else if (message == null) { + message = Messages.NOT_ENOUGH_PROTECTIONS; + } + } + + if (message != null) { + player.sendMessage(Messages.prefix(message)); } }