fix empty lectern screen and pressureplate spamm

This commit is contained in:
Flemmli97 2020-08-25 01:29:01 +02:00
parent 7e09152eaa
commit 3220e064ed

View File

@ -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;