Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.AopAndDie.Main;
- import java.util.ArrayList;
- import java.util.concurrent.ThreadLocalRandom;
- import org.bukkit.Bukkit;
- import org.bukkit.Sound;
- import org.bukkit.entity.Player;
- import org.bukkit.event.Listener;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- import net.md_5.bungee.api.ChatColor;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.entity.EntityDamageByEntityEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class Main
- extends JavaPlugin
- implements Listener
- {
- private static final String attacker = null;
- public static Plugin getPlugin;
- private ArrayList<String> cooldown = new ArrayList<String>();
- public void onEnable()
- {
- getPlugin = this;
- Bukkit.getPluginManager().registerEvents(this, this);
- }
- static String Translate(String text) {
- return ChatColor.translateAlternateColorCodes('&', text);
- }
- public static boolean hasEnchant(Player player, String containsLore) {
- for(ItemStack is : player.getInventory().getArmorContents()) {
- if(is.hasItemMeta() && is.getItemMeta().getLore() != null) {
- for(String s : is.getItemMeta().getLore()) {
- if(s.contains(Translate(containsLore))) {
- return true;
- }
- }
- }
- }
- return false;
- }
- public boolean hasLore(ItemStack item, String lore) {
- if (item!=null) {
- if (item.hasItemMeta()) {
- if (item.getItemMeta().hasLore()) {
- if (item.getItemMeta().getLore().contains(lore)) {
- return true;
- }
- }
- }
- }
- return false;
- }
- Integer chance = 100;
- @EventHandler
- public void mortalCoil(EntityDamageByEntityEvent e) {
- if (e.getEntity() instanceof Player) { //if victim is player
- final Player victim = (Player) e.getEntity(); //victim == the victim
- final Player attacker = (Player) e.getDamager();
- ItemStack helm = attacker.getInventory().getHelmet();
- if (helm != null) {
- if (helm.hasItemMeta()) {
- if (helm.getItemMeta().hasLore()) {
- ItemStack helm2 = victim.getInventory().getHelmet();
- if (helm2.hasItemMeta()) {
- if (helm2.getItemMeta().hasLore()) {
- if (helm.getItemMeta().getLore().contains(Translate("&4Mortal Coil I"))) {
- if (ThreadLocalRandom.current().nextInt(101) <= chance) { //101 = 100, 99 = 98, 100 = 99
- if (victim.hasPotionEffect(PotionEffectType.HEALTH_BOOST)) {
- victim.removePotionEffect(PotionEffectType.HEALTH_BOOST);
- victim.sendMessage(Translate("&c&l* MORTAL COIL (&7" + attacker.getName() + " &7[2s]&c&l) *"));
- Bukkit.getScheduler().runTaskLater(this, new Runnable() {
- public void run() {
- if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload I"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 5));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 6));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload III"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 7));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 8));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload Ii"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 9));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload I"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 2));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 3));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload III"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 4));
- }
- }
- }, 40L); //20L = 1 second, so 80L = 4 seconds.
- if (helm.getItemMeta().getLore().contains(Translate("&4Mortal Coil I"))) {
- Integer chance = 100;
- if (ThreadLocalRandom.current().nextInt(101) <= chance) { //101 = 100, 99 = 98, 100 = 99
- if (victim.hasPotionEffect(PotionEffectType.HEALTH_BOOST)) {
- victim.removePotionEffect(PotionEffectType.HEALTH_BOOST);
- victim.sendMessage(Translate("&c&l* MORTAL COIL (&7" + attacker.getName() + " &7[3s]&c&l) *"));
- Bukkit.getScheduler().runTaskLater(this, new Runnable() {
- public void run() {
- if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload I"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 5));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 6));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload III"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 7));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 8));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload Ii"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 9));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload I"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 2));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 3));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload III"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 4));
- }
- }
- }, 60L); //20L = 1 second, so 80L = 4 seconds.
- }
- }
- }
- if (helm.getItemMeta().getLore().contains(Translate("&4Mortal Coil I"))) {
- Integer chance = 100;
- if (ThreadLocalRandom.current().nextInt(101) <= chance) { //101 = 100 = 99 = 98 = 97
- if (victim.hasPotionEffect(PotionEffectType.HEALTH_BOOST)) {
- victim.removePotionEffect(PotionEffectType.HEALTH_BOOST);
- String name = attacker.getName();
- victim.sendMessage(Translate("&c&l* MORTAL COIL (&7" + name + " &7[4s]&c&l) *"));
- Bukkit.getScheduler().runTaskLater(this, new Runnable() {
- public void run() {
- if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload I"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 5));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 6));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload III"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 7));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 8));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload Ii"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 9));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload I"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 2));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 3));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload III"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 4));
- }
- }
- }, 80L); //20L = 1 second, so 80L = 4 seconds
- }
- }
- }
- if (helm.getItemMeta().getLore().contains(Translate("&4Mortal Coil I"))) {
- Integer chance1 = 100;
- if (ThreadLocalRandom.current().nextInt(101) <= chance1) { //101 = 100, 99 = 98, 100 = 99
- if (victim.hasPotionEffect(PotionEffectType.HEALTH_BOOST)) {
- victim.removePotionEffect(PotionEffectType.HEALTH_BOOST);
- String name = attacker.getName();
- victim.sendMessage(Translate("&c&l* MORTAL COIL (&7" + attacker.getName() + " &7[5s]&c&l) *"));
- Bukkit.getScheduler().runTaskLater(this, new Runnable() {
- public void run() {
- if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload I"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 5));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 6));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&dGodly Overload III"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 7));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 8));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&5Phoenix Overload Ii"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 9));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload I"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 2));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload II"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 3));
- }
- else if (helm2.getItemMeta().getLore().contains(Translate("&6Overload III"))) {
- victim.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 4000000, 4));
- }
- }
- }, 100L); //20L = 1 second, so 80L = 4 seconds.
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement