danik159

Untitled

Jul 24th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.64 KB | None | 0 0
  1. package com.junkstyle.chicken;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.Location;
  8. import org.bukkit.Material;
  9. import org.bukkit.Sound;
  10. import org.bukkit.block.Block;
  11. import org.bukkit.entity.LightningStrike;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.event.EventHandler;
  14. import org.bukkit.event.Listener;
  15. import org.bukkit.event.block.Action;
  16. import org.bukkit.event.entity.EntityDamageByEntityEvent;
  17. import org.bukkit.event.player.PlayerInteractEvent;
  18. import org.bukkit.inventory.ItemStack;
  19. import org.bukkit.inventory.ShapedRecipe;
  20. import org.bukkit.inventory.meta.ItemMeta;
  21. import org.bukkit.inventory.meta.SkullMeta;
  22. import org.bukkit.plugin.java.JavaPlugin;
  23. import org.bukkit.potion.PotionEffect;
  24. import org.bukkit.potion.PotionEffectType;
  25.  
  26. import net.md_5.bungee.api.ChatColor;
  27.  
  28. public class Main extends JavaPlugin implements Listener {
  29. @SuppressWarnings("deprecation")
  30. public void onEnable() {
  31. Bukkit.getPluginManager().registerEvents(this, this);
  32.  
  33. ItemStack lseed = new ItemStack(Material.SEEDS);
  34. ItemMeta lmeta = lseed.getItemMeta();
  35. lmeta.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "LEGENDARY SEED");
  36. ArrayList<String> lore = new ArrayList<String>();
  37. lore.add(ChatColor.LIGHT_PURPLE + "Use this item to transform into chicken man!");
  38. lmeta.setLore(lore);
  39. lseed.setItemMeta(lmeta);
  40.  
  41. ShapedRecipe lseedc = new ShapedRecipe(lseed);
  42. lseedc.shape("$$$", "$@$", "$$$");
  43. lseedc.setIngredient('@', Material.NETHER_STAR);
  44. lseedc.setIngredient('$', Material.SEEDS);
  45. getServer().addRecipe(lseedc);
  46. ItemStack skull = new ItemStack(397, 1, (short) 3);
  47. SkullMeta meta = (SkullMeta) skull.getItemMeta();
  48. meta.setOwner("Junkstyle");
  49. skull.setItemMeta(meta);
  50. meta.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "Chicken's Man Head's");
  51. skull.setItemMeta(meta);
  52.  
  53.  
  54. }
  55.  
  56.  
  57. HashMap<Player, Long> cooldown = new HashMap<>();
  58. @SuppressWarnings("deprecation")
  59. @EventHandler
  60. public void onClick(PlayerInteractEvent e) {
  61. if(e.getAction() == Action.LEFT_CLICK_BLOCK) {
  62. if (e.getClickedBlock().getType().equals(Material.GOLD_BLOCK)) {
  63.  
  64. Player player = e.getPlayer();
  65. Location ploc = player.getLocation();
  66. Block block = ploc.getBlock();
  67. //Custom Items
  68. //Custom Head
  69. ItemStack skull = new ItemStack(397, 1, (short) 3);
  70. SkullMeta meta = (SkullMeta) skull.getItemMeta();
  71. meta.setOwner("Junkstyle");
  72. skull.setItemMeta(meta);
  73. meta.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "Chicken's Man Head's");
  74.  
  75. //Legendary Seed
  76. ItemStack lseed = new ItemStack(Material.SEEDS);
  77. ItemMeta lmeta = lseed.getItemMeta();
  78. lmeta.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "LEGENDARY SEED");
  79. ArrayList<String> lore1 = new ArrayList<String>();
  80. lore1.add(ChatColor.LIGHT_PURPLE + "Use this item to transform into chicken man!");
  81. lmeta.setLore(lore1);
  82. lseed.setItemMeta(lmeta);
  83.  
  84. ItemStack fea1 = new ItemStack(Material.FEATHER);
  85. ItemMeta lmeta1 = fea1.getItemMeta();
  86. lmeta1.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "You are free!");
  87. ArrayList<String> lore32 = new ArrayList<String>();
  88. lore32.add(ChatColor.LIGHT_PURPLE + "Click left click or right to get levitation!");
  89. lmeta1.setLore(lore32);
  90. fea1.setItemMeta(lmeta1);
  91.  
  92. ItemStack jum = new ItemStack(Material.QUARTZ);
  93. ItemMeta lmet = jum.getItemMeta();
  94. lmet.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "Hm, Jump like a cangaroo!");
  95. ArrayList<String> lore12 = new ArrayList<String>();
  96. lore12.add(ChatColor.LIGHT_PURPLE + "Click left or right click to get jump boost!");
  97. lmet.setLore(lore12);
  98. jum.setItemMeta(lmet);
  99.  
  100. ItemStack str = new ItemStack(Material.BLAZE_POWDER);
  101. ItemMeta lmet1 = str.getItemMeta();
  102. lmet1.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "Chicken is powerful!");
  103. ArrayList<String> lore2 = new ArrayList<String>();
  104. lore2.add(ChatColor.LIGHT_PURPLE + "Click left or right click to get super power!");
  105. lmet1.setLore(lore2);
  106. str.setItemMeta(lmet1);
  107. lmet1.setUnbreakable(true);
  108.  
  109. Block block2 = block.getRelative(0, -1, 0); // gold
  110. Block block3 = block.getRelative(1, -1, 0); // stairs
  111. Block block4 = block.getRelative(-1, -1, 0);// stairs
  112. Block block5 = block.getRelative(0, -1, 1);// stairs
  113. Block block6 = block.getRelative(0, -1, -1);// stairs
  114. Block block7 = block.getRelative(1, -1, 1); // end rod
  115. Block block8 = block.getRelative(1, -1, -1);// end rod
  116. Block block9 = block.getRelative(-1, -1, 1);// end rod
  117. Block block10 = block.getRelative(-1, -1, -1);// end rod
  118. Block block11 = block.getRelative(1, 0, 1);// end rod
  119. Block block12 = block.getRelative(1, 0, -1);// end rod
  120. Block block13 = block.getRelative(-1, 0, 1);// end rod
  121. Block block14 = block.getRelative(-1, 0, -1);// end rod
  122. Block block15 = block.getRelative(1, 1, 1); // sea shit
  123. Block block16 = block.getRelative(1, 1, -1);// sea shit
  124. Block block17 = block.getRelative(-1, 1, 1);// sea shit
  125. Block block18 = block.getRelative(-1, 1, -1);// sea shit
  126. if (block2.getType() == Material.GOLD_BLOCK &&
  127. block3.getType() == Material.QUARTZ_STAIRS &&
  128. block4.getType() == Material.QUARTZ_STAIRS &&
  129. block5.getType() == Material.QUARTZ_STAIRS &&
  130. block6.getType() == Material.QUARTZ_STAIRS &&
  131. block7.getType() == Material.END_ROD &&
  132. block8.getType() == Material.END_ROD &&
  133. block9.getType() == Material.END_ROD &&
  134. block10.getType() == Material.END_ROD &&
  135. block11.getType() == Material.END_ROD &&
  136. block12.getType() == Material.END_ROD &&
  137. block13.getType() == Material.END_ROD &&
  138. block14.getType() == Material.END_ROD &&
  139. block15.getType() == Material.SEA_LANTERN &&
  140. block16.getType() == Material.SEA_LANTERN &&
  141. block17.getType() == Material.SEA_LANTERN &&
  142. block18.getType() == Material.SEA_LANTERN ) {
  143.  
  144.  
  145. if (player.getInventory().contains(skull)) {
  146. player.sendMessage(ChatColor.GOLD + "You are already super mega extra duper super Chicken Man!");
  147. }
  148. if (player.getInventory().getHelmet() != null ) {
  149. player.sendMessage(ChatColor.RED + "Please remove your armor before using the temple!");
  150. } else {
  151. if (player.getInventory().getItemInMainHand().isSimilar(lseed)) {
  152. if (player.getInventory().getItemInMainHand().getAmount() < 2) {
  153. player.getInventory().remove(lseed);
  154. player.getInventory().setHelmet(skull);
  155. player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION,200,3));
  156. player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS,200,3));
  157. player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,200,3));
  158. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,200,3));
  159. player.playSound(ploc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 2f, 1f);
  160. player.getInventory().addItem(fea1);
  161. player.getInventory().addItem(str);
  162. player.getInventory().addItem(jum);
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169. } else {
  170. player.sendMessage(ChatColor.RED + "To use the temple, put 1 Legendary Seed Into your hand!");
  171. }
  172. }else {
  173. player.sendMessage(ChatColor.RED + "You have to handle legendary seed in main hand!");
  174. player.sendMessage(ChatColor.RED + "to transform into Chicken Man!");
  175.  
  176. }
  177.  
  178.  
  179.  
  180.  
  181.  
  182. }
  183.  
  184. }
  185.  
  186.  
  187.  
  188. }
  189. } else {
  190. Player player = (Player) e.getPlayer();
  191. ItemStack fea1 = new ItemStack(Material.FEATHER);
  192. ItemMeta lmeta1 = fea1.getItemMeta();
  193. lmeta1.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "You are free!");
  194. ArrayList<String> lore32 = new ArrayList<String>();
  195. lore32.add(ChatColor.LIGHT_PURPLE + "Click left click or right to get levitation!");
  196. lmeta1.setLore(lore32);
  197. fea1.setItemMeta(lmeta1);
  198.  
  199. ItemStack jum = new ItemStack(Material.QUARTZ);
  200. ItemMeta lmet = jum.getItemMeta();
  201. lmet.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "Hm, Jump like a cangaroo!");
  202. ArrayList<String> lore12 = new ArrayList<String>();
  203. lore12.add(ChatColor.LIGHT_PURPLE + "Click left or right click to get jump boost!");
  204. lmet.setLore(lore12);
  205. jum.setItemMeta(lmet);
  206.  
  207. ItemStack str = new ItemStack(Material.BLAZE_POWDER);
  208. ItemMeta lmet1 = str.getItemMeta();
  209. lmet1.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "Chicken is powerful!");
  210. ArrayList<String> lore2 = new ArrayList<String>();
  211. lore2.add(ChatColor.LIGHT_PURPLE + "Click left or right click to get super power!");
  212. lmet1.setLore(lore2);
  213. str.setItemMeta(lmet1);
  214. lmet1.setUnbreakable(true);
  215.  
  216.  
  217. // power
  218. if (player.getInventory().getItemInMainHand().isSimilar(str)) {
  219. if (player.getHealth() > 8) {
  220. if (!player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
  221. if (!player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
  222. player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,400,0));
  223. player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,400,1));
  224. int playerh = (int) (player.getHealth() - 8);
  225. player.setHealth(playerh);
  226.  
  227.  
  228. } else {
  229. player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
  230. player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,400,1));
  231. player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
  232. player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,400,0));
  233. int playerh = (int) (player.getHealth() - 8);
  234. player.setHealth(playerh);
  235. }
  236. } else {
  237. player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
  238. player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,140,1));
  239. player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
  240. player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,140,0));
  241. int playerh = (int) (player.getHealth() - 8);
  242. player.setHealth(playerh);
  243.  
  244. }
  245. } else if (player.getHealth() <= 8) {
  246. player.sendMessage(ChatColor.RED + "you cannot use this skill, because your hp is very low!");
  247. }
  248.  
  249.  
  250.  
  251. }
  252. //fea
  253. if (player.getInventory().getItemInMainHand().isSimilar(fea1)) {
  254. if (player.getHealth() > 2) {
  255. if (!player.hasPotionEffect(PotionEffectType.LEVITATION)) {
  256. player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,60,2));
  257. int playerh = (int) (player.getHealth() - 2);
  258. player.setHealth(playerh);
  259.  
  260.  
  261. } else {
  262. player.removePotionEffect(PotionEffectType.LEVITATION);
  263. player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,60,2));
  264. int playerh = (int) (player.getHealth() - 2);
  265. player.setHealth(playerh);
  266. }
  267. } else if (player.getHealth() <= 2) {
  268. player.sendMessage(ChatColor.RED + "you cannot use this skill, because your hp is very low!");
  269.  
  270. }
  271. }
  272.  
  273.  
  274.  
  275.  
  276. //Cangaroo
  277. if (player.getInventory().getItemInMainHand().isSimilar(jum)) {
  278. if (player.getHealth() > 6) {
  279. if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
  280. if (!player.hasPotionEffect(PotionEffectType.SPEED)) {
  281. player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,220,2));
  282. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,220,1));
  283. int playerh = (int) (player.getHealth() - 6);
  284. player.setHealth(playerh);
  285.  
  286.  
  287. } else {
  288. player.removePotionEffect(PotionEffectType.SPEED);
  289. player.removePotionEffect(PotionEffectType.JUMP);
  290. player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,220,2));
  291. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,220,1));
  292. int playerh = (int) (player.getHealth() - 6);
  293. player.setHealth(playerh);
  294. }
  295. } else {
  296. player.removePotionEffect(PotionEffectType.SPEED);
  297. player.removePotionEffect(PotionEffectType.JUMP);
  298. player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,220,2));
  299. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,220,1));
  300. int playerh = (int) (player.getHealth() - 6);
  301. player.setHealth(playerh);
  302.  
  303. }
  304. } else if (player.getHealth() <= 6) {
  305. player.sendMessage(ChatColor.RED + "you cannot use this skill, because your hp is very low!");
  306. }
  307. }
  308. }
  309.  
  310.  
  311. }
  312.  
  313.  
  314. @EventHandler
  315. public void lightningdamage(EntityDamageByEntityEvent event) {
  316. if(event.getDamager() instanceof LightningStrike){
  317. event.setDamage(0);
  318. }
  319. }
  320. }
Add Comment
Please, Sign In to add comment