Use orElseThrow instead of orElse otherwise you won't notice if there's any error. Also use tick event not PlayerEvent, or it will be called whenever a sub event of it is triggered.
armorItemInSlot(int slotIn)
is client side only.
I think you may need to check the time yourself, and use
ServerWorld.getServer().getPlayerList()
to get all players, then use
player.sendMessage()
to send the message.
I believe whenever there are changes being made to the tag, it will be sync to the client. What
getShareTag()
does is allows you to modify the tag before the message of syncing being sent.
I'm afraid player capability is the only way to achieve this afaik. It is not as simple as storing the data in the fields in your event class (which won't work), but it is the only way I can think of. Also it is not so complicated isn't it?
I assume you are using 1.14+ (there's only one arg in 1.12), you need to pass
EntityType.ENDERMAN
into the first arg instead of null.
Also like sciwhiz12 said you need to provide more information.
setRequiresTool()
in
AbstractBlock.Properties
So
canHarvestBlock()
will do tool checking when block is harvest.
You can also see how blocks in Blocks.java do it.
I use high-contrast :p
I'm not so sure why that did not work for you (it works for me, I just tested it), you might want to have a look at this tho it's for 1.15 but I guess it applies on 1.16 as well.