Modifications to Powered mobs.
This commit is contained in:
parent
9688c1b34f
commit
959064b983
@ -2076,9 +2076,18 @@ public void runTick() {
|
|||||||
}
|
}
|
||||||
if (nearby.get(i).getType()==EntityType.SKELETON ||
|
if (nearby.get(i).getType()==EntityType.SKELETON ||
|
||||||
nearby.get(i).getType()==EntityType.ZOMBIE ||
|
nearby.get(i).getType()==EntityType.ZOMBIE ||
|
||||||
nearby.get(i).getType()==EntityType.SPIDER) {
|
nearby.get(i).getType()==EntityType.SPIDER||
|
||||||
|
nearby.get(i).getType()==EntityType.CREEPER||
|
||||||
|
nearby.get(i).getType()==EntityType.ENDERMAN) {
|
||||||
LivingEntity l = (LivingEntity)nearby.get(i);
|
LivingEntity l = (LivingEntity)nearby.get(i);
|
||||||
if (l.getKiller()!=null && Math.random()<=0.5/l.getNearbyEntities(10, 10, 10).size()) {
|
List<Entity> ents = l.getNearbyEntities(10, 10, 10);
|
||||||
|
for (int m=0;m<ents.size();m++) {
|
||||||
|
if (!(ents.get(m) instanceof Monster)) {
|
||||||
|
ents.remove(m);
|
||||||
|
m--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (l.getKiller()!=null && Math.random()<=1.15/ents.size()) {
|
||||||
if (!contains_mob) {
|
if (!contains_mob) {
|
||||||
powered_mob_list.add(new PoweredMob(l.getUniqueId(), Main.SERVER_TICK_TIME));
|
powered_mob_list.add(new PoweredMob(l.getUniqueId(), Main.SERVER_TICK_TIME));
|
||||||
l.getWorld().playSound(l.getLocation(), Sound.SPIDER_DEATH, 0.4f, 0.04f);
|
l.getWorld().playSound(l.getLocation(), Sound.SPIDER_DEATH, 0.4f, 0.04f);
|
||||||
|
@ -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) {
|
||||||
|
@ -834,6 +834,16 @@ public String convertToItemName(String val) {
|
|||||||
// Arrows
|
// Arrows
|
||||||
i.setItem(count+=1, new ItemStack(Material.ARROW, 64));
|
i.setItem(count+=1, new ItemStack(Material.ARROW, 64));
|
||||||
|
|
||||||
|
temp = new ItemStack(Material.getMaterial(34),64);
|
||||||
|
ItemMeta meta = temp.getItemMeta();
|
||||||
|
meta.setDisplayName(ChatColor.LIGHT_PURPLE+"Job Boost Card");
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
lore.add("Use /jobs boost <jobname> to instantly level up");
|
||||||
|
lore.add("that job with this card!");
|
||||||
|
meta.setLore(lore);
|
||||||
|
temp.setItemMeta(meta);
|
||||||
|
i.setItem(count+=1, temp);
|
||||||
|
|
||||||
p.openInventory(i);
|
p.openInventory(i);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user