Minecraft Plugin programmieren bei klicken auf Item in speziellen Inventar einen Command ausführen?

Minecraft Plugin programmieren bei klicken auf Item in speziellen Inventar einen Command ausführen?

Wie kann man das machen?

Hier ist mein Sourcecode:

	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		Player p = (Player) sender;
		if(p.hasPermission("rankup.open")) {
			if((sender instanceof Player)) {
				if(args.length == 0) {
					Inventory inventory = Bukkit.createInventory(null, 93, "§6§lRang Shop"); p.sendMessage("§7Du hast das Rank-Up Menü geöffnet!"); p.openInventory(inventory);  
                ItemStack kosten1 = new ItemStack(Material.GOLD_NUGGET);
                ItemMeta ITEMMETA = kosten1.getItemMeta();
                ITEMMETA.setDisplayName("§4§l10.000$");
                kosten1.setItemMeta(ITEMMETA);
                
                ItemStack kosten2 = new ItemStack(Material.GOLD_NUGGET);
                ItemMeta item = kosten2.getItemMeta();
                item.setDisplayName("§4§l100.000$");
                kosten2.setItemMeta(item);
                
                ItemStack kosten3 = new ItemStack(Material.GOLD_NUGGET);
                ItemMeta halt = kosten3.getItemMeta();
                halt.setDisplayName("§4§l1.000.000$");
                kosten3.setItemMeta(halt);
                
                ItemStack diamond = new ItemStack(Material.DIAMOND_BLOCK);
                ItemMeta itemMeta = diamond.getItemMeta();
                itemMeta.setDisplayName("§b§lDiamond Rang");
                diamond.setItemMeta(itemMeta);


                inventory.setItem(11, diamond);
                
                ItemStack ultra = new ItemStack(Material.EMERALD_BLOCK);
                ItemMeta ItemMeta = ultra.getItemMeta();
                ItemMeta.setDisplayName("§a§lUltra Rang");
                ultra.setItemMeta(ItemMeta);
                
                inventory.setItem(13, ultra);
                
                ItemStack supreme = new ItemStack(Material.PURPUR_BLOCK);
                ItemMeta iTemMeta = supreme.getItemMeta();
                iTemMeta.setDisplayName("§d§lSupreme Rang");
                supreme.setItemMeta(iTemMeta);
                
                inventory.setItem(15, supreme);
                
                ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE);
                ItemMeta itemmeta = glass.getItemMeta();
                itemmeta.setDisplayName("§6Ränge");
                glass.setItemMeta(itemmeta);
                
                inventory.setItem(0, glass);
                inventory.setItem(1, glass);
                inventory.setItem(2, glass);
                inventory.setItem(3, glass);
                inventory.setItem(4, glass);
                inventory.setItem(5, glass);
                inventory.setItem(6, glass);
                inventory.setItem(7, glass);
                inventory.setItem(8, glass);
                inventory.setItem(9, glass);
                inventory.setItem(10, glass);
                inventory.setItem(12, glass);
                inventory.setItem(14, glass);
                inventory.setItem(16, glass);
                inventory.setItem(17, glass);
                inventory.setItem(18, glass);
                inventory.setItem(19, glass);
                inventory.setItem(20, kosten1);
                inventory.setItem(21, glass);
                inventory.setItem(22, kosten2);
                inventory.setItem(23, glass);
                inventory.setItem(24, kosten3);
                inventory.setItem(25, glass);
                inventory.setItem(26, glass);
                inventory.setItem(27, glass);
                inventory.setItem(28, glass);




                      }
                    }
                {
            
            }
            
        }
            
        
    
    return false;
}
@EventHandler
public void onClick(InventoryClickEvent e) {
  if (e.getInventory().getName().equals("§6§lRang Shop")) {
    if (e.getCurrentItem() != null && e.getCurrentItem().getType() != Material.AIR) {
      e.setCancelled(true);   
    }
  }
} 

  } }

Computer, programmieren, Java, Minecraft, Minecraft Server, Minecraft Plugin
Minecraft Plugin programmieren Item verschieben oder droppen verbieten?
Minecraft Plugin programmieren Item verschieben oder droppen verbieten? Dies ist mein Sourcecode:
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

public class RankUpCommand implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    Player p = (Player) sender;
    if(p.hasPermission("rankup.open")) {
        if((sender instanceof Player)) {
            if(args.length == 0) {
                Inventory inventory = Bukkit.createInventory(null, 9*3, "§6§lRank-Up");
                p.openInventory(inventory);
                p.sendMessage("§7Du hast das Rank-Up Menü geöffnet!");
                
                ItemStack diamond = new ItemStack(Material.DIAMOND);
                ItemMeta itemMeta = diamond.getItemMeta();
                itemMeta.setDisplayName("§b§lDiamond Rang");
                diamond.setItemMeta(itemMeta);


                inventory.setItem(11, diamond);
                
                ItemStack ultra = new ItemStack(Material.BEACON);
                ItemMeta ItemMeta = ultra.getItemMeta();
                ItemMeta.setDisplayName("§b§lUltra Rang");
                ultra.setItemMeta(ItemMeta);
                
                inventory.setItem(13, ultra);
                
                ItemStack supreme = new ItemStack(Material.REDSTONE_BLOCK);
                ItemMeta iTemMeta = supreme.getItemMeta();
                iTemMeta.setDisplayName("§4§lSupreme Rang");
                supreme.setItemMeta(iTemMeta);
                
                inventory.setItem(15, supreme);
                
                ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE);
                ItemMeta itemmeta = glass.getItemMeta();
                itemmeta.setDisplayName("");
                supreme.setItemMeta(itemmeta);
                
                inventory.setItem(0, glass);
                inventory.setItem(1, glass);
                inventory.setItem(2, glass);
                inventory.setItem(3, glass);
                inventory.setItem(4, glass);
                inventory.setItem(5, glass);
                inventory.setItem(6, glass);
                inventory.setItem(7, glass);
                inventory.setItem(8, glass);
                inventory.setItem(9, glass);
                inventory.setItem(10, glass);
                inventory.setItem(12, glass);
                inventory.setItem(14, glass);
                inventory.setItem(16, glass);
                inventory.setItem(17, glass);
                inventory.setItem(18, glass);
                inventory.setItem(19, glass);
                inventory.setItem(20, glass);
                inventory.setItem(21, glass);
                inventory.setItem(22, glass);
                inventory.setItem(23, glass);
                inventory.setItem(24, glass);
                inventory.setItem(25, glass);
                inventory.setItem(26, glass);
                inventory.setItem(27, glass);
                inventory.setItem(28, glass); {
            
                
            }
            
        }
                }
            }
        
    
    return false;
}


}

Bitte hilft mir!

programmieren, Java, Minecraft, Informatik, Minecraft Server, Minecraft Plugin, Plugin Programmieren