Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Cis112233;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.plugin.java.JavaPlugin;
- public class GrandTheftMinecraftCops extends JavaPlugin {
- @Override
- public void onEnable() {
- new PlayerListener(this);
- getLogger().info("Grand Theft Minecraft Cops has been enabled");
- final FileConfiguration config = this.getConfig();
- config.options().copyDefaults(true);
- saveConfig();
- }
- @Override
- public void onDisable() {
- getLogger().info("Grand Theft Minecraft Cops has been disabled");
- }
- }
- Player listener:
- package me.Cis112233;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.entity.PigZombie;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.inventory.EntityEquipment;
- import org.bukkit.inventory.ItemStack;
- public class PlayerListener implements Listener {
- GrandTheftMinecraftCops plugin;
- public PlayerListener(GrandTheftMinecraftCops instance){
- //plugin.getServer().getPluginManager().registerEvents(this, plugin);
- plugin = instance;
- }
- @EventHandler
- public void playerkill(PlayerDeathEvent e ){
- Player player = e.getEntity().getKiller();
- String name=player.getName();
- World w = player.getWorld();
- Location location = player.getLocation();
- if(e.getEntity() instanceof Player) {
- String a=plugin.getConfig().getString("Armor");
- PigZombie pa = w.spawn(location, PigZombie.class);
- PigZombie pb = w.spawn(location, PigZombie.class);
- PigZombie pc = w.spawn(location, PigZombie.class);
- EntityEquipment ea = pa.getEquipment();
- EntityEquipment eb = pb.getEquipment();
- EntityEquipment ec = pc.getEquipment();
- pa.setCustomName(ChatColor.BLUE+"Cop");
- pb.setCustomName(ChatColor.BLUE+"Cop");
- pc.setCustomName(ChatColor.BLUE+"Cop");
- pa.setTarget(player);
- pb.setTarget(player);
- pc.setTarget(player);
- pa.setHealth(plugin.getConfig().getInt("Health"));
- pb.setHealth(plugin.getConfig().getInt("Health"));
- pc.setHealth(plugin.getConfig().getInt("Health"));
- if(a=="iron"){
- ea.setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
- eb.setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
- ec.setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
- ea.setBoots(new ItemStack(Material.IRON_BOOTS));
- eb.setBoots(new ItemStack(Material.IRON_BOOTS));
- ec.setBoots(new ItemStack(Material.IRON_BOOTS));
- ea.setHelmet(new ItemStack(Material.IRON_HELMET));
- eb.setHelmet(new ItemStack(Material.IRON_HELMET));
- ec.setHelmet(new ItemStack(Material.IRON_HELMET));
- ea.setLeggings(new ItemStack(Material.IRON_LEGGINGS));
- eb.setLeggings(new ItemStack(Material.IRON_LEGGINGS));
- ec.setLeggings(new ItemStack(Material.IRON_LEGGINGS));
- ea.setItemInHand(new ItemStack(Material.IRON_SWORD));
- eb.setItemInHand(new ItemStack(Material.IRON_SWORD));
- ec.setItemInHand(new ItemStack(Material.IRON_SWORD));
- };
- if(a=="leather"){
- ea.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
- eb.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
- ec.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
- ea.setBoots(new ItemStack(Material.LEATHER_BOOTS));
- eb.setBoots(new ItemStack(Material.LEATHER_BOOTS));
- ec.setBoots(new ItemStack(Material.LEATHER_BOOTS));
- ea.setHelmet(new ItemStack(Material.LEATHER_HELMET));
- eb.setHelmet(new ItemStack(Material.LEATHER_HELMET));
- ec.setHelmet(new ItemStack(Material.LEATHER_HELMET));
- ea.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
- eb.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
- ec.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
- ea.setItemInHand(new ItemStack(Material.WOOD_SWORD));
- eb.setItemInHand(new ItemStack(Material.WOOD_SWORD));
- ec.setItemInHand(new ItemStack(Material.WOOD_SWORD));
- };
- if(a=="diamond"){
- ea.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
- eb.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
- ec.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
- ea.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
- eb.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
- ec.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
- ea.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
- eb.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
- ec.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
- ea.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
- eb.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
- ec.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
- ea.setItemInHand(new ItemStack(Material.DIAMOND_SWORD));
- eb.setItemInHand(new ItemStack(Material.DIAMOND_SWORD));
- ec.setItemInHand(new ItemStack(Material.DIAMOND_SWORD));
- };
- if(a=="chain"){
- ea.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
- eb.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
- ec.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
- ea.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
- eb.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
- ec.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
- ea.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
- eb.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
- ec.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
- ea.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
- eb.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
- ec.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
- ea.setItemInHand(new ItemStack(Material.STONE_SWORD));
- eb.setItemInHand(new ItemStack(Material.STONE_SWORD));
- ec.setItemInHand(new ItemStack(Material.STONE_SWORD));
- };
- player.sendMessage("The Cops are coming!");
- }
- }
- }
- Config:
- #What set of armor you want?(must be exactly as shown NO CAPS!!! No copy commas) iron, leather, chain, diamond
- #And leather gets wood sword, and chain a stone sword
- Armor: iron
- #Remember 1=1/2 heart
- Health: 20
- Plugin YML:
- name: GrandTheftMinecraftCops
- main: me.Cis112233.GrandTheftMinecraftCops
- version: 1.0
- commands:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement