Skip to content

Commit 15b80bf

Browse files
[1.20.x] Cancel for all player interacting with sign (editing)
1 parent adfeefb commit 15b80bf

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/main/java/org/maxgamer/quickshop/listener/PlayerListener.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,15 @@ private void postControlPanel(PlayerInteractEvent e) {
162162
block = e.getClickedBlock();
163163
}
164164
Shop controlPanelShop = plugin.getShopManager().getShop(Objects.requireNonNull(block).getLocation());
165-
if (controlPanelShop != null && (controlPanelShop.getOwner().equals(p.getUniqueId()) || QuickShop.getPermissionManager().hasPermission(p, "quickshop.other.control"))) {
166-
MsgUtil.sendControlPanelInfo(p, Objects.requireNonNull(plugin.getShopManager().getShop(block.getLocation())));
167-
this.playClickSound(e.getPlayer());
168-
Objects.requireNonNull(plugin.getShopManager().getShop(block.getLocation())).setSignText();
169-
//Prevent use item by ancient
170-
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
171-
e.setUseItemInHand(Event.Result.DENY);
165+
if (controlPanelShop != null) {
166+
if ((controlPanelShop.getOwner().equals(p.getUniqueId()) || QuickShop.getPermissionManager().hasPermission(p, "quickshop.other.control"))) {
167+
MsgUtil.sendControlPanelInfo(p, Objects.requireNonNull(plugin.getShopManager().getShop(block.getLocation())));
168+
this.playClickSound(e.getPlayer());
169+
Objects.requireNonNull(plugin.getShopManager().getShop(block.getLocation())).setSignText();
170+
//Prevent use item by ancient
171+
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
172+
e.setUseItemInHand(Event.Result.DENY);
173+
}
172174
}
173175
//Cancel for interacting with sign (editing)
174176
if (plugin.getGameVersion().ordinal() >= GameVersion.v1_20_R1.ordinal()) {

0 commit comments

Comments
 (0)