Set sign lines even when the event is cancelled (Fixes #82)

Also get the sign line from the event instead of the sign when checking if it is an admin shop so you can actually change that via an event listener.
This commit is contained in:
Phoenix616 2017-11-20 13:44:59 +01:00
parent 1276c6f031
commit 5d73320889
2 changed files with 6 additions and 6 deletions

View File

@ -33,14 +33,14 @@ public class SignCreate implements Listener {
PreShopCreationEvent preEvent = new PreShopCreationEvent(event.getPlayer(), (Sign) signBlock.getState(), line);
ChestShop.callEvent(preEvent);
if (preEvent.isCancelled()) {
return;
}
for (byte i = 0; i < event.getLines().length; ++i) {
event.setLine(i, preEvent.getSignLine(i));
}
if (preEvent.isCancelled()) {
return;
}
ShopCreatedEvent postEvent = new ShopCreatedEvent(preEvent.getPlayer(), preEvent.getSign(), uBlock.findConnectedChest(preEvent.getSign()), preEvent.getSignLines());
ChestShop.callEvent(postEvent);

View File

@ -25,7 +25,7 @@ public class SignSticker implements Listener {
return;
}
if (ChestShopSign.isAdminShop(event.getSign().getLine(NAME_LINE))) {
if (ChestShopSign.isAdminShop(event.getSignLine(NAME_LINE))) {
return;
}