Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onRightClick(PlayerInteractEvent event) {
- // Check for right click
- if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
- // Check for log clicked
- if ((event.getClickedBlock().getType() == Material.LOG) || (event.getClickedBlock().getType() == Material.LOG_2)) {
- Block block = event.getClickedBlock();
- // Get reverse mode
- boolean reverse = event.getPlayer().isSneaking();
- // Get the log rotation and cycle it
- Tree tree = (Tree) block.getState().getData();
- System.out.println(tree.getDirection());
- tree.setDirection(plugin.cycle(tree.getDirection(), reverse));
- BlockState state = block.getState();
- state.setData(tree);
- state.update(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement