Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 29.30 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.         int balance = sql.getBalance(p);
  558.         if(balance == 0);
  559.         p.sendMessage(ChatColor.RED + "You don't have coins!");
  560.     }
  561.  
  562.     @EventHandler
  563.     public void onInventoryClick5(InventoryClickEvent e) {
  564.         if (!(ChatColor.stripColor(e.getInventory().getName())
  565.                 .equalsIgnoreCase("Kits")))
  566.             return;
  567.         Player p = (Player) e.getWhoClicked();
  568.         e.setCancelled(true);
  569.  
  570.         if (e.getCurrentItem() == null ||
  571.                 e.getCurrentItem().getType() == Material.AIR ||
  572.                 !e.getCurrentItem().hasItemMeta()) {
  573.             e.setCancelled(true);
  574.             return;
  575.         }
  576.  
  577.         if(e.getCurrentItem() == null
  578.                 || e.getCurrentItem().getType() == Material.ARROW
  579.                 || !e.getCurrentItem().hasItemMeta()) {
  580.             openGUI3(p);
  581.         }
  582.     }
  583.  
  584.     @EventHandler
  585.     public void onInventoryClick6(InventoryClickEvent e) {
  586.         if (!(ChatColor.stripColor(e.getInventory().getName())
  587.                 .equalsIgnoreCase("Odds and Ends")))
  588.             return;
  589.         Player p = (Player) e.getWhoClicked();
  590.         e.setCancelled(true);
  591.  
  592.         if (e.getCurrentItem() == null ||
  593.                 e.getCurrentItem().getType() == Material.AIR ||
  594.                 !e.getCurrentItem().hasItemMeta()) {
  595.             e.setCancelled(true);
  596.             return;
  597.         }
  598.  
  599.         if(e.getCurrentItem() == null
  600.                 || e.getCurrentItem().getType() == Material.ARROW
  601.                 || !e.getCurrentItem().hasItemMeta()) {
  602.             openGUI3(p);
  603.         }
  604.     }
  605.  
  606.     @EventHandler
  607.     public void onInventoryClick7(InventoryClickEvent e) {
  608.         if (!(ChatColor.stripColor(e.getInventory().getName())
  609.                 .equalsIgnoreCase("Barrels")))
  610.             return;
  611.         Player p = (Player) e.getWhoClicked();
  612.         e.setCancelled(true);
  613.  
  614.         if (e.getCurrentItem() == null ||
  615.                 e.getCurrentItem().getType() == Material.AIR ||
  616.                 !e.getCurrentItem().hasItemMeta()) {
  617.             e.setCancelled(true);
  618.             return;
  619.         }
  620.  
  621.         if(e.getCurrentItem() == null
  622.                 || e.getCurrentItem().getType() == Material.ARROW
  623.                 || !e.getCurrentItem().hasItemMeta()) {
  624.             openGUI3(p);
  625.         }
  626.     }
  627.  
  628.     @EventHandler
  629.     public void onInventoryClick8(InventoryClickEvent e) {
  630.         if (!(ChatColor.stripColor(e.getInventory().getName())
  631.                 .equalsIgnoreCase("Cases")))
  632.             return;
  633.         Player p = (Player) e.getWhoClicked();
  634.         e.setCancelled(true);
  635.  
  636.         if (e.getCurrentItem() == null ||
  637.                 e.getCurrentItem().getType() == Material.AIR ||
  638.                 !e.getCurrentItem().hasItemMeta()) {
  639.             e.setCancelled(true);
  640.             return;
  641.         }
  642.  
  643.         if(e.getCurrentItem() == null
  644.                 || e.getCurrentItem().getType() == Material.ARROW
  645.                 || !e.getCurrentItem().hasItemMeta()) {
  646.             openGUI3(p);
  647.         }
  648.     }
  649.  
  650.     @EventHandler
  651.     public void onInventoryClick9(InventoryClickEvent e) {
  652.         if (!(ChatColor.stripColor(e.getInventory().getName())
  653.                 .equalsIgnoreCase("Lasers")))
  654.             return;
  655.         Player p = (Player) e.getWhoClicked();
  656.         e.setCancelled(true);
  657.  
  658.         if (e.getCurrentItem() == null ||
  659.                 e.getCurrentItem().getType() == Material.AIR ||
  660.                 !e.getCurrentItem().hasItemMeta()) {
  661.             e.setCancelled(true);
  662.             return;
  663.         }
  664.  
  665.         if(e.getCurrentItem() == null
  666.                 || e.getCurrentItem().getType() == Material.ARROW
  667.                 || !e.getCurrentItem().hasItemMeta()) {
  668.             openGUI3(p);
  669.         }
  670.     }
  671.  
  672.     @EventHandler
  673.     public void onInventoryClick10(InventoryClickEvent e) {
  674.         if (!(ChatColor.stripColor(e.getInventory().getName())
  675.                 .equalsIgnoreCase("Muzzles")))
  676.             return;
  677.         Player p = (Player) e.getWhoClicked();
  678.         e.setCancelled(true);
  679.  
  680.         if (e.getCurrentItem() == null ||
  681.                 e.getCurrentItem().getType() == Material.AIR ||
  682.                 !e.getCurrentItem().hasItemMeta()) {
  683.             e.setCancelled(true);
  684.             return;
  685.         }
  686.  
  687.         if(e.getCurrentItem() == null
  688.                 || e.getCurrentItem().getType() == Material.ARROW
  689.                 || !e.getCurrentItem().hasItemMeta()) {
  690.             openGUI3(p);
  691.         }
  692.     }
  693.  
  694.     @EventHandler
  695.     public void onInventoryClick11(InventoryClickEvent e) {
  696.         if (!(ChatColor.stripColor(e.getInventory().getName())
  697.                 .equalsIgnoreCase("Triggers")))
  698.             return;
  699.         Player p = (Player) e.getWhoClicked();
  700.         e.setCancelled(true);
  701.  
  702.         if (e.getCurrentItem() == null ||
  703.                 e.getCurrentItem().getType() == Material.AIR ||
  704.                 !e.getCurrentItem().hasItemMeta()) {
  705.             e.setCancelled(true);
  706.             return;
  707.         }
  708.  
  709.         if(e.getCurrentItem() == null
  710.                 || e.getCurrentItem().getType() == Material.ARROW
  711.                 || !e.getCurrentItem().hasItemMeta()) {
  712.             openGUI3(p);
  713.         }
  714.     }
  715. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement