Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.14 KB | None | 0 0
  1. package me.AopAndDie.Main;
  2. import java.util.ArrayList;
  3. import java.util.concurrent.ThreadLocalRandom;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.Sound;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.inventory.ItemStack;
  10. import org.bukkit.plugin.Plugin;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13. import net.md_5.bungee.api.ChatColor;
  14.  
  15. import org.bukkit.event.EventHandler;
  16. import org.bukkit.event.block.Action;
  17. import org.bukkit.event.entity.EntityDamageByEntityEvent;
  18. import org.bukkit.event.player.PlayerInteractEvent;
  19. import org.bukkit.potion.PotionEffect;
  20. import org.bukkit.potion.PotionEffectType;
  21.  
  22. public class Main
  23. extends JavaPlugin
  24. implements Listener
  25. {
  26. private static final String attacker = null;
  27. public static Plugin getPlugin;
  28. private ArrayList<String> cooldown = new ArrayList<String>();
  29.  
  30. public void onEnable()
  31. {
  32. getPlugin = this;
  33. Bukkit.getPluginManager().registerEvents(this, this);
  34. }
  35.  
  36. static String Translate(String text) {
  37. return ChatColor.translateAlternateColorCodes('&', text);
  38. }
  39.  
  40. public static boolean hasEnchant(Player player, String containsLore) {
  41. for(ItemStack is : player.getInventory().getArmorContents()) {
  42. if(is.hasItemMeta() && is.getItemMeta().getLore() != null) {
  43. for(String s : is.getItemMeta().getLore()) {
  44. if(s.contains(Translate(containsLore))) {
  45. return true;
  46. }
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. public boolean hasLore(ItemStack item, String lore) {
  53. if (item!=null) {
  54. if (item.hasItemMeta()) {
  55. if (item.getItemMeta().hasLore()) {
  56. if (item.getItemMeta().getLore().contains(lore)) {
  57. return true;
  58. }
  59. }
  60. }
  61. }
  62. return false;
  63.  
  64. }
  65.  
  66. Integer chance = 100;
  67.  
  68. @EventHandler
  69. public void mortalCoil(EntityDamageByEntityEvent e) {
  70. if (e.getEntity() instanceof Player) { //if victim is player
  71. final Player victim = (Player) e.getEntity(); //victim == the victim
  72. final Player attacker = (Player) e.getDamager();
  73. ItemStack helm = attacker.getInventory().getHelmet();
  74. if (helm != null) {
  75. if (helm.hasItemMeta()) {
  76. if (helm.getItemMeta().hasLore()) {
  77. ItemStack helm2 = victim.getInventory().getHelmet();
  78. if (helm2.hasItemMeta()) {
  79.  
  80. if (helm2.getItemMeta().hasLore()) {
  81.  
  82.  
  83. if (helm.getItemMeta().getLore().contains(Translate("&4Mortal Coil I"))) {
  84. if (ThreadLocalRandom.current().nextInt(101) <= chance) { //101 = 100, 99 = 98, 100 = 99
  85. if (victim.hasPotionEffect(PotionEffectType.HEALTH_BOOST)) {
  86. victim.removePotionEffect(PotionEffectType.HEALTH_BOOST);
  87. victim.sendMessage(Translate("&c&l* MORTAL COIL (&7" + attacker.getName() + " &7[2s]&c&l) *"));
  88. Bukkit.getScheduler().runTaskLater(this, new Runnable() {
  89. public void run() {
  90. if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload I"))) {
  91. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 5));
  92. }
  93. else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload II"))) {
  94. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 6));
  95. }
  96. else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload III"))) {
  97. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 7));
  98. }
  99. else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload II"))) {
  100. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 8));
  101. }
  102. else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload Ii"))) {
  103. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 9));
  104. }
  105. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload I"))) {
  106. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 2));
  107. }
  108. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload II"))) {
  109. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 3));
  110. }
  111. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload III"))) {
  112. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 4));
  113. }
  114. }
  115. }, 40L); //20L = 1 second, so 80L = 4 seconds.
  116.  
  117. if (helm.getItemMeta().getLore().contains(Translate("&4Mortal Coil I"))) {
  118. Integer chance = 100;
  119. if (ThreadLocalRandom.current().nextInt(101) <= chance) { //101 = 100, 99 = 98, 100 = 99
  120. if (victim.hasPotionEffect(PotionEffectType.HEALTH_BOOST)) {
  121. victim.removePotionEffect(PotionEffectType.HEALTH_BOOST);
  122. victim.sendMessage(Translate("&c&l* MORTAL COIL (&7" + attacker.getName() + " &7[3s]&c&l) *"));
  123. Bukkit.getScheduler().runTaskLater(this, new Runnable() {
  124. public void run() {
  125. if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload I"))) {
  126. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 5));
  127. }
  128. else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload II"))) {
  129. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 6));
  130. }
  131. else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload III"))) {
  132. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 7));
  133. }
  134. else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload II"))) {
  135. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 8));
  136. }
  137. else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload Ii"))) {
  138. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 9));
  139. }
  140. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload I"))) {
  141. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 2));
  142. }
  143. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload II"))) {
  144. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 3));
  145. }
  146. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload III"))) {
  147. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 4));
  148. }
  149. }
  150.  
  151. }, 60L); //20L = 1 second, so 80L = 4 seconds.
  152. }
  153. }
  154.  
  155. }
  156. if (helm.getItemMeta().getLore().contains(Translate("&4Mortal Coil I"))) {
  157. Integer chance = 100;
  158. if (ThreadLocalRandom.current().nextInt(101) <= chance) { //101 = 100 = 99 = 98 = 97
  159. if (victim.hasPotionEffect(PotionEffectType.HEALTH_BOOST)) {
  160. victim.removePotionEffect(PotionEffectType.HEALTH_BOOST);
  161. String name = attacker.getName();
  162. victim.sendMessage(Translate("&c&l* MORTAL COIL (&7" + name + " &7[4s]&c&l) *"));
  163. Bukkit.getScheduler().runTaskLater(this, new Runnable() {
  164. public void run() {
  165. if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload I"))) {
  166. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 5));
  167. }
  168. else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload II"))) {
  169. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 6));
  170. }
  171. else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload III"))) {
  172. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 7));
  173. }
  174. else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload II"))) {
  175. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 8));
  176. }
  177. else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload Ii"))) {
  178. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 9));
  179. }
  180. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload I"))) {
  181. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 2));
  182. }
  183. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload II"))) {
  184. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 3));
  185. }
  186. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload III"))) {
  187. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 4));
  188. }
  189. }
  190. }, 80L); //20L = 1 second, so 80L = 4 seconds
  191.  
  192. }
  193. }
  194. }
  195. if (helm.getItemMeta().getLore().contains(Translate("&4Mortal Coil I"))) {
  196. Integer chance1 = 100;
  197. if (ThreadLocalRandom.current().nextInt(101) <= chance1) { //101 = 100, 99 = 98, 100 = 99
  198. if (victim.hasPotionEffect(PotionEffectType.HEALTH_BOOST)) {
  199. victim.removePotionEffect(PotionEffectType.HEALTH_BOOST);
  200. String name = attacker.getName();
  201. victim.sendMessage(Translate("&c&l* MORTAL COIL (&7" + attacker.getName() + " &7[5s]&c&l) *"));
  202. Bukkit.getScheduler().runTaskLater(this, new Runnable() {
  203. public void run() {
  204. if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload I"))) {
  205. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 5));
  206. }
  207. else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload II"))) {
  208. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 6));
  209. }
  210. else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload III"))) {
  211. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 7));
  212. }
  213. else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload II"))) {
  214. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 8));
  215. }
  216. else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload Ii"))) {
  217. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 9));
  218. }
  219. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload I"))) {
  220. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 2));
  221. }
  222. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload II"))) {
  223. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 3));
  224. }
  225. else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload III"))) {
  226. victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 4));
  227. }
  228. }
  229. }, 100L); //20L = 1 second, so 80L = 4 seconds.
  230. }
  231. }
  232. }
  233. }
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241. }
  242. }
  243.  
  244. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement