diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index ae4216a..defb3ee 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -2051,107 +2051,144 @@ public void runTick() { } } if (Main.SERVER_TICK_TIME%30==0) { - if (p.getWorld().getName().compareTo("world")==0) { - List nearby = p.getNearbyEntities(20, 20, 20); - Location nearestwolf = null; - int minions=0; - for (int i=0;i nearby = p.getNearbyEntities(20, 20, 20); + Location nearestwolf = null; + int minions=0; + for (int i=0;i ents = l.getNearbyEntities(10, 10, 10); - for (int m=0;m ents = l.getNearbyEntities(10, 10, 10); + for (int m=0;m10*levelsmult) { + if (totallvs>60*levelsmult && e.getEntity().getLocation().getY()<50 && e.getEntity().getWorld().getName().equalsIgnoreCase("world")) { //Try to spawn a counter slime. if (Math.random()<=COUNTER_SLIME_SPAWN_RATE) { Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.SLIME); @@ -2920,6 +2928,8 @@ implements Listener l.setHealth(35); l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3)); } + } + if (totallvs>120*levelsmult && e.getEntity().getWorld().getName().equalsIgnoreCase("world")) { //Try to spawn a Viral Spider. if (Math.random()<=VIRAL_SPIDER_SPAWN_RATE) { Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.SPIDER); @@ -2931,6 +2941,8 @@ implements Listener l.setHealth(85); l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3)); } + } + if (totallvs>120*levelsmult && e.getEntity().getWorld().getName().equalsIgnoreCase("world")) { //Try to spawn a Silencer. if (Math.random()<=SILENCER_SPAWN_RATE) { Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.SKELETON); @@ -2941,12 +2953,15 @@ implements Listener l.setMaxHealth(45); l.setHealth(45); ItemStack helm = new ItemStack(Material.DIAMOND_HELMET); - helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 24); + helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 32); l.getEquipment().setHelmet(helm); l.getEquipment().setHelmetDropChance(0.002f); l.getEquipment().setItemInHand(new ItemStack(Material.BOW)); l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3)); } + } + /* + if (totallvs>120*levelsmult && e.getEntity().getLocation().getY()>=63) { //Try to spawn a Hound Caller. if (Math.random()<=HOUND_CALLER_SPAWN_RATE) { Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.WOLF); @@ -2969,6 +2984,8 @@ implements Listener l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 2)); l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 0)); } + }*/ + if (totallvs>60*levelsmult && e.getEntity().getWorld().getName().equalsIgnoreCase("world")) { //Try to spawn a Fish Caller. if (Math.random()<=FISH_CALLER_SPAWN_RATE) { Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.ENDERMAN); @@ -2988,6 +3005,15 @@ implements Listener l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, 1)); l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1)); } + } + boolean haslineofsight=false; + for (int i=0;i90*levelsmult && !haslineofsight && e.getEntity().getWorld().getName().equalsIgnoreCase("world")) { //Try to spawn a Suicidal Creeper. if (Math.random()<=SUICIDAL_CREEPER_SPAWN_RATE) { Location ent = e.getEntity().getLocation(); @@ -3005,6 +3031,8 @@ implements Listener l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 4)); l.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 0)); } + } + if (totallvs>180*levelsmult && e.getEntity().getWorld().getName().equalsIgnoreCase("world")) { //Try to spawn a Powersurge Zombie. if (Math.random()<=POWER_SURGE_ZOMBIE_SPAWN_RATE) { Location ent = e.getEntity().getLocation(); @@ -3019,8 +3047,10 @@ implements Listener l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 2)); l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 0)); } + } + if (totallvs>60*levelsmult && e.getEntity().getWorld().getName().equalsIgnoreCase("world")) { //Try to spawn a Lightning Mage. - if (Math.random()<=POWER_SURGE_ZOMBIE_SPAWN_RATE) { + if (Math.random()<=LIGHTNING_MAGE_SPAWN_RATE) { Location ent = e.getEntity().getLocation(); Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.ENDERMAN); LivingEntity l = (LivingEntity)entity; @@ -9097,6 +9127,32 @@ implements Listener @EventHandler public void onHurt(EntityDamageEvent e) { final EntityDamageEvent f = e; + if (e.getEntity() instanceof Monster && e.getCause()==DamageCause.SUFFOCATION) { + LivingEntity l = (LivingEntity)e.getEntity(); + if (l.getTicksLived()<60) { + //Check around itself for other mobs. Teleport it there possibly. Higher chance + //of teleporting to mobs of the same type. + List nearby = l.getNearbyEntities(20, 20, 20); + for (int i=0;i60) { + e.getEntity().teleport(nearby.get(i).getLocation()); + break; + } + } + e.setDamage(0); + //e.setCancelled(true); + } + } if (e.getEntity().getType()==EntityType.PLAYER) { final Player p = (Player)e.getEntity(); if (this.plugin.getPlayerData(p).invulntime!=0) { @@ -9110,8 +9166,6 @@ implements Listener e.setDamage(e.getDamage()*2); } if (e.getCause()==DamageCause.WITHER) { - // e.setDamage(e.getDamage()*Math.pow(0.5, this.plugin.getWitherlessRoseCount(p))); - // For each Witherless Rose, add a multiplicative 25% chance to negate this tick of wither damage. if (Math.random() > Math.pow(0.75, this.plugin.getWitherlessRoseCount(p))) { e.setCancelled(true); @@ -9361,6 +9415,7 @@ implements Listener if (e.getEntity() instanceof Enderman) { LivingEntity l = (LivingEntity)e.getEntity(); if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Lightning Mage")) { + e.setDamage(0); e.setCancelled(true); } } @@ -9368,6 +9423,7 @@ implements Listener if (e.getDamager() instanceof Player) { Player p = (Player)e.getDamager(); if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) { + e.setDamage(0); e.setCancelled(true); return; } @@ -9401,12 +9457,24 @@ implements Listener if (e.getDamager() instanceof Projectile) { if (((Projectile)e.getDamager()).getShooter() instanceof LivingEntity) { LivingEntity l2 = ((Projectile)e.getDamager()).getShooter(); + if (l2.hasPotionEffect(PotionEffectType.INVISIBILITY)) {l2.removePotionEffect(PotionEffectType.INVISIBILITY);} for (int i=0;i0) { - l2.setHealth(l2.getHealth()-dmg); + if (l2.getHealth()-dmg*2>0) { + l2.setHealth(l2.getHealth()-dmg*2); if (l2 instanceof Player) { Player p = (Player)l2; p.playSound(p.getLocation(), Sound.HURT_FLESH, 0.5f, 1.0f); @@ -9667,9 +9753,13 @@ implements Listener Player p = (Player)l2; p.setLastDamage(dmg); p.setLastDamageCause(new EntityDamageEvent(l, e.getCause().ENTITY_ATTACK, dmg)); + DecimalFormat df = new DecimalFormat("#0.0"); + DecimalFormat df2 = new DecimalFormat("#0"); + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { + p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(dmg)+" damage from "+ChatColor.RED+"COUNTER SLIME"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((dmg)/p.getMaxHealth())*100)+"%)"); + } } l2.setHealth(0); - } } if (e.getDamager() instanceof Projectile) { @@ -10116,10 +10206,10 @@ implements Listener //Choose a random set to mark off. blocked_attack=true; //Reduce all armor by one as if it was a normal hit. - if (p.getInventory().getHelmet()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getHelmet(), Main.ENCHANT_BLOCK_CHANCE)) {p.getInventory().getHelmet().setDurability((short)(p.getInventory().getHelmet().getDurability()+1));} - if (p.getInventory().getChestplate()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getChestplate(), Main.ENCHANT_BLOCK_CHANCE)) {p.getInventory().getChestplate().setDurability((short)(p.getInventory().getChestplate().getDurability()+1));} - if (p.getInventory().getLeggings()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getLeggings(), Main.ENCHANT_BLOCK_CHANCE)) {p.getInventory().getLeggings().setDurability((short)(p.getInventory().getLeggings().getDurability()+1));} - if (p.getInventory().getBoots()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getBoots(), Main.ENCHANT_BLOCK_CHANCE)) {p.getInventory().getBoots().setDurability((short)(p.getInventory().getBoots().getDurability()+1));} + if (p.getInventory().getHelmet()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getHelmet(), Main.ENCHANT_BLOCK_CHANCE)) {p.getInventory().getHelmet().setDurability((short)(p.getInventory().getHelmet().getDurability()+3));} + if (p.getInventory().getChestplate()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getChestplate(), Main.ENCHANT_BLOCK_CHANCE)) {p.getInventory().getChestplate().setDurability((short)(p.getInventory().getChestplate().getDurability()+3));} + if (p.getInventory().getLeggings()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getLeggings(), Main.ENCHANT_BLOCK_CHANCE)) {p.getInventory().getLeggings().setDurability((short)(p.getInventory().getLeggings().getDurability()+3));} + if (p.getInventory().getBoots()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getBoots(), Main.ENCHANT_BLOCK_CHANCE)) {p.getInventory().getBoots().setDurability((short)(p.getInventory().getBoots().getDurability()+3));} /* if (blocks.size()>0) { int armor = blocks.get((int)(Math.random()*blocks.size())); @@ -10139,6 +10229,7 @@ implements Listener } }*/ p.playSound(p.getLocation(), Sound.ANVIL_LAND, 0.1f, 3.6f); + e.setDamage(0); e.setCancelled(true); } //Bukkit.getLogger().info("Made it through 4."); @@ -13163,7 +13254,7 @@ implements Listener } } } - if (!item_cube || (item_cube && (event.getCursor()==null || event.getCursor().getType()==Material.AIR))) { + if (!item_cube || (item_cube && (event.getClick()!=ClickType.RIGHT && (event.getCursor()==null || event.getCursor().getType()==Material.AIR)))) { //Bukkit.getLogger().info("Got to 3."); if (this.plugin.ender_cube_active) { final Player p2 = p; @@ -16333,7 +16424,7 @@ implements Listener for (int i=0;i