Guest User

Untitled

a guest
Dec 26th, 2015
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.kitpvp.main;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Material;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.enchantments.Enchantment;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.inventory.ItemStack;
  11. import org.bukkit.inventory.meta.ItemMeta;
  12. import org.bukkit.plugin.PluginManager;
  13. import org.bukkit.plugin.java.JavaPlugin;
  14. import org.bukkit.material.*;
  15.  
  16. import me.kitpvp.listeners.PlayerListeners;
  17.  
  18. public class Main extends JavaPlugin{
  19.    
  20.     private static Main instance;
  21.    
  22.     public void log(String string) {
  23.         System.out.println(string);
  24.     }
  25.     public static Main getInstance(){
  26.         return instance;
  27.     }
  28.     public void registerListeners(){
  29.         PluginManager pn = getServer().getPluginManager();
  30.         pn.registerEvents(new PlayerListeners(this), this);
  31.     }
  32.    
  33.     public void registerCommands(){
  34.         //not using this yet
  35.     }
  36.    
  37.     //when the plugin is enabled
  38.     @Override
  39.     public void onEnable(){
  40.         getLogger().info("has been enabled successfully");
  41.         instance = this;
  42.         registerListeners();
  43.         registerCommands();
  44.     }
  45.     //when the plugin is disabled!
  46.     public void onDisable(){
  47.         getLogger().info("has been disabled successfully");
  48.         instance = null;
  49.     }
  50.     //commands
  51.    
  52.     public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  53.        
  54.         //PvP kit
  55.     if (cmd.getName().equalsIgnoreCase("pvp")&& sender instanceof Player) {
  56.        
  57.         Player p = (Player) sender;
  58.         p.getInventory().clear();
  59.         ItemStack DiamondSword = new ItemStack(Material.DIAMOND_SWORD);
  60.         DiamondSword.addEnchantment(Enchantment.DAMAGE_ALL, 1);
  61.         ItemMeta m = DiamondSword.getItemMeta();
  62.         p.getInventory().addItem(DiamondSword);
  63.         p.getInventory().addItem(new ItemStack(Material.MUSHROOM_SOUP, 35));
  64.         p.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET));
  65.         p.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
  66.         p.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
  67.         p.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS));
  68.         p.sendMessage(ChatColor.WHITE + "You now have the pvp kit!");
  69.     }
  70.     //end of pvp kit
  71.    
  72.     //Archer kit
  73.     if (cmd.getName().equalsIgnoreCase("archer")&& sender instanceof Player) {
  74.        
  75.         Player p = (Player) sender;
  76.         p.getInventory().clear();
  77.         ItemStack WoodenSword = new ItemStack(Material.WOOD_SWORD);
  78.         ItemMeta m = WoodenSword.getItemMeta();
  79.         WoodenSword.addEnchantment(Enchantment.DAMAGE_ALL, 4);
  80.         WoodenSword.addEnchantment(Enchantment.DURABILITY, 10);
  81.         p.getInventory().addItem(new ItemStack(Material.MUSHROOM_SOUP, 24));
  82.         p.getInventory().setHelmet(new ItemStack(Material.LEATHER_HELMET));
  83.         p.getInventory().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
  84.         p.getInventory().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
  85.         p.getInventory().setBoots(new ItemStack(Material.LEATHER_BOOTS));
  86.         p.sendMessage(ChatColor.WHITE + "You now have the archer kit!");
  87.        
  88.     }
  89.         return false;
  90.        
  91.     }
  92. }
RAW Paste Data