diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$1.class b/BankEconomyMod/bin/me/kaZep/Base/Main$1.class index ecf56ff..40fb01f 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/Main$1.class and b/BankEconomyMod/bin/me/kaZep/Base/Main$1.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$2.class b/BankEconomyMod/bin/me/kaZep/Base/Main$2.class index db12478..ebe9b6a 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/Main$2.class and b/BankEconomyMod/bin/me/kaZep/Base/Main$2.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$3.class b/BankEconomyMod/bin/me/kaZep/Base/Main$3.class index 4bcdb97..16ab46e 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/Main$3.class and b/BankEconomyMod/bin/me/kaZep/Base/Main$3.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$4.class b/BankEconomyMod/bin/me/kaZep/Base/Main$4.class index 7cce4aa..434741e 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/Main$4.class and b/BankEconomyMod/bin/me/kaZep/Base/Main$4.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main.class b/BankEconomyMod/bin/me/kaZep/Base/Main.class index 7fef7f7..8a09b18 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/Main.class and b/BankEconomyMod/bin/me/kaZep/Base/Main.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class index e4b7258..d20f75f 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class index d85091f..4f373e2 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class index c11580e..775ef5f 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class index 866e7cd..01af59a 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class index 8a79037..fdfae25 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class index f512cbd..b3e8fa6 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class index b29a334..45ef5e2 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class b/BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class index b89e0ac..f0d27fe 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class and b/BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class differ diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index fb920e9..71003db 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -1440,18 +1440,18 @@ public void runTick() { l.setCustomName(ChatColor.GOLD+"Venomous Spider II"); l.setCustomNameVisible(false); //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*2); + l.setMaxHealth(l.getMaxHealth()*1.5); } else if (Math.random()<=0.35) { l.setCustomName(ChatColor.YELLOW+"Snaring Spider"); l.setCustomNameVisible(false); //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*2); + l.setMaxHealth(l.getMaxHealth()*1.5); } else { l.setCustomName(ChatColor.GOLD+"Snaring Spider II"); l.setCustomNameVisible(false); //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*4); + l.setMaxHealth(l.getMaxHealth()*2); } l.setHealth(l.getMaxHealth()); } @@ -1486,14 +1486,14 @@ public void runTick() { l.setCustomName(ChatColor.YELLOW+"Charge Zombie"); l.setCustomNameVisible(false); //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()+20); + l.setMaxHealth(l.getMaxHealth()+5); } else { l.setCustomName(ChatColor.GOLD+"Charge Zombie II"); l.setCustomNameVisible(false); //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()+60); + l.setMaxHealth(l.getMaxHealth()+20); } - l.setHealth(l.getMaxHealth()); + l.setHealth(l.getMaxHealth()*0.95d); } else { if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { if (Math.random()<=0.25) { @@ -1509,7 +1509,8 @@ public void runTick() { l.getEquipment().setHelmet(new ItemStack(Material.AIR)); Zombie g = (Zombie)l; g.setBaby(true); - l.setMaxHealth(l.getMaxHealth()+20); + //l.setMaxHealth(l.getMaxHealth()+20); + l.setHealth(l.getMaxHealth()*0.65d); } } } @@ -2858,9 +2859,12 @@ public void checkJukeboxes() { Iterator effects = p2.getActivePotionEffects().iterator(); while (effects.hasNext()) { PotionEffect pot = effects.next(); - if (pot.getType()==PotionEffectType.DAMAGE_RESISTANCE) { + if (pot.getType().getName().equalsIgnoreCase(PotionEffectType.DAMAGE_RESISTANCE.getName())) { get_resistance_level=pot.getAmplifier(); + //Bukkit.broadcastMessage("Got REsistance of "+pot.getAmplifier()); break; + } else { + //Bukkit.broadcastMessage("Got buff of "+pot.getType()); } } if (get_resistance_level<1) { @@ -2880,9 +2884,12 @@ public void checkJukeboxes() { Iterator effects = p2.getActivePotionEffects().iterator(); while (effects.hasNext()) { PotionEffect pot = effects.next(); - if (pot.getType()==PotionEffectType.DAMAGE_RESISTANCE) { + if (pot.getType().getName().equalsIgnoreCase(PotionEffectType.DAMAGE_RESISTANCE.getName())) { get_resistance_level=pot.getAmplifier(); + //Bukkit.broadcastMessage("Got REsistance of "+pot.getAmplifier()); break; + } else { + //Bukkit.broadcastMessage("Got buff of "+pot.getType()); } } if (get_resistance_level<0) { @@ -3238,11 +3245,7 @@ public void updateTime() { last_world_time+=2; raisecount++; } - if (!harrowing_night) { - Bukkit.getWorld("world").setFullTime(Bukkit.getWorld("world").getFullTime()-raisecount); - } else { - Bukkit.getWorld("world").setFullTime(last_world_time); - } + Bukkit.getWorld("world").setFullTime(Bukkit.getWorld("world").getFullTime()-raisecount); /* if (Bukkit.getWorld("world").getFullTime()-last_world_time+hold_diff>=2) { last_world_time = Bukkit.getWorld("world").getFullTime()+((Bukkit.getWorld("world").getFullTime()-last_world_time+(hold_diff/2))/2); @@ -3621,6 +3624,10 @@ public void payDay(int time) JobsDataInfo info = Jobsinfo[getJobSlot(job)]; economy.depositPlayer(p.getName(), amount*(1d+(info.moneymult*getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv")))); getAccountsConfig().set(p.getName()+".jobs.job"+(slot+1)+"exp", Double.valueOf(getAccountsConfig().getDouble(p.getName()+".jobs.job"+(slot+1)+"exp")+exp)); + if (getAccountsConfig().getDouble(p.getName()+".jobs.job"+(slot+1)+"exp")<0) { + //It can't be negative. + getAccountsConfig().set(p.getName()+".jobs.job"+(slot+1)+"exp", Double.valueOf(0.0)); + } //Check for lv up. if (getJobLv(job,p)<40 && getJobExp(job,getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv"))<=getAccountsConfig().getDouble(p.getName()+".jobs.job"+(slot+1)+"exp")) { //Level up! Level up! YEAH! @@ -3637,6 +3644,51 @@ public void payDay(int time) saveAccountsConfig(); } + public void levelUpJob(Player p, String job) { + //If they have a job token, then do this. Otherwise they are not allowed. + boolean has_job_token=false; + ItemStack j = new ItemStack(Material.getMaterial(34)); + ItemMeta meta = j.getItemMeta(); + meta.setDisplayName(ChatColor.LIGHT_PURPLE+"Job Boost Card"); + List lore = new ArrayList(); + lore.add("Use /jobs boost to instantly level up"); + lore.add("that job with this card!"); + meta.setLore(lore); + j.setItemMeta(meta); + if (p.getInventory().containsAtLeast(j, 1)) { + String[] jobs = getJobs(p); + int slot=-1; + JobsDataInfo[] Jobsinfo = {Woodcutter_job,Miner_job,Builder_job,Digger_job,Farmer_job,Hunter_job,Fisherman_job,Weaponsmith_job,Blacksmith_job,Cook_job,Brewer_job,Enchanter_job,Breeder_job,Explorer_job,Support_job}; + for (int i=0;i0) { + p.sendMessage(ChatColor.GOLD+"You have earned 1 stat point! You now have "+(((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))+" stat point"+((((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))==1?"":"s")+" to spend. "+ChatColor.ITALIC+ChatColor.BLUE+" Type /sp to spend them!"); + } + } + saveAccountsConfig(); + p.getInventory().removeItem(j); + } else { + p.sendMessage(ChatColor.GOLD+"You can't level this job. It is already at max level."); + } + } else { + p.sendMessage(ChatColor.GOLD+"Sorry, that is not a valid job!"); + } + } else { + p.sendMessage(ChatColor.GOLD+"Sorry, you cannot do this!"); + } + } + public void gainMoney(Player p,String job,double amount) { String[] jobs = getJobs(p); int slot=-1; diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 0bed24f..fe6b41e 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -760,64 +760,64 @@ public class PlayerListener } } if (entry.getKey().getName()==Enchantment.PROTECTION_ENVIRONMENTAL.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.08*entry.getValue(),4*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.08*entry.getValue(),Math.pow(4,entry.getValue())); } if (entry.getKey().getName()==Enchantment.DAMAGE_UNDEAD.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),8*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),Math.pow(8,entry.getValue())); } if (entry.getKey().getName()==Enchantment.PROTECTION_FIRE.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),6*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),Math.pow(6,entry.getValue())); } if (entry.getKey().getName()==Enchantment.DAMAGE_ARTHROPODS.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.12*entry.getValue(),8*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.12*entry.getValue(),Math.pow(8,entry.getValue())); } if (entry.getKey().getName()==Enchantment.PROTECTION_FALL.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.14*entry.getValue(),10*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.14*entry.getValue(),Math.pow(10,entry.getValue())); } if (entry.getKey().getName()==Enchantment.DAMAGE_ALL.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),14*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),Math.pow(14,entry.getValue())); } if (entry.getKey().getName()==Enchantment.DIG_SPEED.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),14*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),Math.pow(14,entry.getValue())); } if (entry.getKey().getName()==Enchantment.PROTECTION_EXPLOSIONS.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),16*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),Math.pow(16,entry.getValue())); } if (entry.getKey().getName()==Enchantment.THORNS.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),16*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),Math.pow(16,entry.getValue())); } if (entry.getKey().getName()==Enchantment.KNOCKBACK.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),18*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),Math.pow(18,entry.getValue())); } if (entry.getKey().getName()==Enchantment.ARROW_KNOCKBACK.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),18*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),Math.pow(18,entry.getValue())); } if (entry.getKey().getName()==Enchantment.FIRE_ASPECT.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),20*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),Math.pow(20,entry.getValue())); } if (entry.getKey().getName()==Enchantment.ARROW_FIRE.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),20*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),Math.pow(20,entry.getValue())); } if (entry.getKey().getName()==Enchantment.WATER_WORKER.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.25*entry.getValue(),16*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.25*entry.getValue(),Math.pow(16,entry.getValue())); } if (entry.getKey().getName()==Enchantment.OXYGEN.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.30*entry.getValue(),20*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.30*entry.getValue(),Math.pow(20,entry.getValue())); } if (entry.getKey().getName()==Enchantment.DURABILITY.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.35*entry.getValue(),24*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.35*entry.getValue(),Math.pow(24,entry.getValue())); } if (entry.getKey().getName()==Enchantment.ARROW_INFINITE.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),40*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),Math.pow(40,entry.getValue())); } if (entry.getKey().getName()==Enchantment.LOOT_BONUS_MOBS.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),30*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),Math.pow(30,entry.getValue())); } if (entry.getKey().getName()==Enchantment.LOOT_BONUS_BLOCKS.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),40*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),Math.pow(40,entry.getValue())); } if (entry.getKey().getName()==Enchantment.SILK_TOUCH.getName()) { - this.plugin.gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),40*entry.getValue()); + this.plugin.gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),Math.pow(40,entry.getValue())); } } } @@ -1622,9 +1622,11 @@ public class PlayerListener sign.setItemMeta(meta); p.getInventory().addItem(sign); p.sendMessage("You have received 2 vote signs. Go vote at the Pumpkin Patch for the best pumpkin! (Note that voting for yourself does not count. Please vote the best of the others' pumpkins.)"); - } else { - p.sendMessage("You do not have enough room in your inventory to receive Pumpkin vote signs. Clear some of your inventory and then rejoin."); } + } else { + if (!this.plugin.getAccountsConfig().contains(p.getName() + ".join.halloween_vote_signs")) { + p.sendMessage("You do not have enough room in your inventory to receive Pumpkin vote signs. Clear some of your inventory and then rejoin."); + } } if (!this.plugin.getAccountsConfig().contains(p.getName() + ".halloween.chest1")) { this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest1", Boolean.valueOf(false)); @@ -1752,49 +1754,13 @@ public class PlayerListener if (theAnimal.getType()!=EntityType.PLAYER) { if (theAnimal instanceof LivingEntity) { LivingEntity l = (LivingEntity)theAnimal; - if (l.getCustomName()==null) { - //This is not a boss. Convert it to something else. - Location oldloc = theAnimal.getLocation(); - EntityType newtype = null; - theAnimal.remove(); - EntityType types[] = {EntityType.ZOMBIE, - EntityType.BAT, - EntityType.CHICKEN, - EntityType.COW, - EntityType.CREEPER, - EntityType.ENDERMAN, - EntityType.GIANT, - EntityType.HORSE, - EntityType.IRON_GOLEM, - EntityType.MINECART, - EntityType.MUSHROOM_COW, - EntityType.OCELOT, - EntityType.PIG, - EntityType.PIG_ZOMBIE, - EntityType.SHEEP, - EntityType.SILVERFISH, - EntityType.SKELETON, - EntityType.SNOWMAN, - EntityType.SPIDER, - EntityType.SQUID, - EntityType.VILLAGER, - EntityType.WITCH, - EntityType.WOLF}; - World world = Bukkit.getWorld("world"); - Entity newAnimal = world.spawnEntity(oldloc, types[(int)(Math.random()*types.length)]); - if (newAnimal instanceof LivingEntity) { - LivingEntity l2 = (LivingEntity)newAnimal; - l2.setCustomName(ChatColor.DARK_AQUA+"Polymorphed Creature"); - } - this.plugin.getAccountsConfig().set(ev.getPlayer().getName()+".halloween.wand",Long.valueOf(Bukkit.getWorld("world").getFullTime()+1200)); - } else { - if (!l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { + if (l.getType()!=EntityType.ENDER_DRAGON && l.getType()!=EntityType.WITHER) { + if (l.getCustomName()==null) { //This is not a boss. Convert it to something else. Location oldloc = theAnimal.getLocation(); EntityType newtype = null; theAnimal.remove(); EntityType types[] = {EntityType.ZOMBIE, - EntityType.BAT, EntityType.CHICKEN, EntityType.COW, EntityType.CREEPER, @@ -1810,6 +1776,7 @@ public class PlayerListener EntityType.SILVERFISH, EntityType.SKELETON, EntityType.SPIDER, + EntityType.SNOWMAN, EntityType.SQUID, EntityType.VILLAGER, EntityType.WITCH, @@ -1821,7 +1788,42 @@ public class PlayerListener l2.setCustomName(ChatColor.DARK_AQUA+"Polymorphed Creature"); } this.plugin.getAccountsConfig().set(ev.getPlayer().getName()+".halloween.wand",Long.valueOf(Bukkit.getWorld("world").getFullTime()+1200)); - } + } else { + if (!l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { + //This is not a boss. Convert it to something else. + Location oldloc = theAnimal.getLocation(); + EntityType newtype = null; + theAnimal.remove(); + EntityType types[] = {EntityType.ZOMBIE, + EntityType.CHICKEN, + EntityType.COW, + EntityType.CREEPER, + EntityType.ENDERMAN, + EntityType.GIANT, + EntityType.HORSE, + EntityType.IRON_GOLEM, + EntityType.MUSHROOM_COW, + EntityType.OCELOT, + EntityType.PIG, + EntityType.PIG_ZOMBIE, + EntityType.SHEEP, + EntityType.SILVERFISH, + EntityType.SKELETON, + EntityType.SPIDER, + EntityType.SNOWMAN, + EntityType.SQUID, + EntityType.VILLAGER, + EntityType.WITCH, + EntityType.WOLF}; + World world = Bukkit.getWorld("world"); + Entity newAnimal = world.spawnEntity(oldloc, types[(int)(Math.random()*types.length)]); + if (newAnimal instanceof LivingEntity) { + LivingEntity l2 = (LivingEntity)newAnimal; + l2.setCustomName(ChatColor.DARK_AQUA+"Polymorphed Creature"); + } + this.plugin.getAccountsConfig().set(ev.getPlayer().getName()+".halloween.wand",Long.valueOf(Bukkit.getWorld("world").getFullTime()+1200)); + } + } } } } @@ -1918,6 +1920,13 @@ public class PlayerListener } } } + if (test.getCustomName()!=null && !test.getCustomName().contains(ChatColor.DARK_PURPLE+"") && !test.getCustomName().contains(ChatColor.DARK_AQUA+"Polymorphed Creature")) { + if (test.getMaxHealth()>50) { + Bukkit.getPlayer("sigonasr2").sendMessage("Mob had "+test.getMaxHealth()+" health. Lowering to max cap of 50."); + test.setMaxHealth(50); + test.setHealth(test.getMaxHealth()); + } + } List entities = Bukkit.getWorld("world").getEntities(); for (int i=0;i=0.25) { if (Math.random()<=0.75) { @@ -2382,23 +2390,23 @@ public class PlayerListener if (Math.random()<=0.65) { if (Math.random()<=0.75) { ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 3); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); l.getEquipment().setItemInHand(new_bow); } else { ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 5); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 3); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 2); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); l.getEquipment().setItemInHand(new_bow); } } } else { if (Math.random()<=0.65) { if (Math.random()<=0.75) { - l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,0)); } else { - l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); - l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,0)); + l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,0)); } } } @@ -2449,24 +2457,24 @@ public class PlayerListener if (Math.random()<=0.65) { if (Math.random()<=0.75) { ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 5); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 3); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 2); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); l.getEquipment().setItemInHand(new_bow); } else { ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 8); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 4); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 3); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 2); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 1); l.getEquipment().setItemInHand(new_bow); } } } else { if (Math.random()<=0.65) { if (Math.random()<=0.75) { - l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); + l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); } else { - l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,3)); - l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,2)); + l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,0)); } } } @@ -2475,7 +2483,7 @@ public class PlayerListener l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); l.getEquipment().setChestplate(enchanted); } if (Math.random()>=0.45) { @@ -2483,7 +2491,7 @@ public class PlayerListener l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); l.getEquipment().setLeggings(enchanted); } if (Math.random()>=0.65) { @@ -2491,7 +2499,7 @@ public class PlayerListener l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); } if (Math.random()>=0.95) { @@ -2499,7 +2507,7 @@ public class PlayerListener l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); } } @@ -2517,20 +2525,20 @@ public class PlayerListener if (Math.random()<=0.80) { if (Math.random()<=0.75) { ItemStack enchanted = new ItemStack(Material.DIAMOND_SWORD); - enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*1.0d)+1); } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*5.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*1.0d)+1); } l.getEquipment().setItemInHand(enchanted); } else { ItemStack enchanted = new ItemStack(Material.GOLD_SWORD); - enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*1.0d)+1); } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*5.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*2.0d)+1); } l.getEquipment().setItemInHand(enchanted); } @@ -2540,27 +2548,27 @@ public class PlayerListener if (Math.random()<=0.65) { if (Math.random()<=0.75) { ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 8); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 4); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 3); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 3); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 1); l.getEquipment().setItemInHand(new_bow); } else { ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 4); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 6); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 3); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 1); l.getEquipment().setItemInHand(new_bow); } } } else { if (Math.random()<=0.65) { if (Math.random()<=0.75) { - l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,0)); } else { - l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,3)); - l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,3)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,0)); + l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,0)); } } } @@ -2569,9 +2577,9 @@ public class PlayerListener l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); } l.getEquipment().setChestplate(enchanted); } @@ -2580,9 +2588,9 @@ public class PlayerListener l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); } l.getEquipment().setLeggings(enchanted); } @@ -2591,9 +2599,9 @@ public class PlayerListener l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); } l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); } @@ -2602,9 +2610,9 @@ public class PlayerListener l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); } l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); } @@ -2623,33 +2631,21 @@ public class PlayerListener if (Math.random()<=0.80) { if (Math.random()<=0.75) { ItemStack enchanted = new ItemStack(Material.DIAMOND_SWORD); - enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*2.0d)+1); if (Math.random()<=0.5) { enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*5.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*1.0d)+1); } l.getEquipment().setItemInHand(enchanted); } else { ItemStack enchanted = new ItemStack(Material.GOLD_SWORD); - enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*2.0d)+1); if (Math.random()<=0.5) { enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*5.0d)+1); - } - List newlore = new ArrayList(); - int randomenchant=(int)(Math.random()*5); - switch (randomenchant) { - case 0: {newlore.add(ChatColor.YELLOW+"+20% "+ChatColor.BLUE+"Critical Chance");}break; - case 1: {newlore.add(ChatColor.YELLOW+"+10 "+ChatColor.BLUE+"Armor Penetration");}break; - case 2: {newlore.add(ChatColor.YELLOW+"+15% "+ChatColor.BLUE+"Life Steal");}break; - case 3: {newlore.add(ChatColor.YELLOW+"+40% "+ChatColor.BLUE+"Attack Speed");}break; - case 4: {newlore.add(ChatColor.YELLOW+"+6 "+ChatColor.BLUE+"Damage");}break; + enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*1.0d)+1); } - ItemMeta m = enchanted.getItemMeta(); - m.setLore(newlore); - enchanted.setItemMeta(m); l.getEquipment().setItemInHand(enchanted); } } @@ -2658,15 +2654,15 @@ public class PlayerListener if (Math.random()<=0.65) { if (Math.random()<=0.75) { ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 8); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 4); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 3); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 2); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 1); l.getEquipment().setItemInHand(new_bow); } else { ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 4); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 6); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 2); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2); + new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 1); l.getEquipment().setItemInHand(new_bow); } } @@ -2674,12 +2670,12 @@ public class PlayerListener if (Math.random()<=0.65) { if (Math.random()<=0.75) { l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); - l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,2)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,2)); + l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); } else { - l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,3)); - l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,3)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,2)); + l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); + l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,2)); + l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); } } } @@ -2688,12 +2684,12 @@ public class PlayerListener l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*10.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*10.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); } l.getEquipment().setChestplate(enchanted); } @@ -2702,12 +2698,12 @@ public class PlayerListener l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*10.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*1.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*1.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*10.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); } l.getEquipment().setLeggings(enchanted); } @@ -2716,12 +2712,12 @@ public class PlayerListener l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*10.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*1.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*1.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*10.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); } l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); } @@ -2730,12 +2726,12 @@ public class PlayerListener l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*10.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*1.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*10.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); } l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); } @@ -2751,43 +2747,31 @@ public class PlayerListener //Wear diamond armor almost always. Enchanted diamond pieces here and there. if (entity.getType()==EntityType.SKELETON || entity.getType()==EntityType.ZOMBIE) { LivingEntity l = (LivingEntity) entity; - l.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST,999999,3)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,2)); - l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,999999,1)); - l.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,999999,1)); - l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,4)); + l.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); + l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,999999,0)); + l.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,999999,0)); + l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,0)); l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); if (entity.getType()==EntityType.ZOMBIE) { if (Math.random()<=0.80) { if (Math.random()<=0.75) { ItemStack enchanted = new ItemStack(Material.DIAMOND_SWORD); - enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*2.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*1.0d)+1); } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*5.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*2.0d)+1); } l.getEquipment().setItemInHand(enchanted); } else { ItemStack enchanted = new ItemStack(Material.GOLD_SWORD); - enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*2.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*1.0d)+1); } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*5.0d)+1); - } - List newlore = new ArrayList(); - int randomenchant=(int)(Math.random()*5); - switch (randomenchant) { - case 0: {newlore.add(ChatColor.YELLOW+"+40% "+ChatColor.BLUE+"Critical Chance");}break; - case 1: {newlore.add(ChatColor.YELLOW+"+20 "+ChatColor.BLUE+"Armor Penetration");}break; - case 2: {newlore.add(ChatColor.YELLOW+"+30% "+ChatColor.BLUE+"Life Steal");}break; - case 3: {newlore.add(ChatColor.YELLOW+"+80% "+ChatColor.BLUE+"Attack Speed");}break; - case 4: {newlore.add(ChatColor.YELLOW+"+10 "+ChatColor.BLUE+"Damage");}break; + enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*2.0d)+1); } - ItemMeta m = enchanted.getItemMeta(); - m.setLore(newlore); - enchanted.setItemMeta(m); l.getEquipment().setItemInHand(enchanted); } } @@ -2797,12 +2781,12 @@ public class PlayerListener l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*10.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*10.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); } l.getEquipment().setChestplate(enchanted); } @@ -2811,12 +2795,12 @@ public class PlayerListener l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*10.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*1.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*10.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); } l.getEquipment().setLeggings(enchanted); } @@ -2825,12 +2809,12 @@ public class PlayerListener l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*10.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*1.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*1.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*10.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); } l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); } @@ -2839,12 +2823,12 @@ public class PlayerListener l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); } else { ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*10.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*6.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*6.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*2.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*2.0d)+1); if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*10.0d)+1); + enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); } l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); } @@ -5312,6 +5296,12 @@ public ItemStack getGoodie() { } ItemMeta meta = item.getItemMeta(); meta.setLore(ourLore); + if (rarity==1) { + meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); + } + if (rarity==2) { + meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); + } item.setItemMeta(meta); } else { item = new ItemStack(Material.getMaterial(type+"_"+type2)); @@ -5344,6 +5334,12 @@ public ItemStack getGoodie() { } ItemMeta meta = item.getItemMeta(); meta.setLore(ourLore); + if (rarity==1) { + meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); + } + if (rarity==2) { + meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); + } item.setItemMeta(meta); } else if (type2.equalsIgnoreCase("SPADE") || type2.equalsIgnoreCase("PICKAXE") || type2.equalsIgnoreCase("HOE") || type2.equalsIgnoreCase("AXE")) { int enchants[] = {32,33,34,35}; @@ -5396,6 +5392,12 @@ public ItemStack getGoodie() { } ItemMeta meta = item.getItemMeta(); meta.setLore(ourLore); + if (rarity==1) { + meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); + } + if (rarity==2) { + meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); + } item.setItemMeta(meta); } else { int enchants[] = {0,1,2,3,4,5,6,7,34}; @@ -5477,10 +5479,10 @@ public ItemStack getGoodie() { ItemMeta meta = item.getItemMeta(); meta.setLore(ourLore); if (rarity==1) { - meta.setDisplayName(ChatColor.BLUE+"Rare "+item.getType().name().replace("_", " ")); + meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); } if (rarity==2) { - meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+item.getType().name().replace("_", " ")); + meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); } item.setItemMeta(meta); } @@ -6155,6 +6157,7 @@ public ItemStack getGoodie() { @EventHandler public void onHurt(EntityDamageEvent e) { + final EntityDamageEvent f = e; if (e.getEntity().getType()==EntityType.PLAYER) { final Player p = (Player)e.getEntity(); if (e.getCause()==DamageCause.ENTITY_EXPLOSION || e.getCause()==DamageCause.BLOCK_EXPLOSION) { @@ -6207,8 +6210,19 @@ public ItemStack getGoodie() { } } } - if (p.getNoDamageTicks()=0.5) { + p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(player_starthp-p.getHealth())+" damage from "+ChatColor.WHITE+f.getCause().toString()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((player_starthp-p.getHealth())/p.getMaxHealth())*100)+"%)"); + } + } + },1); } } EntityType allowedtypes[] = {EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.ENDERMAN,EntityType.GHAST,EntityType.MAGMA_CUBE,EntityType.PIG_ZOMBIE,EntityType.SILVERFISH,EntityType.SLIME,EntityType.SPIDER,EntityType.ZOMBIE,EntityType.SKELETON,EntityType.CREEPER}; @@ -6226,7 +6240,7 @@ public ItemStack getGoodie() { @EventHandler public void onPlayerPickup(PlayerPickupItemEvent e) { - if (this.plugin.getAccountsConfig().getBoolean(e.getPlayer().getName()+".settings.notify1")) { + if (!this.plugin.inventoryFull(e.getPlayer()) && this.plugin.getAccountsConfig().getBoolean(e.getPlayer().getName()+".settings.notify1")) { Player p = e.getPlayer(); String temp = e.getItem().getItemStack().getType().name().replace("_", " "); char[] mod = temp.toCharArray(); @@ -6316,92 +6330,40 @@ public ItemStack getGoodie() { @EventHandler public void onEnemyHit(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Monster) { - e.setDamage(e.getDamage()*2); //Damage of ALL mobs multiplied by 2. + e.setDamage(e.getDamage()*1.65d); //Damage of ALL mobs multiplied by x1.65. Monster m = (Monster)e.getDamager(); - if (e.getEntity() instanceof Player) { - Player p = (Player)e.getEntity(); - //Go through the lore of the item, if it exists. - if (m.getEquipment()!=null && m.getEquipment().getItemInHand()!=null && - m.getEquipment().getItemInHand().hasItemMeta() && - m.getEquipment().getItemInHand().getItemMeta().hasLore()) { - for (int i=0;i0 && p.getNoDamageTicks()0) { - double normaldmg=(this.plugin.DMGCALC.getDamage(p.getEquipment().getHelmet(), p.getEquipment().getChestplate(), p.getEquipment().getLeggings(), p.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - double throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - if (throughdmg>normaldmg+armor_pen) { - //This means some piercing can be done. - //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); - if (p.getHealth()-(normaldmg+armor_pen)>0) { - p.setHealth(p.getHealth()-(normaldmg+armor_pen)); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5")) { - if (m.getCustomName()!=null) { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" Took "+(Math.round(normaldmg+armor_pen)*10)/10+" damage from "+convertToItemName(m.getCustomName())+"."); - } else { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" Took "+(Math.round(normaldmg+armor_pen)*10)/10+" damage from "+convertToItemName(m.getType().getName())+"."); - } - } - } else { - e.setDamage(0); - FatalSurvivor(p); //Player died. Instead run fatal survivor. - } - } else { - //This means piercing would do extra damage. Just subtract throughdmg. - if (p.getHealth()-throughdmg>0) { - p.setHealth(p.getHealth()-throughdmg); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5")) { - if (m.getCustomName()!=null) { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" Took "+(Math.round(throughdmg)*10)/10+" damage from "+convertToItemName(m.getCustomName())+"."); - } else { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" Took "+(Math.round(throughdmg)*10)/10+" damage from "+convertToItemName(m.getType().getName())+"."); - } - } - } else { - e.setDamage(0); - FatalSurvivor(p); //Player died. Instead run fatal survivor. - } - } - e.setDamage(0); - } - } else - if (this.plugin.containsEnchantment(m.getEquipment().getItemInHand().getItemMeta().getLore().get(i), "Attack Speed") && this.plugin.getEnchantmentNumb(m.getEquipment().getItemInHand().getItemMeta().getLore().get(i))>0) { - double attack_speed=this.plugin.getEnchantmentNumb(m.getEquipment().getItemInHand().getItemMeta().getLore().get(i)); - p.setNoDamageTicks(p.getNoDamageTicks()-(int)(p.getNoDamageTicks()*(attack_speed/100.0d/4))); - } else - if (this.plugin.containsEnchantment(m.getEquipment().getItemInHand().getItemMeta().getLore().get(i), "Damage") && this.plugin.getEnchantmentNumb(m.getEquipment().getItemInHand().getItemMeta().getLore().get(i))>0) { - double dmg=this.plugin.getEnchantmentNumb(m.getEquipment().getItemInHand().getItemMeta().getLore().get(i)); - e.setDamage(e.getDamage()+dmg); - } - /* - if (attack_speed>0) { - f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d/4))); + if (m.getType()!=EntityType.ENDER_DRAGON && m.getType()!=EntityType.WITHER) { + if (m.getCustomName()==null) { + if (m.getHealth()>65) { + m.setHealth(65); //65 HP cap. + } + } else { + if (!m.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { //Make sure it's not a boss. + if (m.getHealth()>65) { + m.setHealth(65); //65 HP cap. } - if (dmg>0) { - e.setDamage(e.getDamage()+dmg); - }*/ } } } - } else { - if (!(e.getDamager() instanceof Player)) { - e.setDamage(e.getDamage()*1.75); //Multiply damage output by 1.75 for other things. - } } if (e.getEntity() instanceof LivingEntity) { + if (e.getDamager() instanceof Monster) { + e.setDamage(e.getDamage()*1.65d); //Damage of ALL mobs multiplied by x1.65. + Monster m = (Monster)e.getDamager(); + if (m.getType()!=EntityType.ENDER_DRAGON && m.getType()!=EntityType.WITHER) { + if (m.getCustomName()==null) { + if (m.getHealth()>65) { + m.setHealth(65); //65 HP cap. + } + } else { + if (!m.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { //Make sure it's not a boss. + if (m.getHealth()>65) { + m.setHealth(65); //65 HP cap. + } + } + } + } + } final LivingEntity l = (LivingEntity)e.getEntity(); if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { @@ -6455,7 +6417,7 @@ public ItemStack getGoodie() { //This is a player. Player g = (Player)nearbylist.get(k); extramobs+=this.plugin.getJobTotalLvs(g)/20; - l.setMaxHealth(this.plugin.getJobTotalLvs(g)+50); + l.setMaxHealth(l.getMaxHealth()+this.plugin.getJobTotalLvs(g)+50); l.setHealth(l.getMaxHealth()); ////Bukkit.getLogger().info("Mob maxgroup increased to "+maxgroup+" down here."); } @@ -6539,7 +6501,29 @@ public ItemStack getGoodie() { } ////Bukkit.getLogger().info("Made it through 1."); if (e.getEntity().getType()==EntityType.PLAYER) { - Player p = (Player)e.getEntity(); + final Player p = (Player)e.getEntity(); + if (e.getDamager() instanceof LivingEntity) { + final double player_starthp = p.getHealth(); + final LivingEntity l = (LivingEntity)e.getDamager(); + if (p.getNoDamageTicks()0) { p.setHealth(p.getHealth()-throughdmg); if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); + //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); } } else { e.setDamage(0); @@ -7025,7 +7009,7 @@ public ItemStack getGoodie() { if (p.getHealth()-e.getDamage()/2>0) { p.setHealth(p.getHealth()-e.getDamage()/2); if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(e.getDamage()/2*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); + //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(e.getDamage()/2*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); } } else { e.setDamage(0); @@ -7059,7 +7043,7 @@ public ItemStack getGoodie() { if (p.getHealth()-throughdmg>0) { p.setHealth(p.getHealth()-throughdmg); if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); + //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); } } else { e.setDamage(0); @@ -7069,7 +7053,7 @@ public ItemStack getGoodie() { if (p.getHealth()-e.getDamage()>0) { p.setHealth(p.getHealth()-e.getDamage()); if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(e.getDamage()*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); + //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(e.getDamage()*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); } } else { e.setDamage(0); @@ -7104,8 +7088,17 @@ public ItemStack getGoodie() { } //Bukkit.getLogger().info("Made it through 7."); if (e.getEntity() instanceof LivingEntity) { - LivingEntity f = (LivingEntity) e.getEntity(); + final LivingEntity f = (LivingEntity) e.getEntity(); + final double enemy_starthp = f.getHealth(); if (e.getDamager().getType()==EntityType.PLAYER || e.getDamager().getType()==EntityType.ARROW) { + if (e.getEntity() instanceof LivingEntity) { + LivingEntity enemy = (LivingEntity)e.getEntity(); + if (enemy.getCustomName()!=null) { + //Bukkit.getPlayer("sigonasr2").sendMessage(enemy.getCustomName()+" Health: "+enemy.getHealth()+"/"+enemy.getMaxHealth()); + } else { + //Bukkit.getPlayer("sigonasr2").sendMessage(enemy.getType()+" Health: "+enemy.getHealth()+"/"+enemy.getMaxHealth()); + } + } if (e.getDamager().getType()==EntityType.PLAYER) { if (e.getEntity() instanceof LivingEntity) { LivingEntity enemy = (LivingEntity)e.getEntity(); @@ -7125,7 +7118,21 @@ public ItemStack getGoodie() { } } } - Player p = (Player) e.getDamager(); + final Player p = (Player) e.getDamager(); + if (f.getNoDamageTicks()0) { - double normaldmg=(this.plugin.DMGCALC.getDamage(f.getEquipment().getHelmet(), f.getEquipment().getChestplate(), f.getEquipment().getLeggings(), f.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - double throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - - if (f.getNoDamageTicks()0) { - if (p.getHealth()+e.getDamage()*(life_steal/100.0d)0) { + if (p.getHealth()+e.getDamage()*(life_steal/100.0d)0) { - f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d/4))); - } - if (dmg>0) { - e.setDamage(e.getDamage()+dmg); - } - if (e.getEntity() instanceof LivingEntity) { - LivingEntity enemy = (LivingEntity)e.getEntity(); - if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GRAY+"Zombie Ninja")==0)) { - boolean found=false; - for (int i=0;i0) { + f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d/4))); + } + if (dmg>0) { + e.setDamage(e.getDamage()+dmg); + } + if (e.getEntity() instanceof LivingEntity) { + LivingEntity enemy = (LivingEntity)e.getEntity(); + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GRAY+"Zombie Ninja")==0)) { + boolean found=false; + for (int i=0;i=5) { - //Deal 2 extra damage. - e.setDamage(e.getDamage()+2); - } - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")>0) { - e.setDamage(e.getDamage()+(this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7"))/2)); - } + } + if (this.plugin.PlayerinJob((Player)((Projectile)e.getDamager()).getShooter(), "Hunter") && this.plugin.getJobLv("Hunter", (Player)((Projectile)e.getDamager()).getShooter())>=5) { + //Deal 2 extra damage. + e.setDamage(e.getDamage()+2); + } + if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")>0) { + e.setDamage(e.getDamage()+(this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7"))/2)); + } + if (f.getNoDamageTicks()0) { + double normaldmg=(this.plugin.DMGCALC.getDamage(f.getEquipment().getHelmet(), f.getEquipment().getChestplate(), f.getEquipment().getLeggings(), f.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); + double throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); + + if (throughdmg>normaldmg+armor_pen) { //This means some piercing can be done. //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); @@ -7403,9 +7425,9 @@ public ItemStack getGoodie() { f.setHealth(f.getHealth()-(normaldmg+armor_pen)); if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { if (f.getCustomName()!=null) { - p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); + //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); } else { - p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); } } } else { @@ -7417,9 +7439,9 @@ public ItemStack getGoodie() { f.setHealth(f.getHealth()-throughdmg); if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { if (f.getCustomName()!=null) { - p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); + //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); } else { - p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); } } } else { @@ -7439,9 +7461,9 @@ public ItemStack getGoodie() { f.setHealth(f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))); if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { if (f.getCustomName()!=null) { - p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getCustomName())+"."); + //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getCustomName())+"."); } else { - p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getType().getName())+"."); + //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getType().getName())+"."); } } } else { @@ -7453,9 +7475,9 @@ public ItemStack getGoodie() { f.setHealth(f.getHealth()-throughdmg); if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { if (f.getCustomName()!=null) { - p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); + //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); } else { - p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); } } } else { @@ -7467,9 +7489,9 @@ public ItemStack getGoodie() { if (f.getNoDamageTicks()=20) { diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 702df00..7a07ccf 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -30,6 +30,8 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.MerchantInventory; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.EditSession; @@ -491,6 +493,21 @@ public String convertToItemName(String val) { } } else if (cmd.getName().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) { + if (args[0].equalsIgnoreCase("halloween_reward")) { + Bukkit.broadcastMessage(args[1]+" has won the Pumpkin Patch contest due to popular vote! "+ChatColor.BOLD+"Congratulations!"); + Player f = Bukkit.getPlayer(args[1]); + f.sendMessage("You have received $800 in holding money, and 5 Job Boost cards!"); + this.plugin.economy.depositPlayer(args[1], 800); + ItemStack i = new ItemStack(Material.getMaterial(34),5); + ItemMeta meta = i.getItemMeta(); + meta.setDisplayName(ChatColor.LIGHT_PURPLE+"Job Boost Card"); + List lore = new ArrayList(); + lore.add("Use /jobs boost to instantly level up"); + lore.add("that job with this card!"); + meta.setLore(lore); + i.setItemMeta(meta); + f.getInventory().addItem(i); + } if (args[0].equalsIgnoreCase("halloween") && args[1].equalsIgnoreCase("end")) { p.sendMessage(ChatColor.GRAY+"Ending Harrowing night... Did you make sure it was night time? If not, type this command again after /time night instead."); this.plugin.harrowing_night=true; @@ -844,6 +861,12 @@ public String convertToItemName(String val) { } ItemMeta meta1 = item.getItemMeta(); meta1.setLore(ourLore); + if (rarity==1) { + meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); + } + if (rarity==2) { + meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); + } item.setItemMeta(meta1); } else if (type2.equalsIgnoreCase("SPADE") || type2.equalsIgnoreCase("PICKAXE") || type2.equalsIgnoreCase("HOE") || type2.equalsIgnoreCase("AXE")) { int enchants[] = {32,33,34,35}; @@ -896,6 +919,12 @@ public String convertToItemName(String val) { } ItemMeta meta1 = item.getItemMeta(); meta1.setLore(ourLore); + if (rarity==1) { + meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); + } + if (rarity==2) { + meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); + } item.setItemMeta(meta1); } else { int enchants[] = {0,1,2,3,4,5,6,7,34}; @@ -977,10 +1006,10 @@ public String convertToItemName(String val) { ItemMeta meta1 = item.getItemMeta(); meta1.setLore(ourLore); if (rarity==1) { - meta1.setDisplayName(ChatColor.BLUE+"Rare "+item.getType().name().replace("_", " ")); + meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); } if (rarity==2) { - meta1.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+item.getType().name().replace("_", " ")); + meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); } item.setItemMeta(meta1); } @@ -1002,6 +1031,9 @@ public String convertToItemName(String val) { wand_meta.setLore(newLore); wand.setItemMeta(wand_meta); p.getInventory().addItem(wand); + p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,1728000,1)); + p.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST,1728000,1)); + p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,1728000,0)); } } },400); @@ -1395,7 +1427,7 @@ public String convertToItemName(String val) { double deathZ = this.plugin.getAccountsConfig().getDouble(p.getName() + ".deathpointZ"); String deathWorld = this.plugin.getAccountsConfig().getString(p.getName() + ".deathworld"); //p.sendMessage("Got 1."); - if (this.plugin.getAccountsConfig().getBoolean(p.getName() + ".revived")==false && p.getPlayerTime()-this.plugin.getAccountsConfig().getDouble(p.getName() + ".revivetime")<12000) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName() + ".revived")==false && p.getPlayerTime()-this.plugin.getAccountsConfig().getLong(p.getName() + ".revivetime")<12000) { double mincost = this.plugin.getConfig().getDouble("revive-cost-rate"); //p.sendMessage("Got 2."); if (p.getBedSpawnLocation()!=null) { @@ -1412,7 +1444,7 @@ public String convertToItemName(String val) { if (mymoney>=finalcost) { this.plugin.getAccountsConfig().set(p.getName() + ".revived", Boolean.valueOf(true)); this.plugin.getAccountsConfig().set(p.getName() + ".money", mymoney-finalcost); - this.plugin.getAccountsConfig().set(p.getName() + ".revivetime", Double.valueOf(0.0d)); + this.plugin.getAccountsConfig().set(p.getName() + ".revivetime", Long.valueOf(0)); this.plugin.saveAccountsConfig(); //p.sendMessage("Got 4."); p.sendMessage("You spent $"+df.format(finalcost)+" to revive. New Bank Balance: $"+ChatColor.YELLOW+df.format(mymoney-finalcost)); @@ -1479,7 +1511,7 @@ public String convertToItemName(String val) { double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); - finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); + //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. this.plugin.getAccountsConfig().set(p.getName() + ".money", mymoney-finalcost); @@ -1504,7 +1536,7 @@ public String convertToItemName(String val) { double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); - finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); + //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); @@ -1533,7 +1565,7 @@ public String convertToItemName(String val) { double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); - finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); + //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); @@ -1565,6 +1597,10 @@ public String convertToItemName(String val) { //Attempt to join the job. this.plugin.setUltimate(p,args[1]); } else + if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("boost")) { + //Attempt to level up the job. + this.plugin.levelUpJob(p,args[1]); + } else if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("join")) { //Attempt to join the job. this.plugin.joinJob(p,args[1]);