mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-23 02:25:25 +01:00
Fix shop sign getting broken with autofill marker (Fixes #310)
This commit is contained in:
parent
f044938b80
commit
7b978ae022
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user