Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.80 KB | None | 0 0
  1. package me.Cis112233;
  2.  
  3.  
  4. import org.bukkit.configuration.file.FileConfiguration;
  5. import org.bukkit.plugin.java.JavaPlugin;
  6.  
  7. public class GrandTheftMinecraftCops extends JavaPlugin {
  8.  
  9. @Override
  10. public void onEnable() {
  11. new PlayerListener(this);
  12. getLogger().info("Grand Theft Minecraft Cops has been enabled");
  13. final FileConfiguration config = this.getConfig();
  14.  
  15.  
  16. config.options().copyDefaults(true);
  17. saveConfig();
  18.  
  19.  
  20. }
  21. @Override
  22. public void onDisable() {
  23. getLogger().info("Grand Theft Minecraft Cops has been disabled");
  24. }
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31. Player listener:
  32.  
  33.  
  34. package me.Cis112233;
  35. import org.bukkit.ChatColor;
  36. import org.bukkit.Location;
  37. import org.bukkit.Material;
  38. import org.bukkit.World;
  39. import org.bukkit.entity.PigZombie;
  40. import org.bukkit.entity.Player;
  41. import org.bukkit.event.EventHandler;
  42. import org.bukkit.event.Listener;
  43. import org.bukkit.event.entity.PlayerDeathEvent;
  44. import org.bukkit.inventory.EntityEquipment;
  45. import org.bukkit.inventory.ItemStack;
  46.  
  47. public class PlayerListener implements Listener {
  48. GrandTheftMinecraftCops plugin;
  49. public PlayerListener(GrandTheftMinecraftCops instance){
  50. //plugin.getServer().getPluginManager().registerEvents(this, plugin);
  51. plugin = instance;
  52. }
  53. @EventHandler
  54. public void playerkill(PlayerDeathEvent e ){
  55.  
  56. Player player = e.getEntity().getKiller();
  57. String name=player.getName();
  58. World w = player.getWorld();
  59. Location location = player.getLocation();
  60. if(e.getEntity() instanceof Player) {
  61. String a=plugin.getConfig().getString("Armor");
  62. PigZombie pa = w.spawn(location, PigZombie.class);
  63. PigZombie pb = w.spawn(location, PigZombie.class);
  64. PigZombie pc = w.spawn(location, PigZombie.class);
  65. EntityEquipment ea = pa.getEquipment();
  66. EntityEquipment eb = pb.getEquipment();
  67. EntityEquipment ec = pc.getEquipment();
  68. pa.setCustomName(ChatColor.BLUE+"Cop");
  69. pb.setCustomName(ChatColor.BLUE+"Cop");
  70. pc.setCustomName(ChatColor.BLUE+"Cop");
  71. pa.setTarget(player);
  72. pb.setTarget(player);
  73. pc.setTarget(player);
  74. pa.setHealth(plugin.getConfig().getInt("Health"));
  75. pb.setHealth(plugin.getConfig().getInt("Health"));
  76. pc.setHealth(plugin.getConfig().getInt("Health"));
  77. if(a=="iron"){
  78. ea.setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
  79. eb.setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
  80. ec.setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
  81. ea.setBoots(new ItemStack(Material.IRON_BOOTS));
  82. eb.setBoots(new ItemStack(Material.IRON_BOOTS));
  83. ec.setBoots(new ItemStack(Material.IRON_BOOTS));
  84. ea.setHelmet(new ItemStack(Material.IRON_HELMET));
  85. eb.setHelmet(new ItemStack(Material.IRON_HELMET));
  86. ec.setHelmet(new ItemStack(Material.IRON_HELMET));
  87. ea.setLeggings(new ItemStack(Material.IRON_LEGGINGS));
  88. eb.setLeggings(new ItemStack(Material.IRON_LEGGINGS));
  89. ec.setLeggings(new ItemStack(Material.IRON_LEGGINGS));
  90. ea.setItemInHand(new ItemStack(Material.IRON_SWORD));
  91. eb.setItemInHand(new ItemStack(Material.IRON_SWORD));
  92. ec.setItemInHand(new ItemStack(Material.IRON_SWORD));
  93.  
  94. };
  95. if(a=="leather"){
  96. ea.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
  97. eb.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
  98. ec.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
  99. ea.setBoots(new ItemStack(Material.LEATHER_BOOTS));
  100. eb.setBoots(new ItemStack(Material.LEATHER_BOOTS));
  101. ec.setBoots(new ItemStack(Material.LEATHER_BOOTS));
  102. ea.setHelmet(new ItemStack(Material.LEATHER_HELMET));
  103. eb.setHelmet(new ItemStack(Material.LEATHER_HELMET));
  104. ec.setHelmet(new ItemStack(Material.LEATHER_HELMET));
  105. ea.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
  106. eb.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
  107. ec.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
  108. ea.setItemInHand(new ItemStack(Material.WOOD_SWORD));
  109. eb.setItemInHand(new ItemStack(Material.WOOD_SWORD));
  110. ec.setItemInHand(new ItemStack(Material.WOOD_SWORD));
  111.  
  112. };
  113. if(a=="diamond"){
  114. ea.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
  115. eb.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
  116. ec.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
  117. ea.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
  118. eb.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
  119. ec.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
  120. ea.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
  121. eb.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
  122. ec.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
  123. ea.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
  124. eb.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
  125. ec.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
  126. ea.setItemInHand(new ItemStack(Material.DIAMOND_SWORD));
  127. eb.setItemInHand(new ItemStack(Material.DIAMOND_SWORD));
  128. ec.setItemInHand(new ItemStack(Material.DIAMOND_SWORD));
  129.  
  130. };
  131. if(a=="chain"){
  132. ea.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
  133. eb.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
  134. ec.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
  135. ea.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
  136. eb.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
  137. ec.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
  138. ea.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
  139. eb.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
  140. ec.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
  141. ea.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
  142. eb.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
  143. ec.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
  144. ea.setItemInHand(new ItemStack(Material.STONE_SWORD));
  145. eb.setItemInHand(new ItemStack(Material.STONE_SWORD));
  146. ec.setItemInHand(new ItemStack(Material.STONE_SWORD));
  147.  
  148. };
  149. player.sendMessage("The Cops are coming!");
  150. }
  151. }
  152.  
  153. }
  154.  
  155.  
  156.  
  157. Config:
  158.  
  159.  
  160.  
  161. #What set of armor you want?(must be exactly as shown NO CAPS!!! No copy commas) iron, leather, chain, diamond
  162. #And leather gets wood sword, and chain a stone sword
  163. Armor: iron
  164. #Remember 1=1/2 heart
  165. Health: 20
  166.  
  167.  
  168.  
  169. Plugin YML:
  170.  
  171. name: GrandTheftMinecraftCops
  172. main: me.Cis112233.GrandTheftMinecraftCops
  173. version: 1.0
  174. commands:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement