Bukkit 1.10 Tutorials?

Discussion in 'Plugin Development' started by iClipse, Oct 24, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    iClipse

    I heard that there is no difference between bukkit 1.8 to 1.10 except for using new items.

    But then I find out none of my code works cuz its based off of 1.8 bukkit. So is there a tutorial or guide for moving from 1.8 to 1.10 giving all the differences? Thanks!
     
  2. Offline

    timtower Administrator Administrator Moderator

    @iClipse Could you post the code?
    Because I am still building on 1.7 just fine.
     
  3. Offline

    iClipse

    Code:
    public boolean onCommand(CommandSender theSender, Command cmd, String commandLabel, String[] args)
    {
        if(commandLabel.equalsIgnoreCase("shop"))
        {
            Player player = (Player) theSender;
            {
            private void openGUI (Player player)
            {
                Inventory inv = Bukkit.createInventory(null, 18, ChatColor.GOLD + "Shop");
              
                ItemStack ores = new ItemStack(Material.IRON_INGOT);
                ItemMeta oresMeta = ores.getItemMeta();
                ItemStack raw_blocks = new ItemStack (Material.STONE);
                ItemMeta raw_blocksMeta = raw_blocks.getItemMeta();
                ItemStack crafted_blocks = new ItemStack (Material.SMOOTH_BRICK);
                ItemMeta crafted_blocksMeta = crafted_blocks.getItemMeta();
                ItemStack wood_and_plants = new ItemStack(Material.SAPLING);
                ItemMeta wood_and_plantsMeta = wood_and_plants.getItemMeta();
                ItemStack food_and_farming = new ItemStack (Material.GRILLED_PORK);
                ItemMeta food_and_farmingMeta = wood_and_plants.getItemMeta();
                ItemStack drops = new ItemStack (Material.SULPHUR);
                ItemMeta dropsMeta = drops.getItemMeta();
                ItemStack decorative = new ItemStack (Material.BOOKSHELF);
                ItemMeta decorativeMeta = decorative.getItemMeta();
                ItemStack mechanisms = new ItemStack(Material.REDSTONE_LAMP_ON);
                ItemMeta mechanismsMeta = mechanisms.getItemMeta();
                ItemStack misk = new ItemStack(Material.SADDLE);
                ItemMeta miskMeta = misk.getItemMeta();
                ItemStack dyes = new ItemStack (Material.YELLOW_FLOWER);
                ItemMeta dyesMeta = dyes.getItemMeta();
                ItemStack tools_and_combat = new ItemStack (Material.IRON_PICKAXE);
                ItemMeta tools_and_combatMeta = tools_and_combat.getItemMeta();
                ItemStack brewing = new ItemStack (Material.BREWING_STAND);
                ItemMeta brewingMeta = brewing.getItemMeta();
                ItemStack enchanting = new ItemStack (Material.ENCHANTED_BOOK);
                ItemMeta enchantingMeta = enchanting.getItemMeta();
              
                oresMeta.setDisplayName(ChatColor.GRAY + "Ores");
                ores.setItemMeta(oresMeta);
              
                raw_blocksMeta.setDisplayName(ChatColor.DARK_GREEN + "Raw Blocks");
                raw_blocks.setItemMeta (raw_blocksMeta);
              
                crafted_blocksMeta.setDisplayName(ChatColor.DARK_RED + "Crafted Blocks");
                crafted_blocks.setItemMeta(crafted_blocksMeta);
              
                wood_and_plantsMeta.setDisplayName(ChatColor.GREEN + "Wood and Plants");
                wood_and_plants.setItemMeta(wood_and_plantsMeta);
              
                food_and_farmingMeta.setDisplayName(ChatColor.RED + "Food and Farming");
                food_and_farming.setItemMeta(food_and_farmingMeta);
              
                dropsMeta.setDisplayName(ChatColor.DARK_PURPLE + "Drops");
                drops.setItemMeta(dropsMeta);
              
                decorativeMeta.setDisplayName(ChatColor.AQUA + "Decorative");
                decorative.setItemMeta(decorativeMeta);
              
                mechanismsMeta.setDisplayName(ChatColor.YELLOW + "Mehcanisms");
                mechanisms.setItemMeta(mechanismsMeta);
              
                miskMeta.setDisplayName(ChatColor.WHITE + "Misk");
                misk.setItemMeta(miskMeta);
              
                dyesMeta.setDisplayName (ChatColor.BLUE + "D" + ChatColor.GREEN + "y" + ChatColor.YELLOW + "e" + ChatColor.DARK_RED + "s");
                dyes.setItemMeta(dyesMeta);
              
                tools_and_combatMeta.setDisplayName(ChatColor.DARK_GRAY + "Tools and Combat");
                tools_and_combat.setItemMeta(tools_and_combatMeta);
              
                brewingMeta.setDisplayName(ChatColor.GOLD + "Brewing");
                brewing.setItemMeta (brewingMeta);
              
                enchantingMeta.setDisplayName(ChatColor.MAGIC + "Enchanting");
                enchanting.setItemMeta (enchantingMeta);
              
                inv.setItem(2, ores);
                inv.setItem(3, raw_blocks);
                inv.setItem(4, crafted_blocks);
                inv.setItem(5, food_and_farming);
                inv.setItem(6, wood_and_plants);
                inv.setItem(7, drops);
                inv.setItem(8, decorative);
                inv.setItem(11, mechanisms);
                inv.setItem(12, misk);
                inv.setItem(13, dyes);
                inv.setItem(15, tools_and_combat);
                inv.setItem(16, brewing);
                inv.setItem(17, enchanting);
              
                player.openInventory(inv);
            }
          
            
     
  4. Offline

    timtower Administrator Administrator Moderator

    Moved to plugin development
    @iClipse And what isn't working then?
    And check if the sender is a player before you cast to it.
    Use cmd.getName() to compare the command.
     
  5. Offline

    iClipse

    I did....

    The command isnt working. I set it to do /(something) and it opens the GUI. It doesnt do nothing
     
  6. Offline

    timtower Administrator Administrator Moderator

  7. Offline

    xelatercero

    @timtower @iClipse

    EDIT: I SAID THAT DOESNT WORK , WORKS! but i have done a stupid thing registering the command, but i dont se the problem works fine

    EDIT 2: and the position of the objects :
    PHP:
    inv.setItem(2ores);
    if you want that the ores ItemStack in first position, the correcdt way is:
    PHP:
    inv.setItem(0ores);
    because start counting from 0

    Sorry my english


    PHP:
    public boolean onCommand(CommandSender theSenderCommand cmdString commandLabelString[] args){
            
    Player player = (PlayertheSender;
            if(
    theSender instanceof Player) {
                if(
    cmd.getName().equalsIgnoreCase("shop")) {
                    
    openGui(player);
                }
            }
            return 
    false;
        
        }
      
                
                
                
                  private 
    void openGui(Player player) {
                    
    Inventory inv Bukkit.createInventory(player18"shop");
                    
    player.sendMessage("debug message");//debug message doesnt work
                    
    ItemStack ores = new ItemStack(Material.IRON_INGOT);
                    
    ItemMeta oresMeta ores.getItemMeta();
                    
    ItemStack raw_blocks = new ItemStack (Material.STONE);
                    
    ItemMeta raw_blocksMeta raw_blocks.getItemMeta();
                    
    ItemStack crafted_blocks = new ItemStack (Material.SMOOTH_BRICK);
                    
    ItemMeta crafted_blocksMeta crafted_blocks.getItemMeta();
                    
    ItemStack wood_and_plants = new ItemStack(Material.SAPLING);
                    
    ItemMeta wood_and_plantsMeta wood_and_plants.getItemMeta();
                    
    ItemStack food_and_farming = new ItemStack (Material.GRILLED_PORK);
                    
    ItemMeta food_and_farmingMeta wood_and_plants.getItemMeta();
                    
    ItemStack drops = new ItemStack (Material.SULPHUR);
                    
    ItemMeta dropsMeta drops.getItemMeta();
                    
    ItemStack decorative = new ItemStack (Material.BOOKSHELF);
                    
    ItemMeta decorativeMeta decorative.getItemMeta();
                    
    ItemStack mechanisms = new ItemStack(Material.REDSTONE_LAMP_ON);
                    
    ItemMeta mechanismsMeta mechanisms.getItemMeta();
                    
    ItemStack misk = new ItemStack(Material.SADDLE);
                    
    ItemMeta miskMeta misk.getItemMeta();
                    
    ItemStack dyes = new ItemStack (Material.YELLOW_FLOWER);
                    
    ItemMeta dyesMeta dyes.getItemMeta();
                    
    ItemStack tools_and_combat = new ItemStack (Material.IRON_PICKAXE);
                    
    ItemMeta tools_and_combatMeta tools_and_combat.getItemMeta();
                    
    ItemStack brewing = new ItemStack (Material.BREWING_STAND);
                    
    ItemMeta brewingMeta brewing.getItemMeta();
                    
    ItemStack enchanting = new ItemStack (Material.ENCHANTED_BOOK);
                    
    ItemMeta enchantingMeta enchanting.getItemMeta();
              
                    
    oresMeta.setDisplayName(ChatColor.GRAY "Ores");
                    
    ores.setItemMeta(oresMeta);
              
                    
    raw_blocksMeta.setDisplayName(ChatColor.DARK_GREEN "Raw Blocks");
                    
    raw_blocks.setItemMeta (raw_blocksMeta);
              
                    
    crafted_blocksMeta.setDisplayName(ChatColor.DARK_RED "Crafted Blocks");
                    
    crafted_blocks.setItemMeta(crafted_blocksMeta);
              
                    
    wood_and_plantsMeta.setDisplayName(ChatColor.GREEN "Wood and Plants");
                    
    wood_and_plants.setItemMeta(wood_and_plantsMeta);
              
                    
    food_and_farmingMeta.setDisplayName(ChatColor.RED "Food and Farming");
                    
    food_and_farming.setItemMeta(food_and_farmingMeta);
              
                    
    dropsMeta.setDisplayName(ChatColor.DARK_PURPLE "Drops");
                    
    drops.setItemMeta(dropsMeta);
              
                    
    decorativeMeta.setDisplayName(ChatColor.AQUA "Decorative");
                    
    decorative.setItemMeta(decorativeMeta);
              
                    
    mechanismsMeta.setDisplayName(ChatColor.YELLOW "Mehcanisms");
                    
    mechanisms.setItemMeta(mechanismsMeta);
              
                    
    miskMeta.setDisplayName(ChatColor.WHITE "Misk");
                    
    misk.setItemMeta(miskMeta);
              
                    
    dyesMeta.setDisplayName (ChatColor.BLUE "D" ChatColor.GREEN "y" ChatColor.YELLOW "e" ChatColor.DARK_RED "s");
                    
    dyes.setItemMeta(dyesMeta);
              
                    
    tools_and_combatMeta.setDisplayName(ChatColor.DARK_GRAY "Tools and Combat");
                    
    tools_and_combat.setItemMeta(tools_and_combatMeta);
              
                    
    brewingMeta.setDisplayName(ChatColor.GOLD "Brewing");
                    
    brewing.setItemMeta (brewingMeta);
              
                    
    enchantingMeta.setDisplayName(ChatColor.MAGIC "Enchanting");
                    
    enchanting.setItemMeta (enchantingMeta);
              
                    
    inv.setItem(2ores);
                    
    inv.setItem(3raw_blocks);
                    
    inv.setItem(4crafted_blocks);
                    
    inv.setItem(5food_and_farming);
                    
    inv.setItem(6wood_and_plants);
                    
    inv.setItem(7drops);
                    
    inv.setItem(8decorative);
                    
    inv.setItem(11mechanisms);
                    
    inv.setItem(12misk);
                    
    inv.setItem(13dyes);
                    
    inv.setItem(15tools_and_combat);
                    
    inv.setItem(16brewing);
                    
    inv.setItem(17enchanting);
                
                
                  }
     
    Last edited: Oct 27, 2016
  8. Offline

    mythbusterma

    @iClipse

    You've put a method inside of a method. That has nothing to do with Bukkit, and has to do with you not understanding Java. Has nothing to do with version differences.
     
    Lordloss likes this.
Thread Status:
Not open for further replies.

Share This Page