mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-01-21 22:31:20 +01:00
Cancel left click event on shop sign
This should improve compatibility with other plugins that handle left click interactions too and shouldn't apply to shop signs you don't have access to. Also includes a small improvement to not run the same permission check twice in certain cases.
This commit is contained in:
parent
4a04a623a7
commit
cbd427f561
@ -42,7 +42,6 @@ import static com.Acrobot.ChestShop.Events.TransactionEvent.TransactionType;
|
||||
import static com.Acrobot.ChestShop.Events.TransactionEvent.TransactionType.BUY;
|
||||
import static com.Acrobot.ChestShop.Events.TransactionEvent.TransactionType.SELL;
|
||||
import static com.Acrobot.ChestShop.Permission.OTHER_NAME_CREATE;
|
||||
import static com.Acrobot.ChestShop.Permission.OTHER_NAME_DESTROY;
|
||||
import static com.Acrobot.ChestShop.Signs.ChestShopSign.*;
|
||||
import static org.bukkit.event.block.Action.LEFT_CLICK_BLOCK;
|
||||
import static org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK;
|
||||
@ -118,7 +117,7 @@ public class PlayerInteract implements Listener {
|
||||
if (Properties.IGNORE_ACCESS_PERMS || ChestShopSign.isOwner(player, sign)) {
|
||||
if (Properties.ALLOW_SIGN_CHEST_OPEN && !(Properties.IGNORE_CREATIVE_MODE && player.getGameMode() == GameMode.CREATIVE)) {
|
||||
if (player.isSneaking() || player.isInsideVehicle()
|
||||
|| (Properties.ALLOW_LEFT_CLICK_DESTROYING && action == LEFT_CLICK_BLOCK && ChestShopSign.hasPermission(player, OTHER_NAME_DESTROY, sign))) {
|
||||
|| (Properties.ALLOW_LEFT_CLICK_DESTROYING && action == LEFT_CLICK_BLOCK)) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@ -132,6 +131,8 @@ public class PlayerInteract implements Listener {
|
||||
|
||||
if (action == RIGHT_CLICK_BLOCK) {
|
||||
event.setCancelled(true);
|
||||
} else if (action == LEFT_CLICK_BLOCK && !ChestShopSign.canAccess(player, sign)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (Properties.CHECK_ACCESS_FOR_SHOP_USE && !Security.canAccess(player, block, true)) {
|
||||
|
Loading…
Reference in New Issue
Block a user