Hi guys! I have some questions to you: 1. If I have the method with "InvenoryClickEvent", how to get the Player from this event and send him a messege "Hello"? 2. I want plugin to check if player picks up an item with name "Needed Stick". And if so - to place it on the "0" place in the inventory(To move all items on +1 slot). Look at the image with numbers in the inventory: Please help me!
1. http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryClickEvent.html 2. http://jd.bukkit.org/rb/apidocs/org/bukkit/event/player/PlayerPickupItemEvent.html
Hi dere Growl, getting the player who clicked at an InventoryInteractEvent can be done using: Code:java (Player)event.getWhoClicked(); Next to check the displayname of the item, use the following: Code:java ItemStack item = event.getCurrentItem();if(item.getType() == Material.AIR){ return; }ItemMeta itemMeta = item.getItemMeta();if(itemMeta.getDisplayName().equalsIgnoreCase("Needed Stick")){//TODO add your code here} for moving the items, I would recommend you try place the following instead of '//TODO add your code here' Code:java PlayerInventory inv = event.getPlayer().getInventory(); for(int slotID = 35; slotID > 0; slotID --){inv.setItem(slotID + 1, inv.getItem(slotID));} inv.setItem(0, item); I am not sure though if the example above works, for I've never tried anything like this before.