danik159

Untitled

Jul 2nd, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.47 KB | None | 0 0
  1.  
  2. package com.junkstyle.SoulCatcher;
  3.  
  4. import java.util.Arrays;
  5. import java.util.HashMap;
  6. import java.util.Random;
  7.  
  8. import org.bukkit.Bukkit;
  9. import org.bukkit.Material;
  10. import org.bukkit.Sound;
  11. import org.bukkit.command.Command;
  12. import org.bukkit.command.CommandSender;
  13. import org.bukkit.entity.Entity;
  14. import org.bukkit.entity.EntityType;
  15. import org.bukkit.entity.Player;
  16. import org.bukkit.event.EventHandler;
  17. import org.bukkit.event.Listener;
  18. import org.bukkit.event.block.Action;
  19. import org.bukkit.event.entity.EntityDeathEvent;
  20. import org.bukkit.event.inventory.PrepareItemCraftEvent;
  21. import org.bukkit.event.player.PlayerInteractEvent;
  22. import org.bukkit.inventory.CraftingInventory;
  23. import org.bukkit.inventory.ItemStack;
  24. import org.bukkit.inventory.ShapedRecipe;
  25. import org.bukkit.inventory.meta.ItemMeta;
  26. import org.bukkit.permissions.Permission;
  27. import org.bukkit.plugin.PluginManager;
  28. import org.bukkit.plugin.java.JavaPlugin;
  29.  
  30. import com.junkstyle.SoulCatcher.commands.HowToFix;
  31.  
  32. import net.md_5.bungee.api.ChatColor;
  33.  
  34. public class Main extends JavaPlugin implements Listener {
  35. @SuppressWarnings("deprecation")
  36. public void onEnable() {
  37. System.out.println("Soul Catcher Plugin Working Fine!");
  38. Bukkit.getPluginManager().registerEvents(this, this);
  39. getCommand("howtofix").setExecutor(new HowToFix());
  40.  
  41. //Craft System
  42. ItemStack SoulCatcher = new ItemStack(Material.GLASS_BOTTLE, 1);
  43. ItemMeta im2 = SoulCatcher.getItemMeta();
  44. im2.setDisplayName(ChatColor.BOLD + "" + ChatColor.AQUA + "Soul Catcher");
  45. im2.setLore(Arrays.asList(ChatColor.GOLD + "Kill mob with this item",ChatColor.GOLD + "to catch his souls!", ""));
  46. SoulCatcher.setItemMeta(im2);
  47. SoulCatcher.setItemMeta(im2);
  48.  
  49. ItemStack blaze = new ItemStack(Material.BLAZE_POWDER, 4);
  50. ItemMeta im4 = blaze.getItemMeta();
  51. im4.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "Upgraded Blaze Powder");
  52. im4.setLore(Arrays.asList(ChatColor.GOLD + "You can use this magical",ChatColor.GOLD + "Blaze Powder to fix", ChatColor.GOLD + "your broken Soul Catchers!"));
  53. blaze.setItemMeta(im4);
  54. ShapedRecipe bottle = new ShapedRecipe(SoulCatcher);
  55. bottle.shape("@@@", "&%&", "$*$");
  56. bottle.setIngredient('@', Material.DIAMOND);
  57. bottle.setIngredient('$', Material.BLAZE_POWDER);
  58. bottle.setIngredient('%', Material.GLASS_BOTTLE);
  59. bottle.setIngredient('&', Material.EYE_OF_ENDER);
  60. bottle.setIngredient('*', Material.EMERALD);
  61. getServer().addRecipe(bottle);
  62.  
  63. ShapedRecipe powder = new ShapedRecipe(blaze);
  64. powder.shape("@@@", "#$#", "@@@");
  65. powder.setIngredient('@', Material.AIR);
  66. powder.setIngredient('#', Material.DIAMOND);
  67. powder.setIngredient('$', Material.BLAZE_POWDER);
  68. getServer().addRecipe(powder);
  69. //
  70. //Permission
  71. PluginManager pm = Bukkit.getPluginManager();
  72. Permission p = new Permission("soulcatcher.commands");
  73. pm.addPermission(p);
  74. }
  75.  
  76. //Broken Fix
  77. @SuppressWarnings("serial")
  78. @EventHandler
  79. public void OnPlayerCraftItem(PrepareItemCraftEvent e) {
  80. ItemStack broken = new ItemStack(Material.GLASS_BOTTLE, 1);
  81. ItemMeta im3 = broken.getItemMeta();
  82. im3.setDisplayName(ChatColor.BOLD + "" + ChatColor.GRAY + "Broken Soul Catcher");
  83. im3.setLore(Arrays.asList(ChatColor.GOLD + "Use /howtofix",ChatColor.GOLD + "to learn how to fix the", ChatColor.GOLD + "Soul Catcher!"));
  84. broken.setItemMeta(im3);
  85. ItemStack SoulCatcher = new ItemStack(Material.GLASS_BOTTLE, 1);
  86. ItemMeta im2 = SoulCatcher.getItemMeta();
  87. im2.setDisplayName(ChatColor.BOLD + "" + ChatColor.AQUA + "Soul Catcher");
  88. im2.setLore(Arrays.asList(ChatColor.GOLD + "Kill mob with this item",ChatColor.GOLD + "to catch his souls!", ""));
  89. SoulCatcher.setItemMeta(im2);
  90. ItemStack blaze = new ItemStack(Material.BLAZE_POWDER);
  91. ItemMeta im4 = blaze.getItemMeta();
  92. im4.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "Upgraded Blaze Powder");
  93. im4.setLore(Arrays.asList(ChatColor.GOLD + "You can use this magical",ChatColor.GOLD + "Blaze Powder to fix", ChatColor.GOLD + "your broken Soul Catchers!"));
  94. blaze.setItemMeta(im4);
  95. if(e.getInventory().getMatrix().length < 9) {
  96. return;
  97. }
  98.  
  99. checkCraft(SoulCatcher, e.getInventory(), new HashMap<Integer, ItemStack>(){{
  100. put(4, broken);
  101. put(0, blaze);
  102. put(1, blaze);
  103. put(2, blaze);
  104. put(3, blaze);
  105. put(5, blaze);
  106. put(6, blaze);
  107. put(7, blaze);
  108. put(8, blaze);
  109. }});
  110. }
  111.  
  112. public void checkCraft(ItemStack result, CraftingInventory inv, HashMap<Integer, ItemStack> Ingrediants) {
  113. ItemStack [] matrix = inv.getMatrix();
  114. for(int i = 0; i < 9; i++) {
  115. if(Ingrediants.containsKey(i)) {
  116. if (matrix[i] == null || !matrix[i].equals(Ingrediants.get(i))) {
  117. return;
  118. }
  119. } else {
  120. if(matrix[i] != null) {
  121. return;
  122. }
  123. }
  124. }
  125. inv.setResult(result);
  126. }
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137. //Soul Catch System
  138. @EventHandler
  139. public void OnDeath(EntityDeathEvent e) {
  140. Player player = e.getEntity().getKiller();
  141. Entity killed = e.getEntity();
  142. //Cow
  143. ItemStack cow = new ItemStack(Material.DRAGONS_BREATH);
  144. ItemMeta im = cow.getItemMeta();
  145. im.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Cow's Soul");
  146. im.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  147. cow.setItemMeta(im);
  148.  
  149. //Pig
  150. ItemStack pig = new ItemStack(Material.DRAGONS_BREATH);
  151. ItemMeta imp = cow.getItemMeta();
  152. imp.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Pig's Soul");
  153. imp.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  154. pig.setItemMeta(imp);
  155.  
  156. ItemStack skel = new ItemStack(Material.DRAGONS_BREATH);
  157. ItemMeta imsk = skel.getItemMeta();
  158. imsk.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Skeleton's Soul");
  159. imsk.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  160. skel.setItemMeta(imsk);
  161.  
  162. ItemStack zom = new ItemStack(Material.DRAGONS_BREATH);
  163. ItemMeta imsz = zom.getItemMeta();
  164. imsz.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Zombie's Soul");
  165. imsz.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  166. zom.setItemMeta(imsz);
  167.  
  168. ItemStack cre = new ItemStack(Material.DRAGONS_BREATH);
  169. ItemMeta imsc = cre.getItemMeta();
  170. imsc.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Creeper's Soul");
  171. imsc.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  172. cre.setItemMeta(imsc);
  173.  
  174. ItemStack end = new ItemStack(Material.DRAGONS_BREATH);
  175. ItemMeta imse = end.getItemMeta();
  176. imse.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "EnderMan's Soul");
  177. imse.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  178. end.setItemMeta(imse);
  179.  
  180. ItemStack spi = new ItemStack(Material.DRAGONS_BREATH);
  181. ItemMeta imss = spi.getItemMeta();
  182. imss.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Spider's Soul");
  183. imss.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  184. spi.setItemMeta(imss);
  185.  
  186. ItemStack spq = new ItemStack(Material.DRAGONS_BREATH);
  187. ItemMeta imsq = spq.getItemMeta();
  188. imsq.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Squid's Soul");
  189. imsq.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  190. spq.setItemMeta(imsq);
  191.  
  192. ItemStack spw = new ItemStack(Material.DRAGONS_BREATH);
  193. ItemMeta imsw = spw.getItemMeta();
  194. imsw.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Wolf's Soul");
  195. imsw.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  196. spw.setItemMeta(imsw);
  197.  
  198. ItemStack spc = new ItemStack(Material.DRAGONS_BREATH);
  199. ItemMeta imscc = spc.getItemMeta();
  200. imscc.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Chicken's Soul");
  201. imscc.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  202. spc.setItemMeta(imscc);
  203.  
  204. ItemStack spb = new ItemStack(Material.DRAGONS_BREATH);
  205. ItemMeta imsb = spb.getItemMeta();
  206. imsb.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Blaze's Soul");
  207. imsb.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  208. spb.setItemMeta(imsb);
  209.  
  210. ItemStack spl = new ItemStack(Material.DRAGONS_BREATH);
  211. ItemMeta imsl = spl.getItemMeta();
  212. imsl.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Llama's Soul");
  213. imsl.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  214. spl.setItemMeta(imsl);
  215.  
  216. ItemStack spr = new ItemStack(Material.DRAGONS_BREATH);
  217. ItemMeta imsr = spr.getItemMeta();
  218. imsr.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Rabbit's Soul");
  219. imsr.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  220. spr.setItemMeta(imsr);
  221.  
  222. ItemStack spo = new ItemStack(Material.DRAGONS_BREATH);
  223. ItemMeta imso = spo.getItemMeta();
  224. imso.setDisplayName(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Ocelot's Soul");
  225. imso.setLore(Arrays.asList(ChatColor.GOLD + "Click right click on a block",ChatColor.GOLD + "to release mob's soul ", ChatColor.GOLD + "and spawn it!"));
  226. spo.setItemMeta(imso);
  227.  
  228.  
  229. if (player instanceof Player && player.getInventory().getItemInMainHand().getType().equals(Material.GLASS_BOTTLE)) {
  230. if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.AQUA + "Soul Catcher")) {
  231. if (player.getInventory().getItemInMainHand().getAmount() >= 2) {
  232. player.sendMessage(ChatColor.BOLD + "" + ChatColor.RED + "You cannot use this item stacked,please use it one by one!");
  233. } else {
  234. if (killed.getType().equals(EntityType.COW)) {
  235. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught cow's soul!");
  236. player.getInventory().setItemInMainHand(cow);
  237. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  238. e.getDrops().clear();
  239. e.setDroppedExp(0);
  240. } else if (killed.getType().equals(EntityType.PIG)) {
  241. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught pig's soul!");
  242. player.getInventory().setItemInMainHand(pig);
  243. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  244. e.getDrops().clear();
  245. e.setDroppedExp(0);
  246. }else if (killed.getType().equals(EntityType.SKELETON)) {
  247. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught skeleton's soul!");
  248. player.getInventory().setItemInMainHand(skel);
  249. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  250. e.getDrops().clear();
  251. e.setDroppedExp(0);
  252. }else if (killed.getType().equals(EntityType.ZOMBIE)) {
  253. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught zombie's soul!");
  254. player.getInventory().setItemInMainHand(zom);
  255. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  256. e.getDrops().clear();
  257. e.setDroppedExp(0);
  258. }else if (killed.getType().equals(EntityType.CREEPER)) {
  259. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught creeper's soul!");
  260. player.getInventory().setItemInMainHand(cre);
  261. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  262. e.getDrops().clear();
  263. e.setDroppedExp(0);
  264. }else if (killed.getType().equals(EntityType.ENDERMAN)) {
  265. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught enderman's soul!");
  266. player.getInventory().setItemInMainHand(end);
  267. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  268. e.getDrops().clear();
  269. e.setDroppedExp(0);
  270. }else if (killed.getType().equals(EntityType.SPIDER)) {
  271. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught spider's soul!");
  272. player.getInventory().setItemInMainHand(spi);
  273. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  274. e.getDrops().clear();
  275. e.setDroppedExp(0);
  276. }else if (killed.getType().equals(EntityType.SQUID)) {
  277. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught squid's soul!");
  278. player.getInventory().setItemInMainHand(spq);
  279. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  280. e.getDrops().clear();
  281. e.setDroppedExp(0);
  282. }else if (killed.getType().equals(EntityType.WOLF)) {
  283. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught wolf's soul!");
  284. player.getInventory().setItemInMainHand(spw);
  285. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  286. e.getDrops().clear();
  287. e.setDroppedExp(0);
  288. }else if (killed.getType().equals(EntityType.CHICKEN)) {
  289. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught chicken's soul!");
  290. player.getInventory().setItemInMainHand(spc);
  291. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  292. e.getDrops().clear();
  293. e.setDroppedExp(0);
  294. }else if (killed.getType().equals(EntityType.BLAZE)) {
  295. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught blaze's soul!");
  296. player.getInventory().setItemInMainHand(spb);
  297. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  298. e.getDrops().clear();
  299. e.setDroppedExp(0);
  300. }else if (killed.getType().equals(EntityType.LLAMA)) {
  301. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught Llama's soul!");
  302. player.getInventory().setItemInMainHand(spl);
  303. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  304. e.getDrops().clear();
  305. e.setDroppedExp(0);
  306. }else if (killed.getType().equals(EntityType.RABBIT)) {
  307. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught Rabbit's soul!");
  308. player.getInventory().setItemInMainHand(spr);
  309. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  310. e.getDrops().clear();
  311. e.setDroppedExp(0);
  312. }else if (killed.getType().equals(EntityType.OCELOT)) {
  313. player.sendMessage(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "You caught Ocelot's soul!");
  314. player.getInventory().setItemInMainHand(spo);
  315. player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  316. e.getDrops().clear();
  317. e.setDroppedExp(0);
  318. } else {
  319. player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "This mob's soul cannot be taken." );
  320. player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "1. His soul cannot be taken because it is too op! Or" );
  321. player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "2. The developer was lazy and forgot about this mob..." );
  322. player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "He will fix it in next update (maybe...)" );
  323. }
  324. }
  325. }
  326. }
  327. }
  328. //Summon System
  329. @EventHandler
  330. public void onPlayerInteract(PlayerInteractEvent e) {
  331. Player player = e.getPlayer();
  332. ItemStack SoulCatcher = new ItemStack(Material.GLASS_BOTTLE, 1);
  333. ItemMeta im2 = SoulCatcher.getItemMeta();
  334. im2.setDisplayName(ChatColor.BOLD + "" + ChatColor.AQUA + "Soul Catcher");
  335. im2.setLore(Arrays.asList(ChatColor.GOLD + "Kill mob with this item",ChatColor.GOLD + "to catch his souls!", ""));
  336. SoulCatcher.setItemMeta(im2);
  337. ItemStack broken = new ItemStack(Material.GLASS_BOTTLE, 1);
  338. ItemMeta im3 = broken.getItemMeta();
  339. im3.setDisplayName(ChatColor.BOLD + "" + ChatColor.GRAY + "Broken Soul Catcher");
  340. im3.setLore(Arrays.asList(ChatColor.GOLD + "Use /howtofix",ChatColor.GOLD + "to learn how to fix the", ChatColor.GOLD + "Soul Catcher!"));
  341. broken.setItemMeta(im3);
  342. Random rand = new Random();
  343.  
  344. int n = rand.nextInt(100) + 1;
  345. if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
  346. if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
  347. if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName() != null) {
  348. if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Cow's Soul")) {
  349. if (n<=50) {
  350. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.COW);
  351. player.getInventory().setItemInMainHand(broken);
  352. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  353. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  354. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  355. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  356. }else {
  357. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.COW);
  358. player.getInventory().setItemInMainHand(SoulCatcher);
  359. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  360. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  361. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  362. }
  363. } else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Pig's Soul")) {
  364. if (n<=50) {
  365. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.PIG);
  366. player.getInventory().setItemInMainHand(broken);
  367. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  368. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  369. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  370. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  371. }else {
  372. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.PIG);
  373. player.getInventory().setItemInMainHand(SoulCatcher);
  374. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  375. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  376. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  377. }
  378. }
  379. else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Skeleton's Soul")) {
  380. if (n<=50) {
  381. player.getInventory().setItemInMainHand(broken);
  382. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  383. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  384. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  385. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  386. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.SKELETON);
  387. }else {
  388. player.getInventory().setItemInMainHand(SoulCatcher);
  389. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  390. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  391. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  392. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.SKELETON);
  393. }
  394. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Zombie's Soul")) {
  395. if (n<=50) {
  396. player.getInventory().setItemInMainHand(broken);
  397. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  398. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  399. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  400. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  401. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.ZOMBIE);
  402. }else {
  403. player.getInventory().setItemInMainHand(SoulCatcher);
  404. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  405. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  406. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  407. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.ZOMBIE);
  408. }
  409. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Creeper's Soul")) {
  410. if (n<=50) {
  411. player.getInventory().setItemInMainHand(broken);
  412. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  413. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  414. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  415. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  416. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.CREEPER);
  417. }else {
  418. player.getInventory().setItemInMainHand(SoulCatcher);
  419. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  420. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  421. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  422. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.CREEPER);
  423. }
  424. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "EnderMan's Soul")) {
  425. if (n<=50) {
  426. player.getInventory().setItemInMainHand(broken);
  427. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  428. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  429. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  430. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  431. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.ENDERMAN);
  432. }else {
  433. player.getInventory().setItemInMainHand(SoulCatcher);
  434. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  435. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  436. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  437. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.ENDERMAN);
  438. }
  439. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Spider's Soul")) {
  440. if (n<=50) {
  441. player.getInventory().setItemInMainHand(broken);
  442. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  443. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  444. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  445. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  446. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.SPIDER);
  447. }else {
  448. player.getInventory().setItemInMainHand(SoulCatcher);
  449. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  450. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  451. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  452. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.SPIDER);
  453. }
  454. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Squid's Soul")) {
  455. if (n<=50) {
  456. player.getInventory().setItemInMainHand(broken);
  457. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  458. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  459. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  460. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  461. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.SQUID);
  462. }else {
  463. player.getInventory().setItemInMainHand(SoulCatcher);
  464. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  465. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  466. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  467. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.SQUID);
  468. }
  469. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Wolf's Soul")) {
  470. if (n<=50) {
  471. player.getInventory().setItemInMainHand(broken);
  472. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  473. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  474. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  475. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  476. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.WOLF);
  477. }else {
  478. player.getInventory().setItemInMainHand(SoulCatcher);
  479. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  480. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  481. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  482. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.WOLF);
  483. }
  484. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Chicken's Soul")) {
  485. if (n<=50) {
  486. player.getInventory().setItemInMainHand(broken);
  487. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  488. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  489. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  490. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  491. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.CHICKEN);
  492. }else {
  493. player.getInventory().setItemInMainHand(SoulCatcher);
  494. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  495. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  496. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  497. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.CHICKEN);
  498. }
  499. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Blaze's Soul")) {
  500. if (n<=50) {
  501. player.getInventory().setItemInMainHand(broken);
  502. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  503. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  504. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  505. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  506. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 1, 0), EntityType.BLAZE);
  507. }else {
  508. player.getInventory().setItemInMainHand(SoulCatcher);
  509. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  510. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  511. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  512. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 1, 0), EntityType.BLAZE);
  513. }
  514. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Llama's Soul")) {
  515. if (n<=50) {
  516. player.getInventory().setItemInMainHand(broken);
  517. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  518. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  519. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  520. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  521. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.LLAMA);
  522. }else {
  523. player.getInventory().setItemInMainHand(SoulCatcher);
  524. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  525. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  526. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  527. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.LLAMA);
  528. }
  529. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Rabbit's Soul")) {
  530. if (n<=50) {
  531. player.getInventory().setItemInMainHand(broken);
  532. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  533. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  534. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  535. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  536. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.RABBIT);
  537. }else {
  538. player.getInventory().setItemInMainHand(SoulCatcher);
  539. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  540. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  541. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  542. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.RABBIT);
  543. }
  544. }else if (player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.BOLD + "" + ChatColor.LIGHT_PURPLE + "Ocelot's Soul")) {
  545. if (n<=50) {
  546. player.getInventory().setItemInMainHand(broken);
  547. player.playSound(player.getLocation(), Sound.ENTITY_SPLASH_POTION_BREAK, 2F, 1F);
  548. player.sendMessage(ChatColor.RED + "You were unlucky, you broke the Soul Catcher!");
  549. player.sendMessage(ChatColor.RED + "Remember, you have 50% to break the Soul Catcher.");
  550. player.sendMessage(ChatColor.RED + "Use /howtofix to learn how to fix the SoulCatcher!");
  551. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.OCELOT);
  552. }else {
  553. player.getInventory().setItemInMainHand(SoulCatcher);
  554. player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2F, 1F);
  555. player.sendMessage(ChatColor.GOLD + "You were lucky, you didn't broke the Soul Catcher!");
  556. player.sendMessage(ChatColor.GOLD + "But remember, you have 50% to break the Soul Catcher.");
  557. player.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0, 2, 0), EntityType.OCELOT);
  558. }
  559. }
  560. }
  561. }
  562. }
  563. }
  564. //Commands
  565. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  566. if (cmd.getName().equals("soul")) {
  567. if (sender instanceof Player) {
  568. Player player = (Player) sender;
  569. if (player.hasPermission("soulcatcher.commands")) {
  570. ItemStack SoulCatcher = new ItemStack(Material.GLASS_BOTTLE, 1);
  571. ItemMeta im2 = SoulCatcher.getItemMeta();
  572. im2.setDisplayName(ChatColor.BOLD + "" + ChatColor.AQUA + "Soul Catcher");
  573. im2.setLore(Arrays.asList(ChatColor.GOLD + "Kill mob with this item",ChatColor.GOLD + "to catch his souls!", ""));
  574. SoulCatcher.setItemMeta(im2);
  575. player.getInventory().addItem(SoulCatcher);
  576. }
  577. }
  578. }
  579. return false;
  580. }
  581. }
Advertisement
Add Comment
Please, Sign In to add comment