Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.41 KB | None | 0 0
  1. package fr.quakecraftmoney.main;
  2.  
  3. import java.util.Arrays;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.DyeColor;
  8. import org.bukkit.Material;
  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.entity.PlayerDeathEvent;
  14. import org.bukkit.event.inventory.InventoryClickEvent;
  15. import org.bukkit.event.player.PlayerInteractEvent;
  16. import org.bukkit.event.player.PlayerJoinEvent;
  17. import org.bukkit.inventory.Inventory;
  18. import org.bukkit.inventory.ItemStack;
  19. import org.bukkit.inventory.meta.ItemMeta;
  20. import org.bukkit.plugin.java.JavaPlugin;
  21. import org.bukkit.scoreboard.DisplaySlot;
  22. import org.bukkit.scoreboard.Objective;
  23. import org.bukkit.scoreboard.Score;
  24. import org.bukkit.scoreboard.ScoreboardManager;
  25.  
  26. public class Coins extends JavaPlugin implements Listener {
  27.  
  28. int spaceman = 1800;
  29.  
  30. public SQLConnection sql;
  31.  
  32. public void onEnable(){
  33. sql = new SQLConnection("jdbc:mysql://","localhost","minecraft","root","narut5");
  34. sql.connection();
  35. getCommand("money").setExecutor(new CmdCoins(sql));
  36.  
  37. getConfig().options().copyDefaults(true);
  38. saveConfig();
  39. Bukkit.getServer().getPluginManager().registerEvents(this, this);
  40. }
  41.  
  42. public void onDisable(){
  43. sql.disconnect();
  44. }
  45.  
  46. @EventHandler
  47. public void join(PlayerJoinEvent e) {
  48. Player p = e.getPlayer();
  49. sql.createAccount(p);
  50. }
  51.  
  52. //------------------------------------------------------------------------------------------------------
  53. // Scoreboard
  54. //------------------------------------------------------------------------------------------------------
  55. @EventHandler
  56. public void scoreboardJoin(PlayerJoinEvent e) {
  57. Player p = e.getPlayer();
  58. int balance = sql.getBalance(p);
  59. int kill = sql.getKills(p);
  60. int win = sql.getWins(p);
  61.  
  62. ScoreboardManager sb = Bukkit.getScoreboardManager();
  63. org.bukkit.scoreboard.Scoreboard board = sb.getNewScoreboard();
  64.  
  65. Objective obj = board.registerNewObjective("Stats", "dummy");
  66. obj.setDisplaySlot(DisplaySlot.SIDEBAR);
  67. obj.setDisplayName("Stats");
  68.  
  69. Score coins = obj.getScore("Coins:");
  70. coins.setScore(balance);
  71.  
  72. Score kills = obj.getScore("Kills:");
  73. kills.setScore(kill);
  74.  
  75. Score wins = obj.getScore("Wins:");
  76. wins.setScore(win);
  77.  
  78. p.setScoreboard(board);
  79. }
  80.  
  81. //------------------------------------------------------------------------------------------------------
  82. // Coin Gain
  83. //------------------------------------------------------------------------------------------------------
  84.  
  85. @SuppressWarnings("deprecation")
  86. @EventHandler
  87. public void onQuakeDeath(PlayerDeathEvent e) {
  88. Player p = e.getEntity().getPlayer().getKiller();
  89. sql.addKills(p, 1);
  90. sql.addMoney(p, 1);
  91.  
  92. getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
  93. public void run() {
  94.  
  95. p.sendMessage(ChatColor.GOLD + "+1 coins!");
  96. }
  97. }, 1L);
  98. }
  99.  
  100. //------------------------------------------------------------------------------------------------------
  101. // Main Shop Page
  102. //------------------------------------------------------------------------------------------------------
  103. public void openGUI3(Player player) {
  104. Inventory invShop = Bukkit.createInventory(null, 54, "Quake Shop");
  105.  
  106. ItemStack quakeHA = new ItemStack(Material.REDSTONE, 1);
  107. ItemMeta quakeHAMeta = quakeHA.getItemMeta();
  108. quakeHAMeta.setDisplayName(ChatColor.RED + "Disable");
  109. quakeHAMeta.setLore(Arrays.asList(ChatColor.GRAY + "Instant Respawn"));
  110. quakeHA.setItemMeta(quakeHAMeta);
  111. invShop.setItem(48, quakeHA);
  112.  
  113. ItemStack quakeHB = new ItemStack(Material.EMERALD, 1);
  114. ItemMeta quakeHBMeta = quakeHB.getItemMeta();
  115. int balance = sql.getBalance(player);
  116. quakeHBMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  117. quakeHBMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  118. quakeHB.setItemMeta(quakeHBMeta);
  119. invShop.setItem(49, quakeHB);
  120.  
  121. ItemStack quakeHC = new ItemStack(Material.WOOD_HOE, 1);
  122. ItemMeta quakeHCMeta = quakeHC.getItemMeta();
  123. quakeHCMeta.setDisplayName(ChatColor.GREEN + "Current Railgun");
  124. quakeHCMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Name: " + ChatColor.GREEN + "Basic Railgun", ChatColor.GRAY + "Case: " + ChatColor.GREEN + "Wooden Case", ChatColor.GRAY + "Sight: " + ChatColor.GREEN + "Yellow Laser", ChatColor.GRAY + "Barrel: " + ChatColor.GREEN + "Small Barrel", ChatColor.GRAY + "Muzzle: " + ChatColor.GREEN + "No Muzzle", ChatColor.GRAY + "Reload Time: " + ChatColor.GREEN + "1.5s"));
  125. quakeHC.setItemMeta(quakeHCMeta);
  126. invShop.setItem(50, quakeHC);
  127.  
  128.  
  129. ItemStack quakeH2 = new ItemStack(Material.LEATHER_HELMET, 1);
  130. ItemMeta quakeH2Meta = quakeH2.getItemMeta();
  131. quakeH2Meta.setDisplayName(ChatColor.GREEN + "Hats");
  132. quakeH2.setItemMeta(quakeH2Meta);
  133. invShop.setItem(10, quakeH2);
  134.  
  135. ItemStack quakeH3 = new ItemStack(Material.IRON_HOE, 1);
  136. ItemMeta quakeH3Meta = quakeH3.getItemMeta();
  137. quakeH3Meta.setDisplayName(ChatColor.GREEN + "Cases");
  138. quakeH3.setItemMeta(quakeH3Meta);
  139. invShop.setItem(19, quakeH3);
  140.  
  141. ItemStack quakeH4 = new ItemStack(Material.IRON_CHESTPLATE, 1);
  142. ItemMeta quakeH4Meta = quakeH4.getItemMeta();
  143. quakeH4Meta.setDisplayName(ChatColor.GREEN + "Kits");
  144. quakeH4.setItemMeta(quakeH4Meta);
  145. invShop.setItem(12, quakeH4);
  146.  
  147. @SuppressWarnings("deprecation")
  148. ItemStack quakeH5 = new ItemStack(Material.INK_SACK, 1, (short)0, DyeColor.ORANGE.getData());
  149. ItemMeta quakeH5Meta = quakeH5.getItemMeta();
  150. quakeH5Meta.setDisplayName(ChatColor.GREEN + "Lasers");
  151. quakeH5.setItemMeta(quakeH5Meta);
  152. invShop.setItem(21, quakeH5);
  153.  
  154. ItemStack quakeH7 = new ItemStack(Material.PAPER, 1);
  155. ItemMeta quakeH7Meta = quakeH7.getItemMeta();
  156. quakeH7Meta.setDisplayName(ChatColor.GREEN + "Odds and Ends");
  157. quakeH7.setItemMeta(quakeH7Meta);
  158. invShop.setItem(14, quakeH7);
  159.  
  160. ItemStack quakeH8 = new ItemStack(Material.WOOD, 1);
  161. ItemMeta quakeH8Meta = quakeH8.getItemMeta();
  162. quakeH8Meta.setDisplayName(ChatColor.GREEN + "Muzzles");
  163. quakeH8.setItemMeta(quakeH8Meta);
  164. invShop.setItem(23, quakeH8);
  165.  
  166. ItemStack quakeH9 = new ItemStack(Material.FIREBALL, 1);
  167. ItemMeta quakeH9Meta = quakeH9.getItemMeta();
  168. quakeH9Meta.setDisplayName(ChatColor.GREEN + "Barrels");
  169. quakeH9.setItemMeta(quakeH9Meta);
  170. invShop.setItem(16, quakeH9);
  171.  
  172. ItemStack quakeH10 = new ItemStack(Material.STONE_BUTTON, 1);
  173. ItemMeta quakeH10Meta = quakeH10.getItemMeta();
  174. quakeH10Meta.setDisplayName(ChatColor.GREEN + "Triggers");
  175. quakeH10.setItemMeta(quakeH10Meta);
  176. invShop.setItem(25, quakeH10);
  177.  
  178. player.openInventory(invShop);
  179. }
  180.  
  181. @EventHandler
  182. public void onPlayerInteract3(PlayerInteractEvent event) {
  183. Action a = event.getAction();
  184. ItemStack is = event.getItem();
  185. if (a == Action.PHYSICAL || is == null || is.getType() == Material.AIR)
  186. return;
  187.  
  188. if (is.getType() == Material.EMERALD)
  189. openGUI3(event.getPlayer());
  190. }
  191.  
  192. //------------------------------------------------------------------------------------------------------
  193. // Catégories du shop
  194. //------------------------------------------------------------------------------------------------------
  195. @SuppressWarnings("deprecation")
  196. @EventHandler
  197. public void onInventoryClick(InventoryClickEvent e) {
  198. if (!(ChatColor.stripColor(e.getInventory().getName())
  199. .equalsIgnoreCase("Quake Shop")))
  200. return;
  201. Player p = (Player) e.getWhoClicked();
  202. e.setCancelled(true);
  203.  
  204. if (e.getCurrentItem() == null ||
  205. e.getCurrentItem().getType() == Material.AIR ||
  206. !e.getCurrentItem().hasItemMeta()) {
  207. e.setCancelled(true);
  208. return;
  209. }
  210.  
  211. if(e.getCurrentItem() == null
  212. || e.getCurrentItem().getType() == Material.LEATHER_HELMET
  213. || !e.getCurrentItem().hasItemMeta()) {
  214. Inventory shopHats = Bukkit.createInventory(null, 54, "Hats");
  215.  
  216. ItemStack coins = new ItemStack(Material.EMERALD, 1);
  217. ItemMeta coinsMeta = coins.getItemMeta();
  218. int balance = sql.getBalance(p);
  219. coinsMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  220. coinsMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  221. coins.setItemMeta(coinsMeta);
  222. shopHats.setItem(48, coins);
  223.  
  224. ItemStack reset = new ItemStack(Material.GLASS, 1);
  225. ItemMeta resetMeta = reset.getItemMeta();
  226. resetMeta.setDisplayName(ChatColor.RED + "Reset Hat");
  227. reset.setItemMeta(resetMeta);
  228. shopHats.setItem(49, reset);
  229.  
  230. ItemStack back = new ItemStack(Material.ARROW, 1);
  231. ItemMeta backMeta= back.getItemMeta();
  232. backMeta.setDisplayName(ChatColor.GREEN + "Go Back");
  233. back.setItemMeta(backMeta);
  234. shopHats.setItem(50, back);
  235.  
  236. ItemStack h1 = new ItemStack(Material.GLASS, 1);
  237. ItemMeta h1Meta = h1.getItemMeta();
  238. h1Meta.setDisplayName(ChatColor.GREEN + "Spaceman Hat");
  239. h1Meta.setLore(Arrays.asList(ChatColor.GRAY + "Collect all the hats!", ChatColor.GRAY + " ", ChatColor.GRAY + "Cost: " + ChatColor.GOLD + spaceman));
  240. h1.setItemMeta(h1Meta);
  241. shopHats.setItem(10, h1);
  242.  
  243. p.openInventory(shopHats);
  244. return;
  245. }
  246.  
  247. if(e.getCurrentItem() == null
  248. || e.getCurrentItem().getType() == Material.IRON_CHESTPLATE
  249. || !e.getCurrentItem().hasItemMeta()) {
  250. Inventory shopKits = Bukkit.createInventory(null, 54, "Kits");
  251.  
  252. ItemStack coins = new ItemStack(Material.EMERALD, 1);
  253. ItemMeta coinsMeta = coins.getItemMeta();
  254. int balance = sql.getBalance(p);
  255. coinsMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  256. coinsMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  257. coins.setItemMeta(coinsMeta);
  258. shopKits.setItem(48, coins);
  259.  
  260. ItemStack reset = new ItemStack(Material.GLASS, 1);
  261. ItemMeta resetMeta = reset.getItemMeta();
  262. resetMeta.setDisplayName(ChatColor.RED + "Reset Hat");
  263. reset.setItemMeta(resetMeta);
  264. shopKits.setItem(49, reset);
  265.  
  266. ItemStack back = new ItemStack(Material.ARROW, 1);
  267. ItemMeta backMeta= back.getItemMeta();
  268. backMeta.setDisplayName(ChatColor.GREEN + "Go Back");
  269. back.setItemMeta(backMeta);
  270. shopKits.setItem(50, back);
  271.  
  272. ItemStack k1 = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
  273. ItemMeta k1Meta = k1.getItemMeta();
  274. k1Meta.setDisplayName(ChatColor.GREEN + "Soldier Kit");
  275. k1Meta.setLore(Arrays.asList(ChatColor.GRAY + "Cosmetic armor.", ChatColor.GRAY + " ", ChatColor.GRAY + "Click to equip!"));
  276. k1.setItemMeta(k1Meta);
  277. shopKits.setItem(10, k1);
  278.  
  279. p.openInventory(shopKits);
  280. }
  281.  
  282. if(e.getCurrentItem() == null
  283. || e.getCurrentItem().getType() == Material.WOOD
  284. || !e.getCurrentItem().hasItemMeta()) {
  285. Inventory shopMuzzles = Bukkit.createInventory(null, 54, "Muzzles");
  286.  
  287. ItemStack coins = new ItemStack(Material.EMERALD, 1);
  288. ItemMeta coinsMeta = coins.getItemMeta();
  289. int balance = sql.getBalance(p);
  290. coinsMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  291. coinsMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  292. coins.setItemMeta(coinsMeta);
  293. shopMuzzles.setItem(48, coins);
  294.  
  295. ItemStack reset = new ItemStack(Material.GLASS, 1);
  296. ItemMeta resetMeta = reset.getItemMeta();
  297. resetMeta.setDisplayName(ChatColor.RED + "Reset Hat");
  298. reset.setItemMeta(resetMeta);
  299. shopMuzzles.setItem(49, reset);
  300.  
  301. ItemStack back = new ItemStack(Material.ARROW, 1);
  302. ItemMeta backMeta= back.getItemMeta();
  303. backMeta.setDisplayName(ChatColor.GREEN + "Go Back");
  304. back.setItemMeta(backMeta);
  305. shopMuzzles.setItem(50, back);
  306.  
  307. ItemStack m1 = new ItemStack(Material.GLASS, 1);
  308. ItemMeta m1Meta = m1.getItemMeta();
  309. m1Meta.setDisplayName(ChatColor.GREEN + "No Muzzle");
  310. m1Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a particle effect!", ChatColor.WHITE + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Basic Railgun", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Superior Railgun", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Hyper Beam Railgun", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Creeper Railgun", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "BFG", ChatColor.WHITE + " ", ChatColor.GREEN + "Equipped!"));
  311. m1.setItemMeta(m1Meta);
  312. shopMuzzles.setItem(10, m1);
  313.  
  314. p.openInventory(shopMuzzles);
  315. }
  316.  
  317.  
  318. if(e.getCurrentItem() == null
  319. || e.getCurrentItem().getType() == Material.PAPER
  320. || !e.getCurrentItem().hasItemMeta()) {
  321. Inventory shopOther = Bukkit.createInventory(null, 54, "Odds and Ends");
  322.  
  323. ItemStack coins = new ItemStack(Material.EMERALD, 1);
  324. ItemMeta coinsMeta = coins.getItemMeta();
  325. int balance = sql.getBalance(p);
  326. coinsMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  327. coinsMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  328. coins.setItemMeta(coinsMeta);
  329. shopOther.setItem(48, coins);
  330.  
  331. ItemStack reset = new ItemStack(Material.GLASS, 1);
  332. ItemMeta resetMeta = reset.getItemMeta();
  333. resetMeta.setDisplayName(ChatColor.RED + "Reset Hat");
  334. reset.setItemMeta(resetMeta);
  335. shopOther.setItem(49, reset);
  336.  
  337. ItemStack back = new ItemStack(Material.ARROW, 1);
  338. ItemMeta backMeta= back.getItemMeta();
  339. backMeta.setDisplayName(ChatColor.GREEN + "Go Back");
  340. back.setItemMeta(backMeta);
  341. shopOther.setItem(50, back);
  342.  
  343. ItemStack o1 = new ItemStack(Material.COMPASS, 1);
  344. ItemMeta o1Meta = o1.getItemMeta();
  345. o1Meta.setDisplayName(ChatColor.GREEN + "Tracking Device");
  346. o1Meta.setLore(Arrays.asList(ChatColor.GRAY + "Aims toward the closest player!"));
  347. o1.setItemMeta(o1Meta);
  348. shopOther.setItem(10, o1);
  349.  
  350. p.openInventory(shopOther);
  351. }
  352.  
  353. if(e.getCurrentItem() == null
  354. || e.getCurrentItem().getType() == Material.FIREBALL
  355. || !e.getCurrentItem().hasItemMeta()) {
  356. Inventory shopBarrel = Bukkit.createInventory(null, 54, "Barrels");
  357.  
  358. ItemStack coins = new ItemStack(Material.EMERALD, 1);
  359. ItemMeta coinsMeta = coins.getItemMeta();
  360. int balance = sql.getBalance(p);
  361. coinsMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  362. coinsMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  363. coins.setItemMeta(coinsMeta);
  364. shopBarrel.setItem(48, coins);
  365.  
  366. ItemStack reset = new ItemStack(Material.GLASS, 1);
  367. ItemMeta resetMeta = reset.getItemMeta();
  368. resetMeta.setDisplayName(ChatColor.RED + "Reset Hat");
  369. reset.setItemMeta(resetMeta);
  370. shopBarrel.setItem(49, reset);
  371.  
  372. ItemStack back = new ItemStack(Material.ARROW, 1);
  373. ItemMeta backMeta= back.getItemMeta();
  374. backMeta.setDisplayName(ChatColor.GREEN + "Go Back");
  375. back.setItemMeta(backMeta);
  376. shopBarrel.setItem(50, back);
  377.  
  378. ItemStack b1 = new ItemStack(Material.FIREWORK, 1);
  379. ItemMeta b1Meta = b1.getItemMeta();
  380. b1Meta.setDisplayName(ChatColor.GREEN + "Small Barrel");
  381. b1Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a firework shape!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Basic Railgun", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Budder Slapper", ChatColor.GRAY + " ", ChatColor.GREEN + "Equipped!"));
  382. b1.setItemMeta(b1Meta);
  383. shopBarrel.setItem(10, b1);
  384.  
  385. p.openInventory(shopBarrel);
  386. }
  387.  
  388.  
  389. if(e.getCurrentItem() == null
  390. || e.getCurrentItem().getType() == Material.IRON_HOE
  391. || !e.getCurrentItem().hasItemMeta()) {
  392. Inventory shopCase = Bukkit.createInventory(null, 54, "Cases");
  393.  
  394. ItemStack coins = new ItemStack(Material.EMERALD, 1);
  395. ItemMeta coinsMeta = coins.getItemMeta();
  396. int balance = sql.getBalance(p);
  397. coinsMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  398. coinsMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  399. coins.setItemMeta(coinsMeta);
  400. shopCase.setItem(48, coins);
  401.  
  402. ItemStack reset = new ItemStack(Material.GLASS, 1);
  403. ItemMeta resetMeta = reset.getItemMeta();
  404. resetMeta.setDisplayName(ChatColor.RED + "Reset Hat");
  405. reset.setItemMeta(resetMeta);
  406. shopCase.setItem(49, reset);
  407.  
  408. ItemStack back = new ItemStack(Material.ARROW, 1);
  409. ItemMeta backMeta= back.getItemMeta();
  410. backMeta.setDisplayName(ChatColor.GREEN + "Go Back");
  411. back.setItemMeta(backMeta);
  412. shopCase.setItem(50, back);
  413.  
  414. ItemStack h1 = new ItemStack(Material.WOOD_HOE, 1);
  415. ItemMeta h1Meta = h1.getItemMeta();
  416. h1Meta.setDisplayName(ChatColor.GREEN + "Wooden Case");
  417. h1Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose an appearance!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Basic Railgun", ChatColor.GRAY + " ", ChatColor.GREEN + "Equipped!"));
  418. h1.setItemMeta(h1Meta);
  419. shopCase.setItem(10, h1);
  420.  
  421. p.openInventory(shopCase);
  422. }
  423.  
  424. if(e.getCurrentItem() == null
  425. || e.getCurrentItem().getType() == Material.INK_SACK
  426. || !e.getCurrentItem().hasItemMeta()) {
  427. Inventory shopLaser = Bukkit.createInventory(null, 54, "Lasers");
  428.  
  429. ItemStack coins = new ItemStack(Material.EMERALD, 1);
  430. ItemMeta coinsMeta = coins.getItemMeta();
  431. int balance = sql.getBalance(p);
  432. coinsMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  433. coinsMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  434. coins.setItemMeta(coinsMeta);
  435. shopLaser.setItem(48, coins);
  436.  
  437. ItemStack reset = new ItemStack(Material.GLASS, 1);
  438. ItemMeta resetMeta = reset.getItemMeta();
  439. resetMeta.setDisplayName(ChatColor.RED + "Reset Hat");
  440. reset.setItemMeta(resetMeta);
  441. shopLaser.setItem(49, reset);
  442.  
  443. ItemStack back = new ItemStack(Material.ARROW, 1);
  444. ItemMeta backMeta= back.getItemMeta();
  445. backMeta.setDisplayName(ChatColor.GREEN + "Go Back");
  446. back.setItemMeta(backMeta);
  447. shopLaser.setItem(50, back);
  448.  
  449.  
  450. ItemStack l1 = new ItemStack(Material.INK_SACK, 1, (short)0, DyeColor.ORANGE.getData());
  451. ItemMeta l1Meta = l1.getItemMeta();
  452. l1Meta.setDisplayName(ChatColor.GREEN + "Small Laser");
  453. l1Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a firework color!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Basic Railgun", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Hyper Beam Railgun", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Budder Slapper", ChatColor.GRAY + " ", ChatColor.GREEN + "Equipped!"));
  454. l1.setItemMeta(l1Meta);
  455. shopLaser.setItem(10, l1);
  456.  
  457. p.openInventory(shopLaser);
  458. }
  459.  
  460. if(e.getCurrentItem() == null
  461. || e.getCurrentItem().getType() == Material.STONE_BUTTON
  462. || !e.getCurrentItem().hasItemMeta()) {
  463. Inventory shopTriggers = Bukkit.createInventory(null, 54, "Triggers");
  464.  
  465. ItemStack coins = new ItemStack(Material.EMERALD, 1);
  466. ItemMeta coinsMeta = coins.getItemMeta();
  467. int balance = sql.getBalance(p);
  468. coinsMeta.setDisplayName(ChatColor.GRAY + "Total Coins: " + ChatColor.GOLD + balance);
  469. coinsMeta.setLore(Arrays.asList(ChatColor.WHITE + " ", ChatColor.GRAY + "Kill: 1 coin", ChatColor.GRAY + "Win: 10 coins", ChatColor.WHITE + " ", ChatColor.GOLD + "http://mc.hypixel.net"));
  470. coins.setItemMeta(coinsMeta);
  471. shopTriggers.setItem(48, coins);
  472.  
  473. ItemStack reset = new ItemStack(Material.GLASS, 1);
  474. ItemMeta resetMeta = reset.getItemMeta();
  475. resetMeta.setDisplayName(ChatColor.RED + "Reset Hat");
  476. reset.setItemMeta(resetMeta);
  477. shopTriggers.setItem(49, reset);
  478.  
  479. ItemStack back = new ItemStack(Material.ARROW, 1);
  480. ItemMeta backMeta= back.getItemMeta();
  481. backMeta.setDisplayName(ChatColor.GREEN + "Go Back");
  482. back.setItemMeta(backMeta);
  483. shopTriggers.setItem(50, back);
  484.  
  485. ItemStack t1 = new ItemStack(Material.STONE_BUTTON, 15);
  486. ItemMeta t1Meta = t1.getItemMeta();
  487. t1Meta.setDisplayName(ChatColor.GREEN + "1.5s");
  488. t1Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a firing speed!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Basic Railgun", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Budder Slapper", ChatColor.GRAY + " ", ChatColor.GREEN + "Equipped!"));
  489. t1.setItemMeta(t1Meta);
  490. shopTriggers.setItem(10, t1);
  491.  
  492. ItemStack t2 = new ItemStack(Material.STONE_BUTTON, 14);
  493. ItemMeta t2Meta = t2.getItemMeta();
  494. t2Meta.setDisplayName(ChatColor.GREEN + "1.4s");
  495. t2Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a firing speed!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Superior Railgun", ChatColor.GRAY + " ", ChatColor.GRAY + "Cost: " + ChatColor.GOLD + "1800"));
  496. t2.setItemMeta(t2Meta);
  497. shopTriggers.setItem(11, t2);
  498.  
  499. ItemStack t3 = new ItemStack(Material.STONE_BUTTON, 13);
  500. ItemMeta t3Meta = t3.getItemMeta();
  501. t3Meta.setDisplayName(ChatColor.GREEN + "1.3s");
  502. t3Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a firing speed!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Hyper Beam Railgun", ChatColor.GRAY + " ", ChatColor.GRAY + "Cost: " + ChatColor.GOLD + "3500"));
  503. t3.setItemMeta(t3Meta);
  504. shopTriggers.setItem(12, t3);
  505.  
  506. ItemStack t4 = new ItemStack(Material.STONE_BUTTON, 12);
  507. ItemMeta t4Meta = t4.getItemMeta();
  508. t4Meta.setDisplayName(ChatColor.GREEN + "1.2s");
  509. t4Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a firing speed!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Creeper Railgun", ChatColor.GRAY + " ", ChatColor.GRAY + "Cost: " + ChatColor.GOLD + "8500"));
  510. t4.setItemMeta(t4Meta);
  511. shopTriggers.setItem(13, t4);
  512.  
  513. ItemStack t5 = new ItemStack(Material.STONE_BUTTON, 11);
  514. ItemMeta t5Meta = t5.getItemMeta();
  515. t5Meta.setDisplayName(ChatColor.GREEN + "1.1s");
  516. t5Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a firing speed!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "BFG", ChatColor.GRAY + " ", ChatColor.GRAY + "Cost: " + ChatColor.GOLD + "17000"));
  517. t5.setItemMeta(t5Meta);
  518. shopTriggers.setItem(14, t5);
  519.  
  520. ItemStack t6 = new ItemStack(Material.STONE_BUTTON, 10);
  521. ItemMeta t6Meta = t6.getItemMeta();
  522. t6Meta.setDisplayName(ChatColor.GREEN + "1.0s");
  523. t6Meta.setLore(Arrays.asList(ChatColor.GRAY + "Choose a firing speed!", ChatColor.GRAY + " ", ChatColor.GRAY + ChatColor.ITALIC.toString() + "Used to make " + ChatColor.GREEN + ChatColor.ITALIC.toString() + "Bling Bling Thing", ChatColor.GRAY + " ", ChatColor.GRAY + "Cost: " + ChatColor.GOLD + "100000"));
  524. t6.setItemMeta(t6Meta);
  525. shopTriggers.setItem(15, t6);
  526.  
  527. p.openInventory(shopTriggers);
  528. }
  529. }
  530.  
  531. //------------------------------------------------------------------------------------------------------
  532. // Actions sur les objets
  533. //------------------------------------------------------------------------------------------------------
  534.  
  535. @EventHandler
  536. public void onInventoryClick4(InventoryClickEvent e) {
  537. if (!(ChatColor.stripColor(e.getInventory().getName())
  538. .equalsIgnoreCase("Hats")))
  539. return;
  540. Player p = (Player) e.getWhoClicked();
  541. e.setCancelled(true);
  542.  
  543. if (e.getCurrentItem() == null ||
  544. e.getCurrentItem().getType() == Material.AIR ||
  545. !e.getCurrentItem().hasItemMeta()) {
  546. e.setCancelled(true);
  547. return;
  548. }
  549.  
  550. if(e.getCurrentItem() == null
  551. || e.getCurrentItem().getType() == Material.ARROW
  552. || !e.getCurrentItem().hasItemMeta()) {
  553. openGUI3(p);
  554. }
  555.  
  556. if (e.getCurrentItem().getItemMeta().getDisplayName().contains(ChatColor.GREEN + "Lantern Hat"));
  557. if(sql.getBalance(p) == 0);
  558. p.sendMessage(ChatColor.RED + "You don't have coins!");
  559. }
  560.  
  561. @EventHandler
  562. public void onInventoryClick5(InventoryClickEvent e) {
  563. if (!(ChatColor.stripColor(e.getInventory().getName())
  564. .equalsIgnoreCase("Kits")))
  565. return;
  566. Player p = (Player) e.getWhoClicked();
  567. e.setCancelled(true);
  568.  
  569. if (e.getCurrentItem() == null ||
  570. e.getCurrentItem().getType() == Material.AIR ||
  571. !e.getCurrentItem().hasItemMeta()) {
  572. e.setCancelled(true);
  573. return;
  574. }
  575.  
  576. if(e.getCurrentItem() == null
  577. || e.getCurrentItem().getType() == Material.ARROW
  578. || !e.getCurrentItem().hasItemMeta()) {
  579. openGUI3(p);
  580. }
  581. }
  582.  
  583. @EventHandler
  584. public void onInventoryClick6(InventoryClickEvent e) {
  585. if (!(ChatColor.stripColor(e.getInventory().getName())
  586. .equalsIgnoreCase("Odds and Ends")))
  587. return;
  588. Player p = (Player) e.getWhoClicked();
  589. e.setCancelled(true);
  590.  
  591. if (e.getCurrentItem() == null ||
  592. e.getCurrentItem().getType() == Material.AIR ||
  593. !e.getCurrentItem().hasItemMeta()) {
  594. e.setCancelled(true);
  595. return;
  596. }
  597.  
  598. if(e.getCurrentItem() == null
  599. || e.getCurrentItem().getType() == Material.ARROW
  600. || !e.getCurrentItem().hasItemMeta()) {
  601. openGUI3(p);
  602. }
  603. }
  604.  
  605. @EventHandler
  606. public void onInventoryClick7(InventoryClickEvent e) {
  607. if (!(ChatColor.stripColor(e.getInventory().getName())
  608. .equalsIgnoreCase("Barrels")))
  609. return;
  610. Player p = (Player) e.getWhoClicked();
  611. e.setCancelled(true);
  612.  
  613. if (e.getCurrentItem() == null ||
  614. e.getCurrentItem().getType() == Material.AIR ||
  615. !e.getCurrentItem().hasItemMeta()) {
  616. e.setCancelled(true);
  617. return;
  618. }
  619.  
  620. if(e.getCurrentItem() == null
  621. || e.getCurrentItem().getType() == Material.ARROW
  622. || !e.getCurrentItem().hasItemMeta()) {
  623. openGUI3(p);
  624. }
  625. }
  626.  
  627. @EventHandler
  628. public void onInventoryClick8(InventoryClickEvent e) {
  629. if (!(ChatColor.stripColor(e.getInventory().getName())
  630. .equalsIgnoreCase("Cases")))
  631. return;
  632. Player p = (Player) e.getWhoClicked();
  633. e.setCancelled(true);
  634.  
  635. if (e.getCurrentItem() == null ||
  636. e.getCurrentItem().getType() == Material.AIR ||
  637. !e.getCurrentItem().hasItemMeta()) {
  638. e.setCancelled(true);
  639. return;
  640. }
  641.  
  642. if(e.getCurrentItem() == null
  643. || e.getCurrentItem().getType() == Material.ARROW
  644. || !e.getCurrentItem().hasItemMeta()) {
  645. openGUI3(p);
  646. }
  647. }
  648.  
  649. @EventHandler
  650. public void onInventoryClick9(InventoryClickEvent e) {
  651. if (!(ChatColor.stripColor(e.getInventory().getName())
  652. .equalsIgnoreCase("Lasers")))
  653. return;
  654. Player p = (Player) e.getWhoClicked();
  655. e.setCancelled(true);
  656.  
  657. if (e.getCurrentItem() == null ||
  658. e.getCurrentItem().getType() == Material.AIR ||
  659. !e.getCurrentItem().hasItemMeta()) {
  660. e.setCancelled(true);
  661. return;
  662. }
  663.  
  664. if(e.getCurrentItem() == null
  665. || e.getCurrentItem().getType() == Material.ARROW
  666. || !e.getCurrentItem().hasItemMeta()) {
  667. openGUI3(p);
  668. }
  669. }
  670.  
  671. @EventHandler
  672. public void onInventoryClick10(InventoryClickEvent e) {
  673. if (!(ChatColor.stripColor(e.getInventory().getName())
  674. .equalsIgnoreCase("Muzzles")))
  675. return;
  676. Player p = (Player) e.getWhoClicked();
  677. e.setCancelled(true);
  678.  
  679. if (e.getCurrentItem() == null ||
  680. e.getCurrentItem().getType() == Material.AIR ||
  681. !e.getCurrentItem().hasItemMeta()) {
  682. e.setCancelled(true);
  683. return;
  684. }
  685.  
  686. if(e.getCurrentItem() == null
  687. || e.getCurrentItem().getType() == Material.ARROW
  688. || !e.getCurrentItem().hasItemMeta()) {
  689. openGUI3(p);
  690. }
  691. }
  692.  
  693. @EventHandler
  694. public void onInventoryClick11(InventoryClickEvent e) {
  695. if (!(ChatColor.stripColor(e.getInventory().getName())
  696. .equalsIgnoreCase("Triggers")))
  697. return;
  698. Player p = (Player) e.getWhoClicked();
  699. e.setCancelled(true);
  700.  
  701. if (e.getCurrentItem() == null ||
  702. e.getCurrentItem().getType() == Material.AIR ||
  703. !e.getCurrentItem().hasItemMeta()) {
  704. e.setCancelled(true);
  705. return;
  706. }
  707.  
  708. if(e.getCurrentItem() == null
  709. || e.getCurrentItem().getType() == Material.ARROW
  710. || !e.getCurrentItem().hasItemMeta()) {
  711. openGUI3(p);
  712. }
  713. }
  714. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement