|
|
@ -9398,6 +9398,32 @@ implements Listener |
|
|
|
|
|
|
|
|
|
|
|
if (e.getEntity() instanceof LivingEntity) { |
|
|
|
if (e.getEntity() instanceof LivingEntity) { |
|
|
|
final LivingEntity l = (LivingEntity)e.getEntity(); |
|
|
|
final LivingEntity l = (LivingEntity)e.getEntity(); |
|
|
|
|
|
|
|
if (e.getDamager() instanceof Projectile) { |
|
|
|
|
|
|
|
if (((Projectile)e.getDamager()).getShooter() instanceof LivingEntity) { |
|
|
|
|
|
|
|
LivingEntity l2 = ((Projectile)e.getDamager()).getShooter(); |
|
|
|
|
|
|
|
for (int i=0;i<this.plugin.powered_mob_list.size();i++) { |
|
|
|
|
|
|
|
if (this.plugin.powered_mob_list.get(i).id.equals(l2.getUniqueId())) { |
|
|
|
|
|
|
|
//This mob will damage you if you are not blocking.
|
|
|
|
|
|
|
|
if (l instanceof Player) { |
|
|
|
|
|
|
|
Player p = (Player)l; |
|
|
|
|
|
|
|
if (!p.isBlocking()) { |
|
|
|
|
|
|
|
if (p.getHealth()-e.getDamage()*4<0) { |
|
|
|
|
|
|
|
p.setHealth(0); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
p.setHealth(p.getHealth()-e.getDamage()*4); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Main.playFirework(p.getLocation()); |
|
|
|
|
|
|
|
Main.playFirework(p.getLocation()); |
|
|
|
|
|
|
|
Main.playFirework(p.getLocation()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.plugin.powered_mob_list.remove(i); |
|
|
|
|
|
|
|
i--; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (e.getDamager() instanceof LivingEntity) { |
|
|
|
if (e.getDamager() instanceof LivingEntity) { |
|
|
|
LivingEntity l2 = (LivingEntity)e.getDamager(); |
|
|
|
LivingEntity l2 = (LivingEntity)e.getDamager(); |
|
|
|
for (int i=0;i<this.plugin.powered_mob_list.size();i++) { |
|
|
|
for (int i=0;i<this.plugin.powered_mob_list.size();i++) { |
|
|
@ -9406,10 +9432,10 @@ implements Listener |
|
|
|
if (l instanceof Player) { |
|
|
|
if (l instanceof Player) { |
|
|
|
Player p = (Player)l; |
|
|
|
Player p = (Player)l; |
|
|
|
if (!p.isBlocking()) { |
|
|
|
if (!p.isBlocking()) { |
|
|
|
if (p.getHealth()-e.getDamage()<0) { |
|
|
|
if (p.getHealth()-e.getDamage()*2<0) { |
|
|
|
p.setHealth(0); |
|
|
|
p.setHealth(0); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
p.setHealth(p.getHealth()-e.getDamage()); |
|
|
|
p.setHealth(p.getHealth()-e.getDamage()*2); |
|
|
|
} |
|
|
|
} |
|
|
|
Main.playFirework(p.getLocation()); |
|
|
|
Main.playFirework(p.getLocation()); |
|
|
|
Main.playFirework(p.getLocation()); |
|
|
|
Main.playFirework(p.getLocation()); |
|
|
@ -10892,7 +10918,7 @@ implements Listener |
|
|
|
if (p.getEquipment().getLeggings()!=null) {legs_dura=p.getEquipment().getLeggings().getDurability();} |
|
|
|
if (p.getEquipment().getLeggings()!=null) {legs_dura=p.getEquipment().getLeggings().getDurability();} |
|
|
|
if (p.getEquipment().getBoots()!=null) {boots_dura=p.getEquipment().getBoots().getDurability();} |
|
|
|
if (p.getEquipment().getBoots()!=null) {boots_dura=p.getEquipment().getBoots().getDurability();} |
|
|
|
final int prev_helm_dura=helm_dura,prev_chest_dura=chest_dura,prev_legs_dura=legs_dura,prev_boots_dura=boots_dura; |
|
|
|
final int prev_helm_dura=helm_dura,prev_chest_dura=chest_dura,prev_legs_dura=legs_dura,prev_boots_dura=boots_dura; |
|
|
|
if (p.getNoDamageTicks()<p.getMaximumNoDamageTicks()/2.0f) { |
|
|
|
//if (p.getNoDamageTicks()<p.getMaximumNoDamageTicks()/2.0f) {
|
|
|
|
p.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { |
|
|
|
p.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
@ -10964,59 +10990,59 @@ implements Listener |
|
|
|
if (p.getEquipment().getHelmet()!=null && helm_dura!=-1 && p.getEquipment().getHelmet().hasItemMeta() && |
|
|
|
if (p.getEquipment().getHelmet()!=null && helm_dura!=-1 && p.getEquipment().getHelmet().hasItemMeta() && |
|
|
|
p.getEquipment().getHelmet().getItemMeta().hasLore()) { |
|
|
|
p.getEquipment().getHelmet().getItemMeta().hasLore()) { |
|
|
|
List<String> lore = p.getEquipment().getHelmet().getItemMeta().getLore(); |
|
|
|
List<String> lore = p.getEquipment().getHelmet().getItemMeta().getLore(); |
|
|
|
for (int i=0;i<lore.size();i++) { |
|
|
|
|
|
|
|
double dura_numb=0; |
|
|
|
double dura_numb=0; |
|
|
|
|
|
|
|
for (int i=0;i<lore.size();i++) { |
|
|
|
if (plug.containsEnchantment(lore.get(i), "Durability")) { |
|
|
|
if (plug.containsEnchantment(lore.get(i), "Durability")) { |
|
|
|
dura_numb+=plug.getEnchantmentNumb(lore.get(i)); |
|
|
|
dura_numb+=plug.getEnchantmentNumb(lore.get(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (!weak_helm) {dura_numb+=300; /*Bukkit.getLogger().info("1 not weak.");*/} |
|
|
|
if (!weak_helm) {dura_numb+=300; /*Bukkit.getLogger().info("1 not weak.");*/} |
|
|
|
if (Math.random()*dura_numb>100) { |
|
|
|
if (Math.random()*dura_numb>100) { |
|
|
|
helm_dura-=1; |
|
|
|
helm_dura-=1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (p.getEquipment().getChestplate()!=null && chest_dura!=-1 && p.getEquipment().getChestplate().hasItemMeta() && |
|
|
|
if (p.getEquipment().getChestplate()!=null && chest_dura!=-1 && p.getEquipment().getChestplate().hasItemMeta() && |
|
|
|
p.getEquipment().getChestplate().getItemMeta().hasLore()) { |
|
|
|
p.getEquipment().getChestplate().getItemMeta().hasLore()) { |
|
|
|
List<String> lore = p.getEquipment().getChestplate().getItemMeta().getLore(); |
|
|
|
List<String> lore = p.getEquipment().getChestplate().getItemMeta().getLore(); |
|
|
|
for (int i=0;i<lore.size();i++) { |
|
|
|
|
|
|
|
double dura_numb=0; |
|
|
|
double dura_numb=0; |
|
|
|
|
|
|
|
for (int i=0;i<lore.size();i++) { |
|
|
|
if (plug.containsEnchantment(lore.get(i), "Durability")) { |
|
|
|
if (plug.containsEnchantment(lore.get(i), "Durability")) { |
|
|
|
dura_numb+=plug.getEnchantmentNumb(lore.get(i)); |
|
|
|
dura_numb+=plug.getEnchantmentNumb(lore.get(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (!weak_chest) {dura_numb+=300; /*Bukkit.getLogger().info("2 not weak.");*/} |
|
|
|
if (!weak_chest) {dura_numb+=300; /*Bukkit.getLogger().info("2 not weak.");*/} |
|
|
|
if (Math.random()*dura_numb>100) { |
|
|
|
if (Math.random()*dura_numb>100) { |
|
|
|
chest_dura-=1; |
|
|
|
chest_dura-=1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (p.getEquipment().getLeggings()!=null && legs_dura!=-1 && p.getEquipment().getLeggings().hasItemMeta() && |
|
|
|
if (p.getEquipment().getLeggings()!=null && legs_dura!=-1 && p.getEquipment().getLeggings().hasItemMeta() && |
|
|
|
p.getEquipment().getLeggings().getItemMeta().hasLore()) { |
|
|
|
p.getEquipment().getLeggings().getItemMeta().hasLore()) { |
|
|
|
List<String> lore = p.getEquipment().getLeggings().getItemMeta().getLore(); |
|
|
|
List<String> lore = p.getEquipment().getLeggings().getItemMeta().getLore(); |
|
|
|
for (int i=0;i<lore.size();i++) { |
|
|
|
|
|
|
|
double dura_numb=0; |
|
|
|
double dura_numb=0; |
|
|
|
|
|
|
|
for (int i=0;i<lore.size();i++) { |
|
|
|
if (plug.containsEnchantment(lore.get(i), "Durability")) { |
|
|
|
if (plug.containsEnchantment(lore.get(i), "Durability")) { |
|
|
|
dura_numb+=plug.getEnchantmentNumb(lore.get(i)); |
|
|
|
dura_numb+=plug.getEnchantmentNumb(lore.get(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (!weak_legs) {dura_numb+=300; /*Bukkit.getLogger().info("3 not weak.");*/} |
|
|
|
if (!weak_legs) {dura_numb+=300; /*Bukkit.getLogger().info("3 not weak.");*/} |
|
|
|
if (Math.random()*dura_numb>100) { |
|
|
|
if (Math.random()*dura_numb>100) { |
|
|
|
legs_dura-=1; |
|
|
|
legs_dura-=1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (p.getEquipment().getBoots()!=null && boots_dura!=-1 && p.getEquipment().getBoots().hasItemMeta() && |
|
|
|
if (p.getEquipment().getBoots()!=null && boots_dura!=-1 && p.getEquipment().getBoots().hasItemMeta() && |
|
|
|
p.getEquipment().getBoots().getItemMeta().hasLore()) { |
|
|
|
p.getEquipment().getBoots().getItemMeta().hasLore()) { |
|
|
|
List<String> lore = p.getEquipment().getBoots().getItemMeta().getLore(); |
|
|
|
List<String> lore = p.getEquipment().getBoots().getItemMeta().getLore(); |
|
|
|
for (int i=0;i<lore.size();i++) { |
|
|
|
|
|
|
|
double dura_numb=0; |
|
|
|
double dura_numb=0; |
|
|
|
|
|
|
|
for (int i=0;i<lore.size();i++) { |
|
|
|
if (plug.containsEnchantment(lore.get(i), "Durability")) { |
|
|
|
if (plug.containsEnchantment(lore.get(i), "Durability")) { |
|
|
|
dura_numb+=plug.getEnchantmentNumb(lore.get(i)); |
|
|
|
dura_numb+=plug.getEnchantmentNumb(lore.get(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (!weak_boots) {dura_numb+=300; /*Bukkit.getLogger().info("4 not weak.");*/} |
|
|
|
if (!weak_boots) {dura_numb+=300; /*Bukkit.getLogger().info("4 not weak.");*/} |
|
|
|
if (Math.random()*dura_numb>100) { |
|
|
|
if (Math.random()*dura_numb>100) { |
|
|
|
boots_dura-=1; |
|
|
|
boots_dura-=1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (p.getEquipment().getBoots()!=null && boots_dura!=-1) {ItemStack i = p.getEquipment().getBoots(); i.setDurability((short)boots_dura); p.getEquipment().setBoots(i);} |
|
|
|
if (p.getEquipment().getBoots()!=null && boots_dura!=-1) {ItemStack i = p.getEquipment().getBoots(); i.setDurability((short)boots_dura); p.getEquipment().setBoots(i);} |
|
|
|
if (p.getEquipment().getLeggings()!=null && legs_dura!=-1) {ItemStack i = p.getEquipment().getLeggings(); i.setDurability((short)legs_dura); p.getEquipment().setLeggings(i);} |
|
|
|
if (p.getEquipment().getLeggings()!=null && legs_dura!=-1) {ItemStack i = p.getEquipment().getLeggings(); i.setDurability((short)legs_dura); p.getEquipment().setLeggings(i);} |
|
|
|
if (p.getEquipment().getChestplate()!=null && chest_dura!=-1) {ItemStack i = p.getEquipment().getChestplate(); i.setDurability((short)chest_dura); p.getEquipment().setChestplate(i);} |
|
|
|
if (p.getEquipment().getChestplate()!=null && chest_dura!=-1) {ItemStack i = p.getEquipment().getChestplate(); i.setDurability((short)chest_dura); p.getEquipment().setChestplate(i);} |
|
|
@ -11026,7 +11052,6 @@ implements Listener |
|
|
|
},1); |
|
|
|
},1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EventHandler |
|
|
|
@EventHandler |
|
|
|
public void onBlockPlace(BlockPlaceEvent e) { |
|
|
|
public void onBlockPlace(BlockPlaceEvent e) { |
|
|
|