Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.andrivard4.GuardArmor;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Effect;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.enchantments.Enchantment;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- public class Officer implements CommandExecutor {
- public Armor Plugin;
- public Officer(Armor instance){
- Plugin = instance;
- @SuppressWarnings("unused")
- class Armor {
- }
- }
- @SuppressWarnings("deprecation")
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
- Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(),"Armor");
- //officer armor
- ItemStack oh = new ItemStack(Material.CHAINMAIL_HELMET);
- ItemStack oc = new ItemStack(Material.CHAINMAIL_CHESTPLATE);
- ItemStack ol = new ItemStack(Material.CHAINMAIL_LEGGINGS);
- ItemStack ob = new ItemStack(Material.CHAINMAIL_BOOTS);
- //officer enchants
- oh.addEnchantment(Enchantment.DURABILITY, 3);
- oh.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
- oc.addEnchantment(Enchantment.DURABILITY, 3);
- oc.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
- ol.addEnchantment(Enchantment.DURABILITY, 3);
- ol.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
- ob.addEnchantment(Enchantment.DURABILITY, 3);
- ob.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
- if(commandLabel.equalsIgnoreCase("Armor")){
- if(!(sender instanceof Player)) {
- Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(),"Armor");
- Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
- if(args.length==2){
- if(args[0].equalsIgnoreCase("officer")){
- targetPlayer.getInventory().setHelmet(new ItemStack(oh));
- targetPlayer.getInventory().setChestplate(new ItemStack(oc));
- targetPlayer.getInventory().setLeggings(new ItemStack(ol));
- targetPlayer.getInventory().setBoots(new ItemStack(ob));
- targetPlayer.sendMessage(ChatColor.DARK_AQUA + "You have been granted with guarding armor!");
- targetPlayer.playSound(targetPlayer.getLocation(), Sound.IRONGOLEM_HIT, 10, 4);
- targetPlayer.playEffect(targetPlayer.getLocation(), Effect.ENDER_SIGNAL, 4);
- }
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement