Modifications to Powered mobs.

dev
sigonasr2 11 years ago
parent 9688c1b34f
commit 959064b983
  1. 13
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 49
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  3. 10
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -2076,9 +2076,18 @@ public void runTick() {
}
if (nearby.get(i).getType()==EntityType.SKELETON ||
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);
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) {
powered_mob_list.add(new PoweredMob(l.getUniqueId(), Main.SERVER_TICK_TIME));
l.getWorld().playSound(l.getLocation(), Sound.SPIDER_DEATH, 0.4f, 0.04f);

@ -9398,6 +9398,32 @@ implements Listener
if (e.getEntity() instanceof LivingEntity) {
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) {
LivingEntity l2 = (LivingEntity)e.getDamager();
for (int i=0;i<this.plugin.powered_mob_list.size();i++) {
@ -9406,10 +9432,10 @@ implements Listener
if (l instanceof Player) {
Player p = (Player)l;
if (!p.isBlocking()) {
if (p.getHealth()-e.getDamage()<0) {
if (p.getHealth()-e.getDamage()*2<0) {
p.setHealth(0);
} else {
p.setHealth(p.getHealth()-e.getDamage());
p.setHealth(p.getHealth()-e.getDamage()*2);
}
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().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;
if (p.getNoDamageTicks()<p.getMaximumNoDamageTicks()/2.0f) {
//if (p.getNoDamageTicks()<p.getMaximumNoDamageTicks()/2.0f) {
p.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
@ -10964,59 +10990,59 @@ implements Listener
if (p.getEquipment().getHelmet()!=null && helm_dura!=-1 && p.getEquipment().getHelmet().hasItemMeta() &&
p.getEquipment().getHelmet().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getHelmet().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
double dura_numb=0;
for (int i=0;i<lore.size();i++) {
if (plug.containsEnchantment(lore.get(i), "Durability")) {
dura_numb+=plug.getEnchantmentNumb(lore.get(i));
}
}
if (!weak_helm) {dura_numb+=300; /*Bukkit.getLogger().info("1 not weak.");*/}
if (Math.random()*dura_numb>100) {
helm_dura-=1;
}
}
}
if (p.getEquipment().getChestplate()!=null && chest_dura!=-1 && p.getEquipment().getChestplate().hasItemMeta() &&
p.getEquipment().getChestplate().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getChestplate().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
double dura_numb=0;
for (int i=0;i<lore.size();i++) {
if (plug.containsEnchantment(lore.get(i), "Durability")) {
dura_numb+=plug.getEnchantmentNumb(lore.get(i));
}
}
if (!weak_chest) {dura_numb+=300; /*Bukkit.getLogger().info("2 not weak.");*/}
if (Math.random()*dura_numb>100) {
chest_dura-=1;
}
}
}
if (p.getEquipment().getLeggings()!=null && legs_dura!=-1 && p.getEquipment().getLeggings().hasItemMeta() &&
p.getEquipment().getLeggings().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getLeggings().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
double dura_numb=0;
for (int i=0;i<lore.size();i++) {
if (plug.containsEnchantment(lore.get(i), "Durability")) {
dura_numb+=plug.getEnchantmentNumb(lore.get(i));
}
}
if (!weak_legs) {dura_numb+=300; /*Bukkit.getLogger().info("3 not weak.");*/}
if (Math.random()*dura_numb>100) {
legs_dura-=1;
}
}
}
if (p.getEquipment().getBoots()!=null && boots_dura!=-1 && p.getEquipment().getBoots().hasItemMeta() &&
p.getEquipment().getBoots().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getBoots().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
double dura_numb=0;
for (int i=0;i<lore.size();i++) {
if (plug.containsEnchantment(lore.get(i), "Durability")) {
dura_numb+=plug.getEnchantmentNumb(lore.get(i));
}
}
if (!weak_boots) {dura_numb+=300; /*Bukkit.getLogger().info("4 not weak.");*/}
if (Math.random()*dura_numb>100) {
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().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);}
@ -11026,7 +11052,6 @@ implements Listener
},1);
}
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {

@ -834,6 +834,16 @@ public String convertToItemName(String val) {
// Arrows
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);

Loading…
Cancel
Save