Fix some block place and break access message issues

Messages were missing on block break and placement sent multiple.
This commit is contained in:
Phoenix616 2021-06-21 16:16:19 +01:00
parent 42a7cc4789
commit 1b85bda656
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
3 changed files with 6 additions and 1 deletions

View File

@ -39,6 +39,7 @@ public class BlockPlace implements Listener {
if (!Security.canAccess(player, placed)) {
Messages.ACCESS_DENIED.sendWithPrefix(event.getPlayer());
event.setCancelled(true);
return;
}
Block neighbor = uBlock.findNeighbor(placed);

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Listeners.Block.Break;
import com.Acrobot.ChestShop.Configuration.Messages;
import com.Acrobot.ChestShop.Configuration.Properties;
import com.Acrobot.ChestShop.Permission;
import com.Acrobot.ChestShop.Signs.ChestShopSign;
@ -21,6 +22,7 @@ public class ChestBreak implements Listener {
public static void onChestBreak(BlockBreakEvent event) {
if (!canBeBroken(event.getBlock(), event.getPlayer())) {
event.setCancelled(true);
Messages.ACCESS_DENIED.sendWithPrefix(event.getPlayer());
}
}
@ -50,7 +52,7 @@ public class ChestBreak implements Listener {
return true;
}
Sign shopSign = uBlock.findAnyNearbyShopSign(block);
Sign shopSign = uBlock.getConnectedSign(block);
if (breaker != null) {
return ChestShopSign.hasPermission(breaker, Permission.OTHER_NAME_DESTROY, shopSign);
}

View File

@ -2,6 +2,7 @@ package com.Acrobot.ChestShop.Listeners.Block.Break;
import com.Acrobot.Breeze.Utils.BlockUtil;
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.Configuration.Messages;
import com.Acrobot.ChestShop.Configuration.Properties;
import com.Acrobot.ChestShop.Events.ShopDestroyedEvent;
import com.Acrobot.ChestShop.Listeners.Block.Break.Attached.PhysicsBreak;
@ -70,6 +71,7 @@ public class SignBreak implements Listener {
public static void onSignBreak(BlockBreakEvent event) {
if (!canBlockBeBroken(event.getBlock(), event.getPlayer())) {
event.setCancelled(true);
Messages.ACCESS_DENIED.sendWithPrefix(event.getPlayer());
if (isSign(event.getBlock())) {
event.getBlock().getState().update();
}