Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.kitpvp.main;
- 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.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- import me.kitpvp.listeners.PlayerListeners;
- public class main extends JavaPlugin{
- private static main instance;
- public void log(String string) {
- System.out.println(string);
- }
- public static main getInstance(){
- return instance;
- }
- public void registerListeners(){
- PluginManager pm = getServer().getPluginManager();
- pm.registerEvents(new PlayerListeners(this), this);
- }
- public void registerCommands(){
- //not using this yet
- }
- //when the plugin is enabled
- @Override
- public void onEnable(){
- getLogger().info("has been enabled successfully!");
- instance = this;
- registerListeners();
- registerCommands();
- }
- //when the plugin is disabled
- @Override
- public void onDisable(){
- getLogger().info("has been disabled successfully!");
- instance = null;
- }
- //commands
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
- //kit pvp command
- if (cmd.getName().equalsIgnoreCase("kit pvp") && sender instanceof Player) {
- if(!sender.hasPermission("kit.pvp")) {
- return true;
- }
- Player p = (Player) sender;
- p.getInventory();
- ItemStack pvpsword = new ItemStack(Material.IRON_SWORD);
- ItemMeta m = pvpsword.getItemMeta();
- m.setDisplayName("" + ChatColor.GRAY + ChatColor.BOLD + "KitPvpSword");
- pvpsword.setItemMeta(m);
- pvpsword.addEnchantment(Enchantment.DURABILITY, 1);
- pvpsword.addEnchantment(Enchantment.DAMAGE_ALL, 2);
- p.getInventory().addItem(pvpsword);
- ItemStack pvpbow = new ItemStack(Material.BOW);
- ItemMeta m1 = pvpbow.getItemMeta();
- m1.setDisplayName("" + ChatColor.GRAY + ChatColor.BOLD + "KitPvpBow");
- pvpbow.setItemMeta(m1);
- pvpbow.addEnchantment(Enchantment.DURABILITY, 1);
- pvpbow.addEnchantment(Enchantment.ARROW_DAMAGE, 1);
- ItemStack pvphelmet = new ItemStack(Material.IRON_HELMET);
- ItemMeta m2 = pvphelmet.getItemMeta();
- m2.setDisplayName("" + ChatColor.GRAY + ChatColor.BOLD + "KitPvpHelmet");
- pvphelmet.setItemMeta(m2);
- pvphelmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
- pvphelmet.addEnchantment(Enchantment.DURABILITY, 1);
- ItemStack pvpchestplate = new ItemStack(Material.IRON_CHESTPLATE);
- ItemMeta m3 = pvpchestplate.getItemMeta();
- m3.setDisplayName("" + ChatColor.GRAY + ChatColor.BOLD + "KitPvpChestplate");
- pvpchestplate.setItemMeta(m3);
- pvpchestplate.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
- pvpchestplate.addEnchantment(Enchantment.DURABILITY, 1);
- ItemStack pvpleggings = new ItemStack(Material.IRON_LEGGINGS);
- ItemMeta m4 = pvpleggings.getItemMeta();
- m4.setDisplayName("" + ChatColor.GRAY + ChatColor.BOLD + "KitPvpLeggings");
- pvpleggings.setItemMeta(m4);
- pvpleggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
- pvpleggings.addEnchantment(Enchantment.DURABILITY, 1);
- ItemStack pvpboots = new ItemStack(Material.IRON_BOOTS);
- ItemMeta m5 = pvpboots.getItemMeta();
- m5.setDisplayName("" + ChatColor.GRAY + ChatColor.BOLD + "KitPvpBoots");
- pvpboots.setItemMeta(m5);
- pvpboots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
- pvpboots.addEnchantment(Enchantment.DURABILITY, 1);
- p.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 10));
- p.getInventory().addItem(pvphelmet);
- p.getInventory().addItem(pvpchestplate);
- p.getInventory().addItem(pvpleggings);
- p.getInventory().addItem(pvpboots);
- p.getInventory().addItem(new ItemStack(Material.ARROW, 32));
- p.sendMessage("" + ChatColor.AQUA + "You have recieved the kit" + ChatColor.BOLD + ChatColor.GREEN + "pvp");
- return true;
- }
- //end of kit pvp command
- //kit vip command
- if (cmd.getName().equalsIgnoreCase("kit vip") && sender instanceof Player) {
- if(!sender.hasPermission("kit.vip")) {
- sender.sendMessage(ChatColor.RED + "You do not have permission to use this command!");
- return true;
- }
- Player p = (Player) sender;
- p.getInventory();
- ItemStack vipsword = new ItemStack(Material.IRON_SWORD);
- ItemMeta m = vipsword.getItemMeta();
- m.setDisplayName("" + ChatColor.AQUA + ChatColor.BOLD + "KitVipSword");
- vipsword.setItemMeta(m);
- vipsword.addEnchantment(Enchantment.DURABILITY, 2);
- vipsword.addEnchantment(Enchantment.DAMAGE_ALL, 3);
- p.getInventory().addItem(vipsword);
- ItemStack vipbow = new ItemStack(Material.BOW);
- ItemMeta m1 = vipbow.getItemMeta();
- m1.setDisplayName("" + ChatColor.AQUA + ChatColor.BOLD + "KitVipBow");
- vipbow.setItemMeta(m1);
- vipbow.addEnchantment(Enchantment.DURABILITY, 2);
- vipbow.addEnchantment(Enchantment.ARROW_DAMAGE, 2);
- ItemStack viphelmet = new ItemStack(Material.IRON_HELMET);
- ItemMeta m2 = viphelmet.getItemMeta();
- m2.setDisplayName("" + ChatColor.AQUA + ChatColor.BOLD + "KitVipHelmet");
- viphelmet.setItemMeta(m2);
- viphelmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
- viphelmet.addEnchantment(Enchantment.DURABILITY, 2);
- ItemStack vipchestplate = new ItemStack(Material.IRON_CHESTPLATE);
- ItemMeta m3 = vipchestplate.getItemMeta();
- m3.setDisplayName("" + ChatColor.AQUA + ChatColor.BOLD + "KitVipChestplate");
- vipchestplate.setItemMeta(m3);
- vipchestplate.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
- vipchestplate.addEnchantment(Enchantment.DURABILITY, 2);
- ItemStack vipleggings = new ItemStack(Material.IRON_LEGGINGS);
- ItemMeta m4 = vipleggings.getItemMeta();
- m4.setDisplayName("" + ChatColor.AQUA + ChatColor.BOLD + "KitVipLeggings");
- vipleggings.setItemMeta(m4);
- vipleggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
- vipchestplate.addEnchantment(Enchantment.DURABILITY, 2);
- ItemStack vipboots = new ItemStack(Material.IRON_BOOTS);
- ItemMeta m5 = vipboots.getItemMeta();
- m5.setDisplayName("" + ChatColor.AQUA + ChatColor.BOLD + "KitVipBoots");
- vipboots.setItemMeta(m5);
- vipboots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
- vipboots.addEnchantment(Enchantment.DURABILITY, 2);
- p.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 10));
- p.getInventory().addItem(viphelmet);
- p.getInventory().addItem(vipchestplate);
- p.getInventory().addItem(vipleggings);
- p.getInventory().addItem(vipboots);
- p.getInventory().addItem(new ItemStack(Material.ARROW, 32));
- p.getInventory().addItem(new ItemStack(Material.ENCHANTED_GOLDEN_APPLE, 1));
- p.sendMessage("" + ChatColor.AQUA + "You have recieved the kit" + ChatColor.BOLD + ChatColor.GOLD + "Vip");
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement