kerpson 551 Opublikowano 23 października 2018 Udostępnij Opublikowano 23 października 2018 (edytowane) Zrobiłem inny sposób na inventory, i chce się dowiedzieć, jak on działa, optymalnie czy nie? inventory: public class HelpInventory { public static Inventory help = Bukkit.getServer().createInventory(null, 54, "§6§lPomoc"); static{ ItemStack glass = new ItemBuilder(Material.STAINED_GLASS_PANE, 1).setDurability((short) 7).setName(TranslateAPI.format(Main.getInst().getConfig().getString("glass.name"))).setLore(TranslateAPI.format(Main.getInst().getConfig().getStringList("glass.lore"))).toItemStack(); ItemStack paper = new ItemBuilder(Material.PAPER, 1).setName(TranslateAPI.format(Main.getInst().getConfig().getString("pomoc.paper.name"))).setLore(TranslateAPI.format(Main.getInst().getConfig().getStringList("pomoc.paper.lore"))).addEnchant(Enchantment.DURABILITY, 3).toItemStack(); ItemStack itemframe = new ItemBuilder(Material.ITEM_FRAME, 1).setName(TranslateAPI.format(Main.getInst().getConfig().getString("pomoc.frame.name"))).setLore(TranslateAPI.format(Main.getInst().getConfig().getStringList("pomoc.frame.lore"))).toItemStack(); ItemStack diamond = new ItemBuilder(Material.DIAMOND, 1).setName(TranslateAPI.format(Main.getInst().getConfig().getString("pomoc.diamond.name"))).setLore(TranslateAPI.format(Main.getInst().getConfig().getStringList("pomoc.diamond.lore"))).toItemStack(); int i = 0; while(i < 50){ help.setItem(i, glass); i++; } help.setItem(4, paper); help.setItem(10, itemframe); help.setItem(16, diamond); } } a potem w komendzie w innej klasie: p.openInventory(HelpInventory.help); (Wiem, że mogłem skrócić pętlę, ale na szybko to pisałem XD) Edytowane 24 października 2018 przez LjayPL789 Dodaję znaki diakrytyczne; poprawiam interpunkcję. Notatka dodana przez bludis gnomq 1 Odnośnik do komentarza https://skript.pl/temat/30014-czy-ten-spos%C3%B3b-jest-dobry/ Udostępnij na innych stronach Więcej opcji udostępniania...
0 kerpson 551 Opublikowano 23 października 2018 Autor Udostępnij Opublikowano 23 października 2018 Zamykam Odnośnik do komentarza https://skript.pl/temat/30014-czy-ten-spos%C3%B3b-jest-dobry/#findComment-196942 Udostępnij na innych stronach Więcej opcji udostępniania...
0 bludis 418 Opublikowano 24 października 2018 Udostępnij Opublikowano 24 października 2018 Ten temat został zamknięty. Odnośnik do komentarza https://skript.pl/temat/30014-czy-ten-spos%C3%B3b-jest-dobry/#findComment-196951 Udostępnij na innych stronach Więcej opcji udostępniania...
Pytanie
kerpson 551
Zrobiłem inny sposób na inventory, i chce się dowiedzieć, jak on działa, optymalnie czy nie?
inventory:
public class HelpInventory { public static Inventory help = Bukkit.getServer().createInventory(null, 54, "§6§lPomoc"); static{ ItemStack glass = new ItemBuilder(Material.STAINED_GLASS_PANE, 1).setDurability((short) 7).setName(TranslateAPI.format(Main.getInst().getConfig().getString("glass.name"))).setLore(TranslateAPI.format(Main.getInst().getConfig().getStringList("glass.lore"))).toItemStack(); ItemStack paper = new ItemBuilder(Material.PAPER, 1).setName(TranslateAPI.format(Main.getInst().getConfig().getString("pomoc.paper.name"))).setLore(TranslateAPI.format(Main.getInst().getConfig().getStringList("pomoc.paper.lore"))).addEnchant(Enchantment.DURABILITY, 3).toItemStack(); ItemStack itemframe = new ItemBuilder(Material.ITEM_FRAME, 1).setName(TranslateAPI.format(Main.getInst().getConfig().getString("pomoc.frame.name"))).setLore(TranslateAPI.format(Main.getInst().getConfig().getStringList("pomoc.frame.lore"))).toItemStack(); ItemStack diamond = new ItemBuilder(Material.DIAMOND, 1).setName(TranslateAPI.format(Main.getInst().getConfig().getString("pomoc.diamond.name"))).setLore(TranslateAPI.format(Main.getInst().getConfig().getStringList("pomoc.diamond.lore"))).toItemStack(); int i = 0; while(i < 50){ help.setItem(i, glass); i++; } help.setItem(4, paper); help.setItem(10, itemframe); help.setItem(16, diamond); } }a potem w komendzie w innej klasie:
p.openInventory(HelpInventory.help);
(Wiem, że mogłem skrócić pętlę, ale na szybko to pisałem XD)
Edytowane przez LjayPL789Dodaję znaki diakrytyczne; poprawiam interpunkcję.
Notatka dodana przez bludis
Odnośnik do komentarza
https://skript.pl/temat/30014-czy-ten-spos%C3%B3b-jest-dobry/Udostępnij na innych stronach
2 odpowiedzi na to pytanie
Rekomendowane odpowiedzi