Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Zerthick/f70f56d8791faab3061d698dcded3b55 to your computer and use it in GitHub Desktop.
Save Zerthick/f70f56d8791faab3061d698dcded3b55 to your computer and use it in GitHub Desktop.
@Listener(order = Order.LATE)
public void onBlockPlace(ChangeBlockEvent.Place event, @Getter("getCause") Cause cause) {
Object root = cause.root();
// Growing player-placed trees naturally
if (root instanceof LocatableBlock) {
event.getTransactions().forEach(trans -> trans.getOriginal().getLocation()
.ifPresent(loc -> loc.getExtent().setCreator(loc.getBlockPosition(), null)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment