Public void onIMove (InventoryClickEvent e) {
e.setCancelled (true);
}
@EventHandler
public void onPlace (BlockPlaceEvents) {
if (e.getPlayer (). GetWorld (). GetName (). Equals (Main.world)) {
e.setCancelled (true);
I can't set the world on onIMove. Why? Can you handle this?
First of all, an @EventHandler is missing via the "public void onlMove (InventoryCl…".
In addition, you can't in this case "e.getPlayer ()" make, because in the InventoryClickEvent there's only the "e.getWhoClicked ()" of type HumanEntity, you have to caste to the player, so something like this:
@EventHandler
public void onlMove (InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked ();
// carry on what you want with "p.getWorld () …" and so on
}
Thanks ^^, the enventhandler was all there have just copied it with net, thank you
This is an annotation placed there for a reason.
https://dev-tek.de/lexicon/entry/10-java-annotationen/