From 3220e064ed53393d39bfeae5e56c23887f59da94 Mon Sep 17 00:00:00 2001 From: Flemmli97 Date: Tue, 25 Aug 2020 01:29:01 +0200 Subject: [PATCH] fix empty lectern screen and pressureplate spamm --- .../java/com/flemmli97/flan/event/BlockInteractEvents.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/flemmli97/flan/event/BlockInteractEvents.java b/src/main/java/com/flemmli97/flan/event/BlockInteractEvents.java index feb3a54..28946ed 100644 --- a/src/main/java/com/flemmli97/flan/event/BlockInteractEvents.java +++ b/src/main/java/com/flemmli97/flan/event/BlockInteractEvents.java @@ -82,7 +82,8 @@ public class BlockInteractEvents { if(blockEntity instanceof LecternBlockEntity) { if (claim.canInteract(player, EnumPermission.LECTERNTAKE, hitResult.getBlockPos(), false)) return ActionResult.PASS; - LockedLecternScreenHandler.create(player, (LecternBlockEntity) blockEntity); + if (state.get(LecternBlock.HAS_BOOK)) + LockedLecternScreenHandler.create(player, (LecternBlockEntity) blockEntity); return ActionResult.FAIL; } } @@ -120,7 +121,7 @@ public class BlockInteractEvents { ClaimStorage storage = ClaimStorage.get((ServerWorld) world); Claim claim = storage.getClaimAt(pos); if (claim != null) - return !claim.canInteract((ServerPlayerEntity) entity, perm, pos, true); + return !claim.canInteract((ServerPlayerEntity) entity, perm, pos, false); } else if (entity instanceof ProjectileEntity) { EnumPermission perm = BlockToPermissionMap.getFromBlock(state.getBlock()); if (perm != EnumPermission.PRESSUREPLATE && perm != EnumPermission.BUTTONLEVER) @@ -130,7 +131,7 @@ public class BlockInteractEvents { ClaimStorage storage = ClaimStorage.get((ServerWorld) world); Claim claim = storage.getClaimAt(pos); if (claim != null) - return !claim.canInteract((ServerPlayerEntity) owner, perm, pos, true); + return !claim.canInteract((ServerPlayerEntity) owner, perm, pos, false); } } return false;