Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pw.Blares.kits;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.enchantments.Enchantment;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import org.bukkit.event.player.PlayerFishEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.event.player.PlayerRespawnEvent;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.Potion;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import org.bukkit.potion.PotionType;
- public class Kit extends JavaPlugin implements Listener {
- public static String format(String format){
- return ChatColor.translateAlternateColorCodes('&', format);
- }
- public void onEnable() {
- Bukkit.getServer().getPluginManager().registerEvents(this, this);
- }
- @EventHandler
- public void onJoin(PlayerJoinEvent e) {
- e.getPlayer().getInventory().clear();
- ItemStack kit = new ItemStack(Material.WATCH);
- ItemMeta kitMeta = kit.getItemMeta();
- kitMeta.setDisplayName(ChatColor.YELLOW + "Kits");
- kit.setItemMeta(kitMeta);
- e.getPlayer().getInventory().setItem(4, kit);
- }
- @EventHandler
- public void onRespawn(PlayerRespawnEvent e) {
- e.getPlayer().getInventory().clear();
- ItemStack kit = new ItemStack(Material.WATCH);
- ItemMeta kitMeta = kit.getItemMeta();
- kitMeta.setDisplayName(ChatColor.YELLOW + "Kits");
- kit.setItemMeta(kitMeta);
- e.getPlayer().getInventory().setItem(4, kit);
- }
- @EventHandler
- public void onRightClick(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- if (e.getAction()== Action.RIGHT_CLICK_AIR || (e.getAction() == Action.RIGHT_CLICK_BLOCK)) {
- if (p.getItemInHand().getType() == Material.WATCH) {
- Inventory kits = Bukkit.createInventory(null, 45, ChatColor.AQUA + "Kits");
- ItemStack archer = new ItemStack(Material.LEATHER_CHESTPLATE);
- ItemMeta archerMeta = archer.getItemMeta();
- archerMeta.setDisplayName(Kit.format("&cArcher kit"));
- archer.setItemMeta(archerMeta);
- ItemStack archer1 = new ItemStack(Material.GOLD_CHESTPLATE);
- ItemMeta archerMeta1 = archer1.getItemMeta();
- archerMeta1.setDisplayName(Kit.format("&eBard kit"));
- archer1.setItemMeta(archerMeta1);
- ItemStack archer2 = new ItemStack(Material.DIAMOND_CHESTPLATE);
- ItemMeta archerMeta2 = archer2.getItemMeta();
- archerMeta2.setDisplayName(Kit.format("&bPvP kit"));
- archer2.setItemMeta(archerMeta2);
- //split
- ItemStack archer21 = new ItemStack(Material.STONE_SWORD);
- ItemMeta archerMeta21 = archer21.getItemMeta();
- archerMeta21.setDisplayName(Kit.format("&cRusher kit"));
- archer21.setItemMeta(archerMeta21);
- ItemStack thing = new ItemStack(Material.IRON_SWORD);
- ItemMeta thingm = thing.getItemMeta();
- thingm.setDisplayName(Kit.format("&eWarrior Kit"));
- thing.setItemMeta(thingm);
- ItemStack archer20 = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta archerMeta20 = archer2.getItemMeta();
- archerMeta20.setDisplayName(Kit.format("&bThor kit"));
- archer20.setItemMeta(archerMeta20);
- //split
- ItemStack archer25 = new ItemStack(Material.FISHING_ROD);
- ItemMeta archerMeta25 = archer25.getItemMeta();
- archerMeta25.setDisplayName(Kit.format("&cFisherman kit"));
- archer25.setItemMeta(archerMeta25);
- ItemStack arche = new ItemStack(Material.POTION);
- ItemMeta archerMet = arche.getItemMeta();
- archerMet.setDisplayName(Kit.format("&eSpeed kit"));
- arche.setItemMeta(archerMet);
- ItemStack archer28 = new ItemStack(Material.BOOK);
- ItemMeta archerMeta28 = archer28.getItemMeta();
- archerMeta28.setDisplayName(Kit.format("&bEnchanter kit"));
- archer28.setItemMeta(archerMeta28);
- kits.setItem(43, archer28);
- kits.setItem(40, arche);
- kits.setItem(37, archer25);
- kits.setItem(25, archer20);
- kits.setItem(22, thing);
- kits.setItem(19, archer21);
- kits.setItem(7, archer2);
- kits.setItem(4, archer1);
- kits.setItem(1, archer);
- e.getPlayer().openInventory(kits);
- }
- }
- }
- @EventHandler
- public void onClick(InventoryClickEvent e) {
- Player p = (Player) e.getWhoClicked();
- if (e.getInventory().getTitle().equalsIgnoreCase(ChatColor.AQUA + "Kits")) {
- e.setCancelled(true);
- if (e.getRawSlot() == 1) {
- p.closeInventory();
- p.getInventory().clear();
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 1));
- p.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET));
- p.getInventory().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
- p.getInventory().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
- p.getInventory().setBoots(new ItemStack(Material.LEATHER_BOOTS));
- ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Archer sword");
- sword.setItemMeta(swordMeta);
- p.sendMessage(Kit.format("&AYou have equipped &cArcher kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().setItem(0, sword);
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }
- else if (e.getRawSlot() == 4) {
- p.closeInventory();
- p.getInventory().clear();
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 1));
- p.getInventory().setHelmet(new ItemStack(Material.GOLD_HELMET));
- p.getInventory().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
- p.getInventory().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
- p.getInventory().setBoots(new ItemStack(Material.GOLD_BOOTS));
- ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Bard sword");
- sword.setItemMeta(swordMeta);
- p.sendMessage(Kit.format("&AYou have equipped &eBard kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().setItem(0, sword);
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }
- else if (e.getRawSlot() == 7) {
- p.closeInventory();
- p.getInventory().clear();
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 1));
- p.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
- p.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
- p.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
- p.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
- ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Pvp sword");
- sword.setItemMeta(swordMeta);
- p.sendMessage(Kit.format("&AYou have equipped &bPvp kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().setItem(0, sword);
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }
- else if (e.getRawSlot() == 19) {
- p.closeInventory();
- if (p.hasPermission("Acoria.donor.kits")) {
- p.closeInventory();
- p.getInventory().clear();
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 1));
- p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 100000, 1));
- p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 100000, 2));
- p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 2));
- p.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
- ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Rusher sword");
- sword.setItemMeta(swordMeta);
- p.sendMessage(Kit.format("&AYou have equipped &cRusher kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().setItem(0, sword);
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }else {
- p.sendMessage(Kit.format("&cYou have not purchased this kit, purchase it &5@Store.acoria.co"));
- }
- }
- else if (e.getRawSlot() == 22) {
- p.closeInventory();
- if (p.hasPermission("Acoria.donor.kits")) {
- p.closeInventory();
- p.getInventory().clear();
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 1));
- p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 2));
- p.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
- ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Warrior sword");
- sword.setItemMeta(swordMeta);
- p.sendMessage(Kit.format("&AYou have equipped &eWarrior kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().setItem(0, sword);
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }else {
- p.sendMessage(Kit.format("&cYou have not purchased this kit, purchase it &5@Store.acoria.co"));;
- }
- }
- else if (e.getRawSlot() == 25) {
- p.closeInventory();
- if (p.hasPermission("Acoria.donor.kits")) {
- p.closeInventory();
- p.getInventory().clear();
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 1));
- p.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
- p.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
- p.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
- p.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET));
- ItemStack sword = new ItemStack(Material.DIAMOND_AXE);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 2, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Thor sword");
- sword.setItemMeta(swordMeta);
- p.sendMessage(Kit.format("&AYou have equipped &bThor kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().setItem(0, sword);
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }else {
- p.sendMessage(Kit.format("&cYou have not purchased this kit, purchase it &5@Store.acoria.co"));;
- }
- }
- else if (e.getRawSlot() == 37) {
- p.closeInventory();
- if (p.hasPermission("Acoria.donor.kits")) {
- p.closeInventory();
- p.getInventory().clear();
- p.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET));
- p.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
- p.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
- p.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS));
- ItemStack sword = new ItemStack(Material.IRON_SWORD);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Fisherman sword");
- sword.setItemMeta(swordMeta);
- p.getInventory().addItem(sword);
- p.getInventory().addItem(new ItemStack(Material.FISHING_ROD));
- p.getInventory().setItem(9, new ItemStack(Material.ARROW));
- p.sendMessage(Kit.format("&AYou have equipped &cFisherman kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }else {
- p.sendMessage(Kit.format("&cYou have not purchased this kit, purchase it &5@Store.acoria.co"));;
- }
- }
- else if (e.getRawSlot() == 40) {
- p.closeInventory();
- if (p.hasPermission("Acoria.donor.kits")) {
- p.closeInventory();
- p.getInventory().clear();
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 1));
- p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 100000, 0));
- p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 1));
- p.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
- p.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
- p.getInventory().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
- p.getInventory().setBoots(new ItemStack(Material.LEATHER_BOOTS));
- ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 2, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Speed sword");
- sword.setItemMeta(swordMeta);
- p.sendMessage(Kit.format("&AYou have equipped &eSpeed kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().setItem(0, sword);
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }else {
- p.sendMessage(Kit.format("&cYou have not purchased this kit, purchase it &5@Store.acoria.co"));;
- }
- }
- else if (e.getRawSlot() == 43) {
- if (p.hasPermission("Acoria.donor.kits")) {
- p.closeInventory();
- p.getInventory().clear();
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 1));
- p.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET));
- p.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
- p.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
- p.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS));
- ItemStack sword = new ItemStack(Material.STONE_SWORD);
- ItemMeta swordMeta = sword.getItemMeta();
- swordMeta.addEnchant(Enchantment.DAMAGE_ALL, 4, true);
- swordMeta.setDisplayName(ChatColor.YELLOW + "Enchanter sword");
- sword.setItemMeta(swordMeta);
- p.sendMessage(Kit.format("&AYou have equipped &bEnchanter kit"));
- Potion pot = new Potion(PotionType.INSTANT_HEAL, 2);
- pot.setSplash(true);
- for (int i = 0; i < 35; i++) {
- p.getInventory().addItem(pot.toItemStack(1));
- p.getInventory().setItem(0, sword);
- p.getInventory().addItem(pot.toItemStack(1));;
- }
- }else {
- p.closeInventory();
- p.sendMessage(Kit.format("&cYou have not purchased this kit, purchase it &5@Store.acoria.co"));;
- }
- }
- }
- }
- @EventHandler
- public void onFish(PlayerFishEvent e) {
- Player p = e.getPlayer();
- Player caught = (Player) e.getCaught();
- if (caught != null) {
- if (caught instanceof Player) {
- caught.teleport(p);
- caught.sendMessage(ChatColor.GREEN + "You have been fished by " + p.getName() + "!");
- p.sendMessage(ChatColor.GREEN + "You have fished " + caught.getName() + "!");
- }
- }
- }
- }
- name: Kits
- version: 1.0
- main: pw.Blares.kits.Kit
- author: Blares
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement