Update TransactionListener.java

This commit is contained in:
Len 2023-06-27 17:11:01 +02:00
parent 7553df9c12
commit 795650a373

View File

@ -52,8 +52,8 @@ public class TransactionListener extends EventListener {
Block block = event.getClickedBlock();
if (block == null || !Tag.WALL_SIGNS.isTagged(block.getType()))
return;
PlayerShop playerShop = plugin.getShopHandler().getShopBySignLocation(block.getLocation());
ShopHandler shopHandler = plugin.getShopHandler();
PlayerShop playerShop = shopHandler.getShopBySignLocation(block.getLocation());
if (playerShop == null)
return;
@ -69,9 +69,6 @@ public class TransactionListener extends EventListener {
event.setCancelled(true);
return;
}
ShopHandler shopHandler = plugin.getShopHandler();
// Failsafe. If we have a shopsign but no block cancel the event, log error save and unload the shop
if (!shopHandler.isShopMaterial(playerShop.getShopLocation().getBlock())) {
Logger.error("We have a shop here but no connected container");
@ -91,11 +88,11 @@ public class TransactionListener extends EventListener {
}
return;
}
if (ShopUtil.canManageShop(player, playerShop)) {
if (player.isSneaking())
if (player.isSneaking()) {
event.setCancelled(true);
return;
}
ShopManagementGui gui = new ShopManagementGui(player.getUniqueId(), playerShop);
gui.open();
event.setCancelled(true);