mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-09-27 14:13:05 +02:00
Fix some block place and break access message issues
Messages were missing on block break and placement sent multiple.
This commit is contained in:
parent
42a7cc4789
commit
1b85bda656
@ -39,6 +39,7 @@ public class BlockPlace implements Listener {
|
|||||||
if (!Security.canAccess(player, placed)) {
|
if (!Security.canAccess(player, placed)) {
|
||||||
Messages.ACCESS_DENIED.sendWithPrefix(event.getPlayer());
|
Messages.ACCESS_DENIED.sendWithPrefix(event.getPlayer());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block neighbor = uBlock.findNeighbor(placed);
|
Block neighbor = uBlock.findNeighbor(placed);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.Acrobot.ChestShop.Listeners.Block.Break;
|
package com.Acrobot.ChestShop.Listeners.Block.Break;
|
||||||
|
|
||||||
|
import com.Acrobot.ChestShop.Configuration.Messages;
|
||||||
import com.Acrobot.ChestShop.Configuration.Properties;
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Permission;
|
import com.Acrobot.ChestShop.Permission;
|
||||||
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
||||||
@ -21,6 +22,7 @@ public class ChestBreak implements Listener {
|
|||||||
public static void onChestBreak(BlockBreakEvent event) {
|
public static void onChestBreak(BlockBreakEvent event) {
|
||||||
if (!canBeBroken(event.getBlock(), event.getPlayer())) {
|
if (!canBeBroken(event.getBlock(), event.getPlayer())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Messages.ACCESS_DENIED.sendWithPrefix(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +52,7 @@ public class ChestBreak implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sign shopSign = uBlock.findAnyNearbyShopSign(block);
|
Sign shopSign = uBlock.getConnectedSign(block);
|
||||||
if (breaker != null) {
|
if (breaker != null) {
|
||||||
return ChestShopSign.hasPermission(breaker, Permission.OTHER_NAME_DESTROY, shopSign);
|
return ChestShopSign.hasPermission(breaker, Permission.OTHER_NAME_DESTROY, shopSign);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.Acrobot.ChestShop.Listeners.Block.Break;
|
|||||||
|
|
||||||
import com.Acrobot.Breeze.Utils.BlockUtil;
|
import com.Acrobot.Breeze.Utils.BlockUtil;
|
||||||
import com.Acrobot.ChestShop.ChestShop;
|
import com.Acrobot.ChestShop.ChestShop;
|
||||||
|
import com.Acrobot.ChestShop.Configuration.Messages;
|
||||||
import com.Acrobot.ChestShop.Configuration.Properties;
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Events.ShopDestroyedEvent;
|
import com.Acrobot.ChestShop.Events.ShopDestroyedEvent;
|
||||||
import com.Acrobot.ChestShop.Listeners.Block.Break.Attached.PhysicsBreak;
|
import com.Acrobot.ChestShop.Listeners.Block.Break.Attached.PhysicsBreak;
|
||||||
@ -70,6 +71,7 @@ public class SignBreak implements Listener {
|
|||||||
public static void onSignBreak(BlockBreakEvent event) {
|
public static void onSignBreak(BlockBreakEvent event) {
|
||||||
if (!canBlockBeBroken(event.getBlock(), event.getPlayer())) {
|
if (!canBlockBeBroken(event.getBlock(), event.getPlayer())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Messages.ACCESS_DENIED.sendWithPrefix(event.getPlayer());
|
||||||
if (isSign(event.getBlock())) {
|
if (isSign(event.getBlock())) {
|
||||||
event.getBlock().getState().update();
|
event.getBlock().getState().update();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user