Cancelling the on_picked_up_item event
Posted: Sat May 21, 2016 9:12 am
As the event system is now, I cannot prevent a player from picking up an item that they aren't meant to.
If an event handler could cancel the "on_picked_up_item" event, then this would be possible.
This could work as a .setCancelled() method on the event. So the handler would run "event.setCancelled(true)" to cancel the event
The event might be fired after the item has already been picked up, so perhaps a cancellable on_prepicked_up_item event is needed?
This would also be useful for (but less important for my mod):
- on_preplayer_mined_item
- on_built_entity
- on_robot_pre_mined
- on_robot_built_entity
- Probably the on_built_tile and on_mined_tile events mentioned in the 0.13 post (when they're available)
I need this for a protection mod for public servers that I'm working on (A "Plots" server, players can claim plots of land which only they and trusted friends can build on). Without this, the best I can do is remove the items from the inventory of whoever picked it up and maybe return them to the inventory of the owner.
Thanks for reading.
If an event handler could cancel the "on_picked_up_item" event, then this would be possible.
This could work as a .setCancelled() method on the event. So the handler would run "event.setCancelled(true)" to cancel the event
The event might be fired after the item has already been picked up, so perhaps a cancellable on_prepicked_up_item event is needed?
This would also be useful for (but less important for my mod):
- on_preplayer_mined_item
- on_built_entity
- on_robot_pre_mined
- on_robot_built_entity
- Probably the on_built_tile and on_mined_tile events mentioned in the 0.13 post (when they're available)
I need this for a protection mod for public servers that I'm working on (A "Plots" server, players can claim plots of land which only they and trusted friends can build on). Without this, the best I can do is remove the items from the inventory of whoever picked it up and maybe return them to the inventory of the owner.
Thanks for reading.