I would like to program a plugin that prevents players from dropping without an op
I don't even think that something has a permission (?)
I would check for drops with an event, and if the player does not have permissions, cancel the event.
What's the code for that?
Squeezed into one line:
@EventHandler void onDrop (PlayerDropItemEvent e) {if (! E.getPlayer (). IsOp ()) e.setCancelled (true); }
I did it, but when I want to register it, the class is not displayed
How did you register the event?
You register a PlayerDropItemEvent, check the permissions and cancel…
in approximately
class HandleDrops implements Listener {
@EventHandler
public void onDrop (PlayerDropItemEvent event) {
// check here for permissions
event.setCancelled (true);
}
}
The code is just written down, not tested.