Menu's

Discussion in 'Spigot Plugin Development' started by DJJujuVI, Jun 26, 2016.

  1. Hey guys, how would I open a enchantment table menu if I do the command enchant? Or a dispenser menu if I do /dispenser? Thanks!! (I basically want the menus and how to make them into commands)
     
  2. Bukkit.createInventory(InventoryHolder, InventoryType, String)
    Bukkit.createInventory(InventoryHolder, InventoryType)
     
  3. Please put Useful rating on this if it worked

    Code (Text):
      public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if((sender instanceof Player)) {
         Player player = (Player) sender;

         if(command.getName ().equalsIgnoreCase ("enchant")) {
           Inventory enchant = Bukkit.createInventory (null, InventoryType.ENCHANTING, "Title");
           player.openInventory (enchant);
           return true;
         }
         if(command.getName ().equalsIgnoreCase ("dispenser")) {
           Inventory dispenser = Bukkit.createInventory (null, InventoryType.DISPENSER, "Title");
           player.openInventory (dispenser);
           return true;
         }
        }
        return true;
      }
     
    #3 Snowmite, Jun 27, 2016
    Last edited: Jun 27, 2016
    • Useful Useful x 1
  4. I don't need to test it,I already tell this works . :)
     
  5. I edited it, it now has the commands in it.. :)
     
  6. If you need anymore help, just PM me :)
     
  7. Thanks, but that wasn't necessary, but thanks!