mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-02-20 12:02:00 +01:00
Improve LWC shop protection messages
This commit is contained in:
parent
3fe35cd0a5
commit
9d6c2f8c1b
@ -62,6 +62,7 @@ public class Messages {
|
|||||||
|
|
||||||
@PrecededBySpace
|
@PrecededBySpace
|
||||||
public static String PROTECTED_SHOP = "Successfully protected the shop with LWC!";
|
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_CREATED = "Shop successfully created!";
|
||||||
public static String SHOP_FEE_PAID = "You have been charged %amount";
|
public static String SHOP_FEE_PAID = "You have been charged %amount";
|
||||||
public static String SHOP_REFUNDED = "You have been refunded %amount.";
|
public static String SHOP_REFUNDED = "You have been refunded %amount.";
|
||||||
|
@ -44,15 +44,25 @@ public class LightweightChestProtection implements Listener {
|
|||||||
Sign sign = event.getSign();
|
Sign sign = event.getSign();
|
||||||
Container connectedContainer = event.getContainer();
|
Container connectedContainer = event.getContainer();
|
||||||
|
|
||||||
|
String message = null;
|
||||||
if (Properties.PROTECT_SIGN_WITH_LWC) {
|
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)) {
|
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));
|
message = Messages.PROTECTED_SHOP_SIGN;
|
||||||
|
} else {
|
||||||
|
message = Messages.NOT_ENOUGH_PROTECTIONS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Properties.PROTECT_CHEST_WITH_LWC && connectedContainer != null
|
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)) {
|
if (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));
|
message = Messages.PROTECTED_SHOP;
|
||||||
|
} else if (message == null) {
|
||||||
|
message = Messages.NOT_ENOUGH_PROTECTIONS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message != null) {
|
||||||
|
player.sendMessage(Messages.prefix(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user