Guest User

BuyGui.java

a guest
Jan 25th, 2022
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. package com.teliax.tutorial.commands;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.DyeColor;
  6. import org.bukkit.Material;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandExecutor;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.entity.Item;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.inventory.Inventory;
  13. import org.bukkit.inventory.ItemStack;
  14. import org.bukkit.inventory.meta.ItemMeta;
  15.  
  16. import java.util.ArrayList;
  17.  
  18. public class BuyGUI implements CommandExecutor {
  19.  
  20. @Override
  21. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  22.  
  23.  
  24. if (sender instanceof Player){
  25. Player player = (Player) sender;
  26.  
  27. Inventory gui;
  28. gui = Bukkit.createInventory(player, 45, "§8[§5§lBUYCRAFT§8]");
  29. ItemStack hvidglas = new Item(Material.STAINED_GLASS_PANE, 1, DyeColor.WHITE.getData());
  30. ItemStack glas = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.PURPLE.getData());
  31. ItemStack air = new ItemStack(Material.AIR);
  32. ItemStack rankbog = new ItemStack(Material.BOOK);
  33. ItemStack andetbog = new ItemStack(Material.BOOK);
  34.  
  35. ItemMeta glas_meta = glas.getItemMeta();
  36. glas_meta.setDisplayName(ChatColor.RED + " ");
  37. ArrayList<String> glas_lore = new ArrayList<>();
  38. glas_lore.add(ChatColor.GOLD + " ");
  39. glas_meta.setLore(glas_lore);
  40. glas.setItemMeta(glas_meta);
  41.  
  42. ItemMeta hvidglas_meta = hvidglas.getItemMeta();
  43. hvidglas_meta.setDisplayName(ChatColor.RED + " ");
  44. ArrayList<String> hvidglas_lore = new ArrayList<>();
  45. hvidglas_lore.add(ChatColor.GOLD + " ");
  46. hvidglas_meta.setLore(hvidglas_lore);
  47. hvidglas.setItemMeta(hvidglas_meta);
  48.  
  49. ItemMeta bog_meta = rankbog.getItemMeta();
  50. bog_meta.setDisplayName("§5§lRANKS");
  51. ArrayList<String> bog_lore = new ArrayList<>();
  52. bog_lore.add("§fTryk her, for at tilgå §dranks§f.");
  53. bog_lore.add("");
  54. bog_lore.add("§fIndeholder:");
  55. bog_lore.add(" §8§m-§5§l OMEGA §f§lRANK");
  56. bog_lore.add(" §8§m-§e§l GAMMA §f§lRANK");
  57. bog_lore.add(" §8§m-§a§l ALPHA §f§lRANK");
  58. bog_lore.add(" §8§m-§b§l BETA §f§lRANK");
  59. bog_meta.setLore(bog_lore);
  60. rankbog.setItemMeta(bog_meta);
  61.  
  62. ItemMeta andetbog_meta = andetbog.getItemMeta();
  63. andetbog_meta.setDisplayName("§9§lANDET");
  64. ArrayList<String> andetbog_lore = new ArrayList<>();
  65. andetbog_lore.add("§fTryk her, for at tilgå §3andet§f.");
  66. andetbog_lore.add("");
  67. andetbog_lore.add("§fIndeholder:");
  68. andetbog_lore.add(" §8§m-§b§l FLY §f§lKOMMANDO");
  69. andetbog_lore.add(" §8§m-§a§l PV §f§l10");
  70. andetbog_lore.add(" §8§m-§e§l RESET §f§lMINER");
  71. andetbog_meta.setLore(andetbog_lore);
  72. andetbog.setItemMeta(andetbog_meta);
  73.  
  74.  
  75. ItemStack[] menu_items = {glas, glas, glas, glas, glas, glas, glas, glas, glas, air, air, air, air, air, air, air, air, air, air, air, air, rankbog, air, andetbog, air, air, air, air, air, air, air, air, air, air, air, air, hvidglas, hvidglas, hvidglas, hvidglas, hvidglas, hvidglas, hvidglas, hvidglas, hvidglas};
  76. gui.setContents(menu_items);
  77. player.openInventory(gui);
  78. }
  79. return true;
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment