SHARE
TWEET

Untitled

a guest Oct 19th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.immortal.core;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.enchantments.Enchantment;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.inventory.ItemStack;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10.  
  11. import net.md_5.bungee.api.ChatColor;
  12.  
  13. public class KitPvP extends JavaPlugin
  14. {
  15.    
  16.     @Override
  17.     public void onEnable()
  18.     {
  19.         System.out.println("KitPvP plugin has been enabled.");
  20.     }
  21.    
  22.     @Override
  23.     public void onDisable()
  24.     {
  25.         System.out.println("KitPvP plugin has been disabled.");
  26.     }
  27.    
  28.     @Override
  29.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  30.     {
  31.         if(cmd.getName().equals("kitpvp"))
  32.         {
  33.             if(sender instanceof Player)
  34.             {
  35.                 Player p = (Player) sender;
  36.                
  37.                 p.sendMessage(ChatColor.BLUE + p.getName() + " you have recieved KitPvP");
  38.                
  39.                 recoverItems(p); //Makes sure that the items you're wearing come to you're inventory
  40.                
  41.                 equipPVPArmor(p);
  42.                 equipPVPWeapons(p);
  43.             } else
  44.             {
  45.                 System.out.println("You cannot use this command through console");
  46.             }
  47.         }
  48.         return true;
  49.     }
  50.  
  51.     private void equipPVPWeapons(Player p)
  52.     {
  53.         ItemStack sword = new ItemStack(Material.IRON_SWORD);
  54.         sword.addEnchantment(Enchantment.DAMAGE_ALL, 1);
  55.         p.getInventory().addItem(new ItemStack(Material.IRON_SWORD));
  56.         sword.getItemMeta().setDisplayName(ChatColor.GOLD + "PVP Sword");
  57.  
  58.         ItemStack bow = new ItemStack(Material.BOW);
  59.         p.getInventory().addItem(bow);
  60.         bow.getItemMeta().setDisplayName(ChatColor.GOLD + "PVP Bow");
  61.  
  62.         p.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 10));
  63.         p.getInventory().addItem(new ItemStack(Material.ARROW, 32));
  64.     }
  65.  
  66.     private void equipPVPArmor(Player p)
  67.     {
  68.         ItemStack helmet = new ItemStack(Material.IRON_HELMET);
  69.         helmet.addEnchantment(Enchantment.DURABILITY, 1);
  70.         helmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
  71.         p.getInventory().setHelmet(helmet);
  72.         helmet.getItemMeta().setDisplayName(ChatColor.AQUA + "PVP Helmet");
  73.  
  74.         ItemStack chestplate = new ItemStack(Material.IRON_CHESTPLATE);
  75.         chestplate.addEnchantment(Enchantment.DURABILITY, 1);
  76.         chestplate.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
  77.         p.getInventory().setChestplate(chestplate);
  78.         chestplate.getItemMeta().setDisplayName(ChatColor.AQUA + "PVP Chestplate");
  79.  
  80.         ItemStack leggings = new ItemStack(Material.IRON_LEGGINGS);
  81.         leggings.addEnchantment(Enchantment.DURABILITY, 1);
  82.         leggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
  83.         p.getInventory().setLeggings(leggings);
  84.         leggings.getItemMeta().setDisplayName(ChatColor.AQUA + "PVP Leggings");
  85.  
  86.         ItemStack boots = new ItemStack(Material.IRON_BOOTS);
  87.         boots.addEnchantment(Enchantment.DURABILITY, 1);
  88.         boots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
  89.         p.getInventory().setBoots(boots);
  90.         boots.getItemMeta().setDisplayName(ChatColor.AQUA + "PVP Boots");
  91.     }
  92.  
  93.     private void recoverItems(Player p)
  94.     {
  95.         if(p.getInventory().getHelmet() != null)
  96.         {
  97.             Material recoveryItem = p.getInventory().getHelmet().getType();
  98.             p.getInventory().addItem(new ItemStack(recoveryItem, 1));
  99.         }
  100.        
  101.         if(p.getInventory().getChestplate() != null)
  102.         {
  103.             Material recoveryItem = p.getInventory().getChestplate().getType();
  104.             p.getInventory().addItem(new ItemStack(recoveryItem, 1));
  105.         }
  106.        
  107.         if(p.getInventory().getLeggings() != null)
  108.         {
  109.             Material recoveryItem = p.getInventory().getLeggings().getType();
  110.             p.getInventory().addItem(new ItemStack(recoveryItem, 1));
  111.         }
  112.        
  113.         if(p.getInventory().getBoots() != null)
  114.         {
  115.             Material recoveryItem = p.getInventory().getBoots().getType();
  116.             p.getInventory().addItem(new ItemStack(recoveryItem, 1));
  117.         }      
  118.     }
  119. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top