diff --git a/src/main/java/com/Acrobot/ChestShop/Events/PreShopCreationEvent.java b/src/main/java/com/Acrobot/ChestShop/Events/PreShopCreationEvent.java index 06ebca8..51fa4be 100644 --- a/src/main/java/com/Acrobot/ChestShop/Events/PreShopCreationEvent.java +++ b/src/main/java/com/Acrobot/ChestShop/Events/PreShopCreationEvent.java @@ -181,7 +181,7 @@ public class PreShopCreationEvent extends Event implements Cancellable { INVALID_PRICE, INVALID_QUANTITY, - ITEM_AUTOFILL, + ITEM_AUTOFILL(false), UNKNOWN_PLAYER, @@ -202,12 +202,31 @@ public class PreShopCreationEvent extends Event implements Cancellable { /** * For plugin use */ - OTHER, + OTHER(false), /** * Break the sign */ OTHER_BREAK, - SHOP_CREATED_SUCCESSFULLY + SHOP_CREATED_SUCCESSFULLY(false); + + private final boolean breakSign; + + CreationOutcome() { + this.breakSign = true; + } + + CreationOutcome(boolean breakSign) { + this.breakSign = breakSign; + } + + /** + * Get whether or not this outcome should result in the shop sign getting broken + * + * @return Whether or not the shop sign gets broken + */ + public boolean shouldBreakSign() { + return breakSign; + } } } diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/SignCreate.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/SignCreate.java index 3c281d5..670ef0a 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/SignCreate.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/SignCreate.java @@ -47,7 +47,7 @@ public class SignCreate implements Listener { PreShopCreationEvent preEvent = new PreShopCreationEvent(event.getPlayer(), sign, lines); ChestShop.callEvent(preEvent); - if (preEvent.isCancelled() && preEvent.getOutcome() != PreShopCreationEvent.CreationOutcome.OTHER) { + if (preEvent.getOutcome().shouldBreakSign()) { signBlock.breakNaturally(); return; }