fix the code tyty @ncurran02

This commit is contained in:
2025-07-07 20:46:07 -04:00
parent 50f061a04e
commit 1fb88bd10c

View File

@ -78,22 +78,28 @@ public class PlayerListener extends PlexListener
ItemStack item = event.getItem(); ItemStack item = event.getItem();
if (item != null) if (item != null)
{ {
if (item.hasData(DataComponentTypes.CAN_PLACE_ON)) {
canPlace = item.getData(DataComponentTypes.CAN_PLACE_ON).predicates().stream().anyMatch(blockPredicate -> { canPlace = item.getData(DataComponentTypes.CAN_PLACE_ON).predicates().stream().anyMatch(blockPredicate -> {
for (TypedKey<BlockType> key : blockPredicate.blocks()) { for (TypedKey<BlockType> key : blockPredicate.blocks()) {
if (key.equals(clicked.getType().asBlockType().key())) { if (key.key().equals(clicked.getType().asBlockType().key())) {
return true; return true;
} }
} }
return false; return false;
}); });
}
if (item.hasData(DataComponentTypes.CAN_BREAK)) {
canBreak = item.getData(DataComponentTypes.CAN_BREAK).predicates().stream().anyMatch(blockPredicate -> { canBreak = item.getData(DataComponentTypes.CAN_BREAK).predicates().stream().anyMatch(blockPredicate -> {
for (TypedKey<BlockType> key : blockPredicate.blocks()) { for (TypedKey<BlockType> key : blockPredicate.blocks()) {
if (key.equals(clicked.getType().asBlockType().key())) { if (key.key().equals(clicked.getType().asBlockType().key())) {
return true; return true;
} }
} }
return false; return false;
}); } });
}
}
} }
boolean clickedTargetBlock = clicked.getType() == Material.COMMAND_BLOCK || clicked.getType() == Material.CHAIN_COMMAND_BLOCK || clicked.getType() == Material.REPEATING_COMMAND_BLOCK || clicked.getType() == Material.STRUCTURE_BLOCK || clicked.getType() == Material.JIGSAW; boolean clickedTargetBlock = clicked.getType() == Material.COMMAND_BLOCK || clicked.getType() == Material.CHAIN_COMMAND_BLOCK || clicked.getType() == Material.REPEATING_COMMAND_BLOCK || clicked.getType() == Material.STRUCTURE_BLOCK || clicked.getType() == Material.JIGSAW;
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (type == Material.COMMAND_BLOCK || type == Material.CHAIN_COMMAND_BLOCK || type == Material.REPEATING_COMMAND_BLOCK || type == Material.STRUCTURE_BLOCK || type == Material.JIGSAW) && (!clickedTargetBlock || player.isSneaking())) if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (type == Material.COMMAND_BLOCK || type == Material.CHAIN_COMMAND_BLOCK || type == Material.REPEATING_COMMAND_BLOCK || type == Material.STRUCTURE_BLOCK || type == Material.JIGSAW) && (!clickedTargetBlock || player.isSneaking()))