Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.austriaminer.InventoryClick;
- import java.util.ArrayList;
- import java.util.List;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import de.Schraubi.Coins.CoinAPI;
- import net.austriaminer.main;
- import net.austriaminer.MySQL.SQLAustriaminer;
- import net.austriaminer.MySQL.SQLDerMeinieLp;
- import net.austriaminer.MySQL.SQLKuchenLauch;
- import net.austriaminer.utils.items;
- import net.austriaminer.utils.items.Items;
- public class Köpfe implements Listener{
- @SuppressWarnings("unchecked")
- @EventHandler
- public void onClick(InventoryClickEvent e)
- {
- try
- {
- Player p = (Player)e.getWhoClicked();
- if (e.getClickedInventory().getName().equalsIgnoreCase("§aKöpfe")) {
- e.setCancelled(true);
- if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§4§oKuchenLauch"))
- {
- if (SQLKuchenLauch.getAktiv(p.getUniqueId().toString()).intValue() == 0)
- {
- if (CoinAPI.getCoins(p.getUniqueId().toString()) >= 1000)
- {
- SQLKuchenLauch.setAktiv(p.getUniqueId().toString(), Integer.valueOf(1));
- CoinAPI.removeCoins(p.getUniqueId().toString(), 1000);
- p.sendMessage(main.prefix + "§7Du hast §4§oKuchenLauch §7erfolgreich gekauft!");
- p.closeInventory();
- p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.0F, 1.0F);
- }
- else
- {
- p.sendMessage(main.prefix + "§cDu hast nicht genügend Coins!");
- p.playSound(p.getLocation(), Sound.BAT_DEATH, 1.0F, 1.0F);
- }
- }
- else if (SQLKuchenLauch.getAktiv(p.getUniqueId().toString()).intValue() == 1)
- {
- if (p.getInventory().getItem(8).getType() == Material.BARRIER)
- {
- @SuppressWarnings({ "rawtypes"})
- List<String> lore = new ArrayList();
- lore.add("§bBeschreibung:");
- lore.add("§7Team Lauch");
- p.getInventory().setItem(8, items.createHeadWithLore("KuchenLauch", "§4§oKuchenLauch", lore));
- p.getInventory().setHelmet(items.createHeadWithLore("KuchenLauch", "§4§oKuchenLauch", lore));
- p.sendMessage(main.prefix + "§7Du hast §aKuchenLauch §f§7aktiviert");
- p.closeInventory();
- return;
- }
- if (p.getInventory().getItem(8) != null) {
- if (p.getInventory().getItem(8).getItemMeta().getDisplayName().equalsIgnoreCase("§4§oKuchenLauch"))
- {
- p.getInventory().setBoots(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setHelmet(null);
- p.getInventory().setLeggings(null);
- p.getInventory().setItem(8, Items.createItem(Material.BARRIER, "§cKein Gadget ausgewählt", true, 1));
- p.sendMessage(main.prefix + "§cDu hast §4§oKuchenLauch §f§cdeaktiviert");
- p.closeInventory();
- }
- else
- {
- @SuppressWarnings({ "rawtypes"})
- List<String> lore = new ArrayList();
- lore.add("§bBeschreibung:");
- lore.add("§7Team Lauch");
- p.getInventory().setBoots(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setHelmet(items.createHeadWithLore("KuchenLauch", "§4§oKuchenLauch", lore));
- p.getInventory().setLeggings(null);
- p.getInventory().setItem(8, items.createHeadWithLore("KuchenLauch", "§4§oKuchenLauch", lore));
- p.sendMessage(main.prefix + "§7Du hast dein Gadget geändert");
- }
- }
- }
- }else if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§4§oDerMeinieLp"))
- {
- if (SQLDerMeinieLp.getAktiv(p.getUniqueId().toString()).intValue() == 0)
- {
- if (CoinAPI.getCoins(p.getUniqueId().toString()) >= 1000)
- {
- SQLDerMeinieLp.setAktiv(p.getUniqueId().toString(), Integer.valueOf(1));
- CoinAPI.removeCoins(p.getUniqueId().toString(), 1000);
- p.sendMessage(main.prefix + "§7Du hast §4§oDerMeinieLp §7erfolgreich gekauft!");
- p.closeInventory();
- p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.0F, 1.0F);
- }
- else
- {
- p.sendMessage(main.prefix + "§cDu hast nicht genügend Coins!");
- p.playSound(p.getLocation(), Sound.BAT_DEATH, 1.0F, 1.0F);
- }
- }
- else if (SQLDerMeinieLp.getAktiv(p.getUniqueId().toString()).intValue() == 1)
- {
- if (p.getInventory().getItem(8).getType() == Material.BARRIER)
- {
- @SuppressWarnings({ "rawtypes"})
- List<String> lore = new ArrayList();
- lore.add("§bBeschreibung:");
- lore.add("§7Team Owener");
- p.getInventory().setItem(8, items.createHeadWithLore("DerMeinieLp", "§4§oDerMeinieLp", lore ));
- p.getInventory().setHelmet(items.createHeadWithLore("DerMeinieLp", "§4§oDerMeinieLp", lore));
- p.sendMessage(main.prefix + "§7Du hast §4§oDerMeinieLp §f§7aktiviert");
- p.closeInventory();
- return;
- }
- if (p.getInventory().getItem(8) != null) {
- if (p.getInventory().getItem(8).getItemMeta().getDisplayName().equalsIgnoreCase("§4§oDerMeinieLp"))
- {
- p.getInventory().setBoots(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setHelmet(null);
- p.getInventory().setLeggings(null);
- p.getInventory().setItem(8, Items.createItem(Material.BARRIER, "§cKein Gadget ausgewählt", true, 1));
- p.sendMessage(main.prefix + "§cDu hast §4§oDerMeinieLp §f§cdeaktiviert");
- p.closeInventory();
- }
- else
- {
- @SuppressWarnings({ "rawtypes"})
- List<String> lore = new ArrayList();
- lore.add("§bBeschreibung:");
- lore.add("§7Team Owner");
- p.getInventory().setBoots(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setHelmet(items.createHeadWithLore("DerMeinieLp", "§4§oDerMeinieLp", lore));
- p.getInventory().setLeggings(null);
- p.getInventory().setItem(8, items.createHeadWithLore("DerMeinieLp", "§4§oDerMeinieLp", lore));
- p.sendMessage(main.prefix + "§7Du hast dein Gadget geändert");
- }
- }
- }
- }else if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§4§oAustriaminer"))
- {
- if (SQLAustriaminer.getAktiv(p.getUniqueId().toString()).intValue() == 0)
- {
- if (CoinAPI.getCoins(p.getUniqueId().toString()) >= 1000)
- {
- SQLAustriaminer.setAktiv(p.getUniqueId().toString(), Integer.valueOf(1));
- CoinAPI.removeCoins(p.getUniqueId().toString(), 1000);
- p.sendMessage(main.prefix + "§7Du hast §4§oAustriaminer §7erfolgreich gekauft!");
- p.closeInventory();
- p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.0F, 1.0F);
- }
- else
- {
- p.sendMessage(main.prefix + "§cDu hast nicht genügend Coins!");
- p.playSound(p.getLocation(), Sound.BAT_DEATH, 1.0F, 1.0F);
- }
- }
- else if (SQLAustriaminer.getAktiv(p.getUniqueId().toString()).intValue() == 1)
- {
- if (p.getInventory().getItem(8).getType() == Material.BARRIER)
- {
- @SuppressWarnings({ "rawtypes"})
- List<String> lore = new ArrayList();
- lore.add("§bBeschreibung:");
- lore.add("§7Team Miner");
- p.getInventory().setItem(8, items.createHeadWithLore("Austriaminer", "§4§oAustriaminer", lore ));
- p.getInventory().setHelmet(items.createHeadWithLore("Austriaminer", "§4§oAustriaminer", lore));
- p.sendMessage(main.prefix + "§7Du hast §aAustriaminer §f§7aktiviert");
- p.closeInventory();
- return;
- }
- if (p.getInventory().getItem(8) != null) {
- if (p.getInventory().getItem(8).getItemMeta().getDisplayName().equalsIgnoreCase("§4§oAustriaminer"))
- {
- p.getInventory().setBoots(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setHelmet(null);
- p.getInventory().setLeggings(null);
- p.getInventory().setItem(8, Items.createItem(Material.BARRIER, "§cKein Gadget ausgewählt", true, 1));
- p.sendMessage(main.prefix + "§cDu hast §4§oAustriaminer §f§cdeaktiviert");
- p.closeInventory();
- }
- else
- {
- @SuppressWarnings({ "rawtypes"})
- List<String> lore = new ArrayList();
- lore.add("§bBeschreibung:");
- lore.add("§7Team Miner");
- p.getInventory().setBoots(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setHelmet(items.createHeadWithLore("Austriaminer", "§4§oAustriaminer", lore));
- p.getInventory().setLeggings(null);
- p.getInventory().setItem(8, items.createHeadWithLore("Austriaminer", "§4§oAustriaminer", lore));
- p.sendMessage(main.prefix + "§7Du hast dein Gadget geändert");
- }
- }
- }
- }
- }
- }
- catch (Exception localException) {}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement