How to replace block type?

Code: http://pastebin.com/AcNp8vHH
@Listener public void onBreakBlock(ChangeBlockEvent.Break event){ for(Transaction<BlockSnapshot> transaction : event.getTransactions()){ BlockSnapshot block = transaction.getOriginal(); if(block.getState().getType().equals(BlockTypes.STONE)){ event.setCancelled(true); //here replace block type to wool } } }

You can set a custom replacement on the transaction.

transaction.setCustom(BlockTypes.WOOL.getDefaultState().snapshotFor(block.getLocation().get()));

Note that if you’re cancelling the break event then no changes will occur

1 Like

How to get and remove drop from STONE?

There is an event, DropItemEvent.Destruct that is fired whenever a block or entity is destroyed and drops an item

You would need to listen to that event and remove the drop if it’s stone