Solved How can I change the glass color in Inv?

Discussion in 'Plugin Development' started by KodyXtremeFTW, Dec 31, 2014.

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

    KodyXtremeFTW

    I was trying to make a inventory menu that had games like: SG, FFA, Factions, etc. But I wanted to add a Purple Glass Pane and Purple Wool into something similar to this server:
    [​IMG]

    But for some reason or I just can't figure it out it shows up like this:
    [​IMG]
    I hope someone can help me with this problem.
    Code Below:

    Code:
    @SuppressWarnings("deprecation")
        public void openArcantizMenu(Player player) {
            Inventory arcantiz = Bukkit.createInventory(null, 54, "§5§lARCANTIZ§8» §0Click an item!");
           
            ItemStack glass = new ItemStack(Material.THIN_GLASS);
            ItemMeta glassM = glass.getItemMeta();
            glassM.setDisplayName("§7§lEMPTY SLOT");
            glass.setItemMeta(glassM);
           
            ItemStack info = new ItemStack(Material.WOOL);
            ItemMeta infoM = info.getItemMeta();
            infoM.setDisplayName("§5§lArcantiz Arcade");
            List<String> infoL = new ArrayList<String>();
            infoL.add("§7Players: §c" + Bukkit.getOnlinePlayers().length + "/" + Bukkit.getMaxPlayers());
            infoL.add("§7Version: §c");
            infoL.add("§7Ping: §a" + getPlayerPing(player));
            infoL.add("§7Owners: §4pandaria33 §7& §4KodyXtremeFTW");
            infoL.add("§7Credits: §c0 (In-Development)");
            infoL.add("§7Website: §cwww.Arcantiz.Enjin.com");
            infoM.setLore(infoL);
            info.setItemMeta(infoM);
           
            ItemStack sg = new ItemStack(Material.BOW);
            ItemMeta sgM = sg.getItemMeta();
            sgM.setDisplayName("§6§lSurvival Games");
            List<String> sgL = new ArrayList<String>();
            sgL.add("§a§lWhat is Survival Games?");
            sgL.add("§7§oSurvival Games is a §7§lFree For All §7§ogamemode were you must");
            sgL.add("§7§ocompete against 23 players and become the remaining survivor. There");
            sgL.add("§7§oare chest scattered all over the map that you must find to obtain");
            sgL.add("§7§oweapons, armor, etc. But don't hide from others. When there are 3 tributes");
            sgL.add("§7§oremaining, the deathmatch starts and you must fight the final 3 tributes.");
            sgL.add("§7§oLast Man Standing §dWINS THE GAME§7§o!");
            sgL.add("§a§lTutorial:");
            sgL.add("§3§l1. §6§lClick §7§othis item to teleport to the Lobby.");
            sgL.add("§3§l2. §7§oSelect a match that is in §eWAITING §7stage.");
            sgL.add("§3§l3. §2Done!");
            sgM.setLore(sgL);
            sg.setItemMeta(sgM);
           
            ItemStack factions = new ItemStack(Material.DIAMOND_CHESTPLATE);
            ItemMeta factionsM = factions.getItemMeta();
            factionsM.setDisplayName("§6§lFactions");
            List<String> factionsL = new ArrayList<String>();
            factionsL.add("§a§lWhat is Factions?:");
            factionsL.add("§7§oFactions is a §7§lRaiding/PvP §7§ogamemode were you can");
            factionsL.add("§7§ocreate a faction with your friends, fight against other factions");
            factionsL.add("§7§oraid for riches to become the most riches and overpowered gear possible");
            factionsL.add("§a§lTutorial:");
            factionsL.add("§3§l1. §6§lClick §7§othis item to teleport to the factions spawn.");
            factionsL.add("§3§l2. §7§oTo create a faction, use §6/f create §7§oand the name for your faction.");
            factionsL.add("§3§l3. §7§oTo set a description for your faction, use §6/f desc §7§oand the description you want.");
            factionsL.add("§3§l4. §2Done!");
            factionsL.add("§a§lTIPS:");
            factionsL.add("§c§l3 TNT §7§ocan destroy §5§l1 Obsidian Block§7§o.");
            factionsL.add("§7§oMake a huge farm to earn money §a§lFASTER§7§o.");
            factionsL.add("§7§oMake sure you have enough power to claim any landscapes with §6/f claim§7§o!");
            factionsM.setLore(factionsL);
            factions.setItemMeta(factionsM);
           
            ItemStack freebuild = new ItemStack(Material.GRASS);
            ItemMeta freebuildM = freebuild.getItemMeta();
            freebuildM.setDisplayName("§6§lFreeBuild");
            List<String> freebuildL = new ArrayList<String>();
            freebuildL.add("§a§lWhat is FreeBuild?:");
            freebuildL.add("§7§oFreeBuild is a §7§lCreativity §7§ogamemode were you can");
            freebuildL.add("§7§obuild anything your imagination can think of. Build");
            freebuildL.add("§7§oanything you would desire such as a house, statues,");
            freebuildL.add("§7§odifferent charactor themes from other games, etc.");
            freebuildL.add("§a§lTutorial:");
            freebuildL.add("§3§l1. §6§lClick §7§othis selection to teleport to the Spawn Location.");
            freebuildL.add("§3§l2. §7§oTo create/claim a plot, use §6/plot claim§§o7. Another way is §6/plot auto§7§o.");
            freebuildL.add("§3§l3. §7§oTo clear your plot, type §6/plot clear§7§o.");
            freebuildL.add("§3§l4. §7§oTo dispose your plot, type §6/plot dispose§7§o.");
            freebuildL.add("§3§l5. §2Done!");
            freebuildL.add("§a§lTIPS:");
            freebuildL.add("§7§oCommand §6/plot auto §7§ocan automatically find you a plot faster then using §6/plot claim§7§o!");
            freebuildM.setLore(freebuildL);
            freebuild.setItemMeta(freebuildM);
           
            ItemStack spawn = new ItemStack(Material.NETHER_STAR);
            ItemMeta spawnM = spawn.getItemMeta();
            spawnM.setDisplayName("§6§lSpawn");
            List<String> spawnL = new ArrayList<String>();
            spawnL.add("§a§lWhat is Spawn?:");
            spawnL.add("§7§oSpawn is a §7§lSafeZone §7§owere players join for the first time,");
            spawnL.add("§7§oleave, join again, and hang out. Spawn is also a protected zone from");
            spawnL.add("§7§opvp, monsters, and griefers.");
            spawnL.add("§a§lTutorial:");
            spawnL.add("§3§l1. §6§lClick §7§othis item to teleport to spawn.");
            spawnL.add("§3§l2. §2Done!");
            spawnM.setLore(spawnL);
            spawn.setItemMeta(spawnM);
           
            ItemStack prison = new ItemStack(Material.IRON_FENCE);
            ItemMeta prisonM = prison.getItemMeta();
            prisonM.setDisplayName("§6§lPrison");
            List<String> prisonL = new ArrayList<String>();
            prisonL.add("§a§lWhat is Prison?:");
            prisonL.add("§7§oPrison is a §7§lMining §7§ogamemode were you mine");
            prisonL.add("§7§oores or blocks then you sell them to earn cash and rank up.");
            prisonL.add("§7§oThe ranks go from §a§lA §7to §c§lZ§7 and you start on §a§lA§7.");
            prisonL.add("§7§oYou rank up when you have mined enough ores and enough money. Take");
            prisonL.add("§7§othis advice. The more ores you mine, the more cash you earn, the faster");
            prisonL.add("§7§oyou rank up!");
            prisonL.add("§a§lTutorial:");
            prisonL.add("§3§l1. §6§lClick §7§othis item to teleport to Prison.");
            prisonL.add("§3§l2. §7§oSelect your kit (A).");
            prisonL.add("§3§l3. §7§oMine for ores to rank up.");
            prisonL.add("§3§l4. §2Done!");
            prisonM.setLore(prisonL);
            prison.setItemMeta(prisonM);
           
            ItemStack pvp = new ItemStack(Material.DIAMOND_SWORD);
            ItemMeta pvpM = pvp.getItemMeta();
            pvpM.setDisplayName("§6§l1v1 §8- §5§oComing Soon");
            List<String> pvpL = new ArrayList<String>();
            pvpL.add("§a§lWhat is 1v1?:");
            pvpL.add("§7§o1v1 is a §7§oPlayer vs Player §7§ogamemode were");
            pvpL.add("§7§oyou must fight in a small-normal arena against");
            pvpL.add("§7§oanother player. First person to be slaughtered,");
            pvpL.add("§7§ois §dELIMINATED§7!");
            pvpL.add("§a§lTutorial:");
            pvpL.add("§c§oComing Soon!");
            pvpM.setLore(pvpL);
            pvp.setItemMeta(pvpM);
           
            ItemStack titanfall = new ItemStack(Material.ARROW);
            ItemMeta titanfallM = titanfall.getItemMeta();
            titanfallM.setDisplayName("§6§lTitanFall §8- §5§oComing Soon");
            List<String> titanfallL = new ArrayList<String>();
            titanfallL.add("§a§lWhat is TitanFall?:");
            titanfallL.add("§c§oComing Soon!");
            titanfallL.add("");
            titanfallL.add("§a§lTutorial?:");
            titanfallL.add("§c§oComing Soon!");
            titanfallM.setLore(titanfallL);
            titanfall.setItemMeta(titanfallM);
           
            ItemStack ffa = new ItemStack(Material.IRON_SWORD);
            ItemMeta ffaM = ffa.getItemMeta();
            ffaM.setDisplayName("§6§lFFA §8- §c§oStress Test");
            List<String> ffaL = new ArrayList<String>();
            ffaL.add("§a§lWhat is FFA");
            ffaL.add("§7§oFFA is known as §7§lFree For All§7§o. In this pvp game you can't team.");
            ffaL.add("§7§oYou must fight solo against other players. Killing is the §c§l#1 §7§oPriority.");
            ffaL.add("§7§oWhy, because when you kill any player, you rank up. The more kills you gain the");
            ffaL.add("§7§omore you can rank up.");
            ffaL.add("§7§lRank Ups:");
            ffaL.add("");
            ffaL.add("§7§lSilver §8- §7Kills: §3§l25");
            ffaL.add("§6§lGold §8- §7Kills: §3§l100");
            ffaL.add("§d§lPlatinum §8- §7Kills: §3§l200");
            ffaL.add("§3§lDiamond §8- §7Kills: §3§l300");
            ffaL.add("§b§lMaster §8- §7Kills: §3§l500");
            ffaL.add("§6§lGrand Master §8- §7Kills: §3§l1000");
            ffaL.add("");
            ffaL.add("§a§lTutorial:");
            ffaL.add("§3§l1. §6§lClick §7§othis item to teleport to Arena.");
            ffaL.add("§3§l2. §7§oYou will recive your kit when you spawn.");
            ffaL.add("§3§l3. §2Done!");
            ffaM.setLore(ffaL);
            ffa.setItemMeta(ffaM);
           
            arcantiz.setItem(0, glass);
            arcantiz.setItem(1, glass);
            arcantiz.setItem(2, glass);
            arcantiz.setItem(3, glass);
            arcantiz.setItem(4, info);
            arcantiz.setItem(5, glass);
            arcantiz.setItem(6, glass);
            arcantiz.setItem(7, glass);
            arcantiz.setItem(8, glass);
            arcantiz.setItem(9, glass);
            arcantiz.setItem(17, glass);
            arcantiz.setItem(18, glass);
            arcantiz.setItem(26, glass);
            arcantiz.setItem(27, glass);
            arcantiz.setItem(35, glass);
            arcantiz.setItem(36, glass);
            arcantiz.setItem(44, glass);
            arcantiz.setItem(45, glass);
            arcantiz.setItem(53, glass);
           
            arcantiz.setItem(28, sg);
            arcantiz.setItem(49, factions);
            arcantiz.setItem(31, freebuild);
            arcantiz.setItem(34, prison);
            arcantiz.setItem(38, pvp);
            arcantiz.setItem(40, ffa);
            arcantiz.setItem(42, titanfall);
            arcantiz.setItem(13, spawn);
           
            player.openInventory(arcantiz);
        }
    Thanks for anyone that does!
     
  2. Offline

    API_Tutorials

    @KodyXtremeFTW
    something like:
    Code:
    ItemStack item = new ItemStack(Material.THIN_GLASS, <amount>, DyeColor.<color>.getDyeColor());
    
     
  3. Offline

    KodyXtremeFTW

    Ok, I got the Purple Wool to work, but not the THIN_GLASS.
     
  4. Offline

    API_Tutorials

  5. Offline

    KodyXtremeFTW

    Tried it before. Nothing happend.
     
  6. @KodyXtremeFTW glass.setDurability(Durability here). Durability = MetaData, for example 102:3
    In this example, 3 is the MetaData. I don't know the exact metadata for purple glass, but you can get it simply in game, for example if you use essentials, just get it into your hands and enter /itemdb. You can also search somewhere on the internet, but after getting onto one page that didn't have it, I got bored and lazy. :D
     
  7. Offline

    xTigerRebornx

    @KodyXtremeFTW The stained glass uses a different ID then the glass pane. You'll have to use the deprecated constructor and manually give the ID, then give the data value same way, as I don't believe bukkit has had an update to support the stained glass.

    Edit: Wasn't sure on whether or not Bukkit had added it, there is one now though
     
    Last edited: Jan 1, 2015
    Konato_K likes this.
  8. Offline

    KodyXtremeFTW

    Didn't work.
     
  9. @KodyXtremeFTW Hmm, weird. Well, I currently don't have more ideas. :D Good luck and happy new year.
     
  10. Offline

    Monkeyboystein

    Ismt there a Material.STAINED_PANE?
     
  11. Offline

    Evaluations

    Code:
    ItemStack CyanGlass = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.CYAN.getData());
    Then,
    Code:
    arcantiz.setItem(0, CyanGlass);
     
  12. Offline

    KodyXtremeFTW

    Problem Solved! THIN_GLASS was supposed to be STAINED_GLASS_PANE

    Thanks for all your ideas! :D
     
    PDKnight likes this.
Thread Status:
Not open for further replies.

Share This Page