Advertisement
Guest User

Inventory

a guest
Jan 17th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.98 KB | None | 0 0
  1. package fr.wayzen;
  2.  
  3. import java.util.Arrays;
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.DyeColor;
  7. import org.bukkit.Material;
  8. import org.bukkit.SkullType;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.event.EventHandler;
  11. import org.bukkit.event.Listener;
  12. import org.bukkit.event.block.Action;
  13. import org.bukkit.event.player.PlayerInteractEvent;
  14. import org.bukkit.inventory.ItemStack;
  15. import org.bukkit.inventory.meta.ItemMeta;
  16. import org.bukkit.inventory.meta.SkullMeta;
  17.  
  18. public class Inventory
  19. implements Listener
  20. {
  21. org.bukkit.inventory.Inventory inv = Bukkit.createInventory(null, 54, "�9�lMenu");
  22.  
  23. public Inventory(Main main) {}
  24.  
  25. public void Menu(Player p)
  26. {
  27. String player = p.getName();
  28.  
  29. ItemStack practice = new ItemStack(Material.DIAMOND_SWORD);
  30. ItemStack faction = new ItemStack(Material.OBSIDIAN);
  31. ItemStack box = new ItemStack(Material.GOLD_SWORD);
  32. ItemStack rush = new ItemStack(Material.BED);
  33. ItemStack games = new ItemStack(Material.GRASS);
  34. ItemStack glassG = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.GRAY.getData());
  35. ItemStack glassB = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.LIGHT_BLUE.getData());
  36. ItemStack tete = new ItemStack(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal());
  37. ItemStack tphub = new ItemStack(Material.ENDER_PORTAL_FRAME);
  38. ItemStack tpjump = new ItemStack(Material.DIAMOND_BOOTS);
  39. ItemStack tpvip = new ItemStack(Material.BEACON);
  40. ItemStack pref = new ItemStack(Material.FEATHER);
  41. ItemStack shop = new ItemStack(Material.GOLD_INGOT);
  42. ItemStack flag = new ItemStack(Material.BANNER, 1, DyeColor.RED.getData());
  43. ItemStack divergence = new ItemStack(Material.BLAZE_ROD);
  44. ItemStack uhc = new ItemStack(Material.GOLDEN_APPLE);
  45.  
  46. ItemMeta factionm = faction.getItemMeta();
  47. ItemMeta practicem = practice.getItemMeta();
  48. ItemMeta boxm = box.getItemMeta();
  49. ItemMeta rushm = rush.getItemMeta();
  50. ItemMeta gamesm = games.getItemMeta();
  51. SkullMeta sm = (SkullMeta)tete.getItemMeta();
  52. ItemMeta glassGm = glassG.getItemMeta();
  53. ItemMeta glassBm = glassB.getItemMeta();
  54. ItemMeta tphubm = tphub.getItemMeta();
  55. ItemMeta tpjumpm = tpjump.getItemMeta();
  56. ItemMeta tpvipm = tpvip.getItemMeta();
  57. ItemMeta prefm = pref.getItemMeta();
  58. ItemMeta shopm = shop.getItemMeta();
  59. ItemMeta uhcm = uhc.getItemMeta();
  60. ItemMeta divergencem = divergence.getItemMeta();
  61. ItemMeta flagm = flag.getItemMeta();
  62.  
  63. factionm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&c&lFaction"));
  64. faction.setItemMeta(factionm);
  65.  
  66. practicem.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&b&lPractice"));
  67. practice.setItemMeta(practicem);
  68.  
  69. boxm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&e&lFight&6&lBox"));
  70. box.setItemMeta(boxm);
  71.  
  72. rushm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&9&lRush"));
  73. rush.setItemMeta(rushm);
  74.  
  75. gamesm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&2&lLostGames"));
  76. games.setItemMeta(gamesm);
  77.  
  78. sm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&8&l" + player));
  79. sm.setLore(Arrays.asList(new String[] { ChatColor.translateAlternateColorCodes('&', "&7Grade : &eJoueur") }));
  80. sm.setOwner(player);
  81. tete.setItemMeta(sm);
  82.  
  83. glassBm.setDisplayName(" ");
  84. glassB.setItemMeta(glassBm);
  85.  
  86. glassGm.setDisplayName(" ");
  87. glassG.setItemMeta(glassGm);
  88.  
  89. tphubm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&7&lRetour au Hub"));
  90. tphub.setItemMeta(tphubm);
  91.  
  92. tpjumpm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&b&lJump"));
  93. tpjump.setItemMeta(tpjumpm);
  94.  
  95. tpvipm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&e&lZone VIP"));
  96. tpvip.setItemMeta(tpvipm);
  97.  
  98. prefm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&7&lParam�tres"));
  99. pref.setItemMeta(prefm);
  100.  
  101. shopm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&6&lBoutique"));
  102. shopm.setLore(Arrays.asList(new String[] { ChatColor.translateAlternateColorCodes('&', "&7(&cstore.glady-network.eu&7)") }));
  103. shop.setItemMeta(shopm);
  104.  
  105. uhcm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&6&lUHC Sc�naris�s"));
  106. uhcm.setLore(Arrays.asList(new String[] { ChatColor.translateAlternateColorCodes('&', "&7(&eParties disponibles qu'en cas d'Host&7)") }));
  107. uhc.setItemMeta(uhcm);
  108.  
  109. divergencem.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&e&lDivergence"));
  110. divergence.setItemMeta(divergencem);
  111.  
  112. flagm.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&c&lFlag"));
  113. flag.setItemMeta(flagm);
  114.  
  115. this.inv.setItem(0, glassB);
  116. this.inv.setItem(1, glassB);
  117. this.inv.setItem(2, glassB);
  118. this.inv.setItem(3, glassB);
  119. this.inv.setItem(4, tphub);
  120. this.inv.setItem(5, glassB);
  121. this.inv.setItem(6, glassB);
  122. this.inv.setItem(7, glassB);
  123. this.inv.setItem(8, glassB);
  124. this.inv.setItem(9, glassB);
  125. this.inv.setItem(10, practice);
  126. this.inv.setItem(11, glassG);
  127. this.inv.setItem(12, faction);
  128. this.inv.setItem(13, glassG);
  129. this.inv.setItem(14, flag);
  130. this.inv.setItem(15, glassG);
  131. this.inv.setItem(16, divergence);
  132. this.inv.setItem(17, glassB);
  133. this.inv.setItem(18, glassB);
  134. this.inv.setItem(19, box);
  135. this.inv.setItem(20, glassG);
  136. this.inv.setItem(21, rush);
  137. this.inv.setItem(22, glassG);
  138. this.inv.setItem(23, games);
  139. this.inv.setItem(24, glassG);
  140. this.inv.setItem(25, uhc);
  141. this.inv.setItem(26, glassB);
  142. this.inv.setItem(27, glassB);
  143. this.inv.setItem(28, glassB);
  144. this.inv.setItem(29, glassB);
  145. this.inv.setItem(30, glassB);
  146. this.inv.setItem(31, glassB);
  147. this.inv.setItem(32, glassB);
  148. this.inv.setItem(33, glassB);
  149. this.inv.setItem(34, glassB);
  150. this.inv.setItem(35, glassB);
  151. this.inv.setItem(36, glassB);
  152. this.inv.setItem(37, tpjump);
  153. this.inv.setItem(40, pref);
  154. this.inv.setItem(43, tpvip);
  155. this.inv.setItem(44, glassB);
  156. this.inv.setItem(45, tete);
  157. this.inv.setItem(46, glassB);
  158. this.inv.setItem(47, glassB);
  159. this.inv.setItem(48, glassB);
  160. this.inv.setItem(49, glassB);
  161. this.inv.setItem(50, glassB);
  162. this.inv.setItem(51, glassB);
  163. this.inv.setItem(52, glassB);
  164. this.inv.setItem(53, shop);
  165.  
  166. p.openInventory(this.inv);
  167. }
  168.  
  169. @EventHandler
  170. public void onPlayerInteract(PlayerInteractEvent e)
  171. {
  172. Player p = e.getPlayer();
  173. if ((p.getItemInHand().getType().equals(Material.COMPASS)) && (
  174. (e.getAction().equals(Action.RIGHT_CLICK_AIR)) || (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) || (e.getAction().equals(Action.LEFT_CLICK_AIR)) || (e.getAction().equals(Action.LEFT_CLICK_BLOCK)))) {
  175. Menu(p);
  176. }
  177. }
  178. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement