Skip to content

Commit

Permalink
Add BLOCK_INTERACT permission to farms, fixup offhand verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Jun 25, 2023
1 parent f3265aa commit c4a9394
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ default void onPlayerInteract(@NotNull PlayerInteractEvent e) {
: block.getBlockData() instanceof Switch ? Operation.Type.REDSTONE_INTERACT
: Operation.Type.BLOCK_INTERACT,
getPosition(block.getLocation()),
e.getHand() != EquipmentSlot.OFF_HAND
e.getHand() == EquipmentSlot.OFF_HAND
))) {
e.setUseInteractedBlock(Event.Result.DENY);
if (e.getItem() != null && e.getItem().getType() != Material.AIR) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ public interface BukkitPlaceListener extends BukkitListener {
default void onPlayerPlaceBlock(@NotNull BlockPlaceEvent e) {
if (getListener().handler().cancelOperation(Operation.of(
BukkitUser.adapt(e.getPlayer()),
getPlugin().getSpecialTypes().isFarmBlock(e.getBlock().getType().getKey().toString())
getPlugin().getSpecialTypes().isFarmBlock(e.getBlockPlaced().getType().getKey().toString())
? Operation.Type.FARM_BLOCK_PLACE : Operation.Type.BLOCK_PLACE,
getPosition(e.getBlock().getLocation()))
)) {
e.setCancelled(true);
e.setBuild(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public enum Flag {
Operation.Type.CONTAINER_OPEN
),
PUBLIC_FARM_ACCESS(
Operation.Type.BLOCK_INTERACT,
Operation.Type.FARM_BLOCK_BREAK,
Operation.Type.FARM_BLOCK_PLACE,
Operation.Type.FARM_BLOCK_INTERACT,
Expand Down

0 comments on commit c4a9394

Please sign in to comment.