mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-23 18:45:31 +01:00
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:
parent
1276c6f031
commit
5d73320889
@ -33,14 +33,14 @@ public class SignCreate implements Listener {
|
|||||||
|
|
||||||
PreShopCreationEvent preEvent = new PreShopCreationEvent(event.getPlayer(), (Sign) signBlock.getState(), line);
|
PreShopCreationEvent preEvent = new PreShopCreationEvent(event.getPlayer(), (Sign) signBlock.getState(), line);
|
||||||
ChestShop.callEvent(preEvent);
|
ChestShop.callEvent(preEvent);
|
||||||
|
|
||||||
if (preEvent.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (byte i = 0; i < event.getLines().length; ++i) {
|
for (byte i = 0; i < event.getLines().length; ++i) {
|
||||||
event.setLine(i, preEvent.getSignLine(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());
|
ShopCreatedEvent postEvent = new ShopCreatedEvent(preEvent.getPlayer(), preEvent.getSign(), uBlock.findConnectedChest(preEvent.getSign()), preEvent.getSignLines());
|
||||||
ChestShop.callEvent(postEvent);
|
ChestShop.callEvent(postEvent);
|
||||||
|
@ -25,7 +25,7 @@ public class SignSticker implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ChestShopSign.isAdminShop(event.getSign().getLine(NAME_LINE))) {
|
if (ChestShopSign.isAdminShop(event.getSignLine(NAME_LINE))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user