Hey,
today I noticed, that there is something wrong with my plugin, so I started debugging it.
When a player places a block, I normally get it with following code: (result should be minecraft:stone for example)
@Listener
public void onBlockPlace(ChangeBlockEvent.Place event) {
//JOB
Optional<Player> optPlayer = event.getCause().first(Player.class);
if (optPlayer.isPresent()) {
player = optPlayer.get();
logger.info("Block: " + event.getTransactions().get(0).getOriginal().getState().getType().getName());
}
}
So this returns “minecraft:air”, no matter which block was placed.
Any ideas?
Thank you guys…
Yes, I think I know what your problem is.
If you want to get the block that was placed you need to get the final of the transaction.
This would mean your logger line would need to look like this:
Thanks man
Do you know, how I can get the new API now (because they are using forge’s repo…) ?
Would be great if you could say me, how to add it with maven / or where I can download a local api,
greets