diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$1.class b/BankEconomyMod/bin/me/kaZep/Base/Main$1.class index 404ee69..2a66184 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 a7dafbb..753eeb4 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 88b6a1c..c9406ed 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 2ffda51..041755b 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 d27926f..3d924de 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/PlayerBuffData.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerBuffData.class index bf01e8b..685618e 100644 Binary files a/BankEconomyMod/bin/me/kaZep/Base/PlayerBuffData.class and b/BankEconomyMod/bin/me/kaZep/Base/PlayerBuffData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class index c1bb240..91877cd 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 f175418..7c5e1e8 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 d3fa4db..8dc7f74 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 a45d58b..3b04fe3 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 ae93295..3633aa5 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 8205c2d..50f73b8 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 b62f37b..19e19b1 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 bfe9f16..f5a8588 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/plugin.yml b/BankEconomyMod/plugin.yml index ddc0d33..7a925b8 100644 --- a/BankEconomyMod/plugin.yml +++ b/BankEconomyMod/plugin.yml @@ -1,6 +1,6 @@ name: BankEconomy main: me.kaZep.Base.Main -version: 257 +version: 259 description: Bank plugin which stores money. commands: bankeconomy: diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 35bd923..ed62236 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -13,6 +13,7 @@ import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Random; import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; @@ -23,6 +24,7 @@ import me.kaZep.Commands.commandBankEconomy; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.Chunk; import org.bukkit.DyeColor; import org.bukkit.Effect; import org.bukkit.Location; @@ -47,6 +49,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Monster; import org.bukkit.entity.PigZombie; import org.bukkit.entity.Player; import org.bukkit.entity.Sheep; @@ -147,6 +150,7 @@ public class Main extends JavaPlugin public List playerdata_list = null; public List ninjavisible_list = null; public List revive_inventory_list = null; + public List chunk_queue_list = null; public DamageAPI DMGCALC = null; @@ -234,6 +238,7 @@ public class Main extends JavaPlugin playerdata_list = new ArrayList(); ninjavisible_list = new ArrayList(); revive_inventory_list = new ArrayList(); + chunk_queue_list = new ArrayList(); //Add Recipes for new Block armor crafting. ShapedRecipe iron_helmet = new ShapedRecipe(new ItemStack(Material.IRON_HELMET)); @@ -640,6 +645,8 @@ public class Main extends JavaPlugin Enchanter_job.setExp(50, 40, 8, 1.08); Enchanter_job.addExtraData("Each level of enchantment multiplies your income and exp gain exponentially."); Enchanter_job.addExtraData("Ex. If PROTECTION gives $0.08 and 4XP, PROTECTION III would give you x9 exp and money: $0.72 and 36XP."); + Enchanter_job.addExtraData(""); + Enchanter_job.addExtraData("Enchanters also gain some exp and income if job buffs automatically enchant items, such as the Weaponsmith/Blacksmith job. Note this is a very small amount and does not give as much as enchanting an item of your own."); Enchanter_job.addData("PROTECTION", 0.08, 4, 0); Enchanter_job.addData("SMITE", 0.10, 8, 0); Enchanter_job.addData("FIRE PROTECTION", 0.10, 6, 0); @@ -934,6 +941,7 @@ public void runTick() { REVIVE_EFFECT--; //Bukkit.getPlayer("sigonasr2").sendMessage(REVIVE_EFFECT+""); } + List lineofsight_check = new ArrayList(); for (int zx=0;zx0 && chunk_queue_list.get(0).isLoaded() && chunk_queue_list.get(0).getWorld().getName().equalsIgnoreCase("world")) { + //Load up this chunk if it's loaded and check things. + //Attempt to load up the custom chunk. + List debugmessages = new ArrayList(); + FileConfiguration customchunk = reloadChunksConfig(chunk_queue_list.get(0).getX(), chunk_queue_list.get(0).getZ()); + if (!customchunk.contains("animal-reset2")) { + customchunk.set("animal-reset2", Long.valueOf(Bukkit.getWorld("world").getFullTime()+17280000)); + Chunk c = chunk_queue_list.get(0); + Random r = new Random(); + for (int x=0;x<16;x++) { + for (int z=0;z<16;z++) { + if (r.nextDouble()<=0.000244140625) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,Bukkit.getWorld("world").getHighestBlockYAt(x+c.getX()*16, z+c.getZ()*16),z+c.getZ()*16); + if (b.getType()!=Material.WATER && b.getType()!=Material.ICE && b.getType()!=Material.LAVA && !b.getBiome().name().equalsIgnoreCase("ocean") && !b.getBiome().name().equalsIgnoreCase("river")) { + if (b.getType()==Material.SNOW || b.getType()==Material.DIRT || b.getType()==Material.SAND || b.getType()==Material.LEAVES || b.getType()==Material.GRASS || b.getType()==Material.GRAVEL || b.getType()==Material.STONE || b.getType()==Material.COBBLESTONE || b.getType()==Material.MYCEL || b.getType()==Material.BROWN_MUSHROOM || b.getType()==Material.RED_MUSHROOM) { + if (b.getBiome().name().equalsIgnoreCase("plains")) { + //Best place for things to spawn. Any mob type can spawn here. + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.HORSE,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + } else { + if (b.getBiome().name().equalsIgnoreCase("forest")) { + //Wolves can still spawn here. Horses cannot. + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + }else { + if (b.getBiome().name().equalsIgnoreCase("jungle")) { + //Chance to spawn ocelots here. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.OCELOT}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + }else { + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + } + } + } + } + } + } + ////Bukkit.getLogger().info("Biome here is "+b.getBiome().name()); + } + } + } else { + //Check the value and regenerate if necessary. + if (Bukkit.getWorld("world").getFullTime()>customchunk.getLong("animal-reset2")) { + customchunk.set("animal-reset2", Long.valueOf(Bukkit.getWorld("world").getFullTime()+17280000)); + Chunk c = chunk_queue_list.get(0); + Random r = new Random(); + for (int x=0;x<16;x++) { + for (int z=0;z<16;z++) { + if (r.nextDouble()<=0.000244140625) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,Bukkit.getWorld("world").getHighestBlockYAt(x+c.getX()*16, z+c.getZ()*16),z+c.getZ()*16); + if (b.getType()!=Material.WATER && b.getType()!=Material.ICE && b.getType()!=Material.LAVA && !b.getBiome().name().equalsIgnoreCase("ocean") && !b.getBiome().name().equalsIgnoreCase("river")) { + if (b.getType()==Material.SNOW || b.getType()==Material.DIRT || b.getType()==Material.SAND || b.getType()==Material.LEAVES || b.getType()==Material.GRASS || b.getType()==Material.GRAVEL || b.getType()==Material.STONE || b.getType()==Material.COBBLESTONE || b.getType()==Material.MYCEL || b.getType()==Material.BROWN_MUSHROOM || b.getType()==Material.RED_MUSHROOM) { + if (b.getBiome().name().equalsIgnoreCase("plains")) { + //Best place for things to spawn. Any mob type can spawn here. + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.HORSE,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + } else { + if (b.getBiome().name().equalsIgnoreCase("forest")) { + //Wolves can still spawn here. Horses cannot. + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + }else { + if (b.getBiome().name().equalsIgnoreCase("jungle")) { + //Chance to spawn ocelots here. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.OCELOT}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + }else { + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + } + } + } + } + } + } + ////Bukkit.getLogger().info("Biome here is "+b.getBiome().name()); + } + } + } + } + if (!customchunk.contains("diamond-generate")) { + customchunk.set("diamond-generate", Boolean.valueOf(true)); + Chunk c = chunk_queue_list.get(0); + int adddiamond=0; + for (int x=0;x<16;x++) { + for (int y=5;y<25;y++) { + for (int z=0;z<16;z++) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); + if (b!=null && b.getType()==Material.STONE) { + if (Math.random()<=0.000625) { + int i=(int)(Math.random()*8.0d)+1; + while (i>0) { + Block d = c.getBlock(x+(int)(Math.random()*i)-(int)(Math.random()*i), y+(int)(Math.random()*i)-(int)(Math.random()*i), z+(int)(Math.random()*i)-(int)(Math.random()*i)); + adddiamond++; + b.setType(Material.DIAMOND_ORE); + i--; + } + //Make a patch between 1 and 8. + } + } + } + } + } + ////Bukkit.getLogger().info("Generated "+adddiamond+" new diamonds for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()); + if (adddiamond>0) { + debugmessages.add(" Added "+adddiamond+" diamond"+((adddiamond!=1)?"s":"")+"."); + } + } + if (!customchunk.contains("limit-ore-generation")) { + customchunk.set("limit-ore-generation", Boolean.valueOf(true)); + Chunk c = chunk_queue_list.get(0); + int removeore=0,totalore=0,newore=0; + for (int x=0;x<16;x++) { + for (int y=5;y<96;y++) { + for (int z=0;z<16;z++) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); + if (b!=null && (b.getType()==Material.COAL_ORE || + b.getType()==Material.IRON_ORE || + b.getType()==Material.GOLD_ORE || + b.getType()==Material.REDSTONE_ORE || + b.getType()==Material.LAPIS_ORE || + b.getType()==Material.DIAMOND_ORE)) { + if (Math.random()<=0.60) { + removeore++; + b.setType(Material.STONE); + //Make a patch between 1 and 8. + } + totalore++; + } + } + } + } + for (int x=0;x<16;x++) { + for (int y=5;y<96;y++) { + for (int z=0;z<16;z++) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); + if (b!=null && (b.getType()==Material.COAL_ORE || + b.getType()==Material.IRON_ORE || + b.getType()==Material.GOLD_ORE || + b.getType()==Material.REDSTONE_ORE || + b.getType()==Material.LAPIS_ORE || + b.getType()==Material.DIAMOND_ORE)) { + newore++; + } + } + } + } + ////Bukkit.getLogger().info("Removed "+removeore+"/"+totalore+" ore for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+". There are now "+newore+" ores left."); + debugmessages.add(" Removed: "+removeore+"/"+totalore+" ores."); + } + saveChunksConfig(customchunk, chunk_queue_list.get(0).getX(), chunk_queue_list.get(0).getZ()); + if (debugmessages.size()>0) { + for (int i=0;i nearby = p.getNearbyEntities(20, 12, 20); //List nearby2 = p.getNearbyEntities(10, 6, 10); for (int i=0;i6) { + bar+=ChatColor.GREEN+""; + } else + if (bits>3) { + bar+=ChatColor.YELLOW+""; + } else + { + bar+=ChatColor.RED+""; + } + } else { + if (bits>6) { + bar+=ChatColor.DARK_GREEN+""; + } else + if (bits>3) { + bar+=ChatColor.GOLD+""; + } else + { + bar+=ChatColor.DARK_RED+""; + } + } + for (int i=0;i thelore = item.getItemMeta().getLore(); + for (int i=0;i ourLore = new ArrayList(); + if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. + List thelore = e.getItem().getItemMeta().getLore(); + for (int i=0;i ourLore = new ArrayList(); + if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. + List thelore = e.getItem().getItemMeta().getLore(); + for (int i=0;i ourLore = new ArrayList(); + if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. + List thelore = e.getItem().getItemMeta().getLore(); + for (int i=0;i ourLore = new ArrayList(); + if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. + List thelore = e.getItem().getItemMeta().getLore(); + for (int i=0;i ourLore = new ArrayList(); + if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. + List thelore = e.getItem().getItemMeta().getLore(); + for (int i=0;i ourLore = new ArrayList(); + if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. + List thelore = e.getItem().getItemMeta().getLore(); + for (int i=0;i ourLore = new ArrayList(); + if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. + List thelore = e.getItem().getItemMeta().getLore(); + for (int i=0;i ourLore = new ArrayList(); + if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. + List thelore = e.getItem().getItemMeta().getLore(); + for (int i=0;ip.getMaxHealth()) { @@ -3420,7 +3510,7 @@ public class PlayerListener p.setHealth(p.getHealth()+12); } //shooter.sendMessage("This is a heal."); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); } } } @@ -3439,7 +3529,7 @@ public class PlayerListener Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { @Override public void run() { - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); } },5); try { @@ -5184,7 +5274,13 @@ public ItemStack getGoodie() { public void onFoodLevelChange(FoodLevelChangeEvent e) { //Check for nearby support. if (e.getEntity().getType()==EntityType.PLAYER) { - HumanEntity p = (HumanEntity)e.getEntity(); + final Player p = (Player)e.getEntity(); + Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { + @Override + public void run() { + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); + } + },5); if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")>0) { if (Math.random()<=this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9"))/100.0d) { e.setFoodLevel(e.getFoodLevel()+1); @@ -5359,234 +5455,9 @@ public ItemStack getGoodie() { } this.plugin.cleaned=true; } - if (!e.isNewChunk()) { //Make sure this chunk is an existing one. - //Attempt to load up the custom chunk. - List debugmessages = new ArrayList(); - FileConfiguration customchunk = this.plugin.reloadChunksConfig(e.getChunk().getX(), e.getChunk().getZ()); - if (!customchunk.contains("animal-reset2")) { - customchunk.set("animal-reset2", Long.valueOf(Bukkit.getWorld("world").getFullTime()+17280000)); - Chunk c = e.getChunk(); - Random r = new Random(); - for (int x=0;x<16;x++) { - for (int z=0;z<16;z++) { - if (r.nextDouble()<=0.000244140625) { - Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,Bukkit.getWorld("world").getHighestBlockYAt(x+c.getX()*16, z+c.getZ()*16),z+c.getZ()*16); - if (b.getType()!=Material.WATER && b.getType()!=Material.ICE && b.getType()!=Material.LAVA && !b.getBiome().name().equalsIgnoreCase("ocean") && !b.getBiome().name().equalsIgnoreCase("river")) { - if (b.getType()==Material.SNOW || b.getType()==Material.DIRT || b.getType()==Material.SAND || b.getType()==Material.LEAVES || b.getType()==Material.GRASS || b.getType()==Material.GRAVEL || b.getType()==Material.STONE || b.getType()==Material.COBBLESTONE || b.getType()==Material.MYCEL || b.getType()==Material.BROWN_MUSHROOM || b.getType()==Material.RED_MUSHROOM) { - if (b.getBiome().name().equalsIgnoreCase("plains")) { - //Best place for things to spawn. Any mob type can spawn here. - //Choose a mob type randomly. - EntityType[] mobs = {EntityType.COW,EntityType.HORSE,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; - int i=(int)(Math.random()*4)+2; - EntityType selected = mobs[(int)(mobs.length*Math.random())]; - ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); - debugmessages.add(" Spawned: "+i+" "+selected.getName()); - while (i>0) { - LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); - f.setRemoveWhenFarAway(false); //This should be a permanent mob. - i--; - } - } else { - if (b.getBiome().name().equalsIgnoreCase("forest")) { - //Wolves can still spawn here. Horses cannot. - //Choose a mob type randomly. - EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; - int i=(int)(Math.random()*4)+2; - EntityType selected = mobs[(int)(mobs.length*Math.random())]; - ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); - debugmessages.add(" Spawned: "+i+" "+selected.getName()); - while (i>0) { - LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); - f.setRemoveWhenFarAway(false); //This should be a permanent mob. - i--; - } - }else { - if (b.getBiome().name().equalsIgnoreCase("jungle")) { - //Chance to spawn ocelots here. - EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.OCELOT}; - int i=(int)(Math.random()*4)+2; - EntityType selected = mobs[(int)(mobs.length*Math.random())]; - ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); - debugmessages.add(" Spawned: "+i+" "+selected.getName()); - while (i>0) { - LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); - f.setRemoveWhenFarAway(false); //This should be a permanent mob. - i--; - } - }else { - //Choose a mob type randomly. - EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN}; - int i=(int)(Math.random()*4)+2; - EntityType selected = mobs[(int)(mobs.length*Math.random())]; - ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); - debugmessages.add(" Spawned: "+i+" "+selected.getName()); - while (i>0) { - LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); - f.setRemoveWhenFarAway(false); //This should be a permanent mob. - i--; - } - } - } - } - } - } - } - ////Bukkit.getLogger().info("Biome here is "+b.getBiome().name()); - } - } - } else { - //Check the value and regenerate if necessary. - if (Bukkit.getWorld("world").getFullTime()>customchunk.getLong("animal-reset2")) { - customchunk.set("animal-reset2", Long.valueOf(Bukkit.getWorld("world").getFullTime()+17280000)); - Chunk c = e.getChunk(); - Random r = new Random(); - for (int x=0;x<16;x++) { - for (int z=0;z<16;z++) { - if (r.nextDouble()<=0.000244140625) { - Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,Bukkit.getWorld("world").getHighestBlockYAt(x+c.getX()*16, z+c.getZ()*16),z+c.getZ()*16); - if (b.getType()!=Material.WATER && b.getType()!=Material.ICE && b.getType()!=Material.LAVA && !b.getBiome().name().equalsIgnoreCase("ocean") && !b.getBiome().name().equalsIgnoreCase("river")) { - if (b.getType()==Material.SNOW || b.getType()==Material.DIRT || b.getType()==Material.SAND || b.getType()==Material.LEAVES || b.getType()==Material.GRASS || b.getType()==Material.GRAVEL || b.getType()==Material.STONE || b.getType()==Material.COBBLESTONE || b.getType()==Material.MYCEL || b.getType()==Material.BROWN_MUSHROOM || b.getType()==Material.RED_MUSHROOM) { - if (b.getBiome().name().equalsIgnoreCase("plains")) { - //Best place for things to spawn. Any mob type can spawn here. - //Choose a mob type randomly. - EntityType[] mobs = {EntityType.COW,EntityType.HORSE,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; - int i=(int)(Math.random()*4)+2; - EntityType selected = mobs[(int)(mobs.length*Math.random())]; - ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); - debugmessages.add(" Spawned: "+i+" "+selected.getName()); - while (i>0) { - LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); - f.setRemoveWhenFarAway(false); //This should be a permanent mob. - i--; - } - } else { - if (b.getBiome().name().equalsIgnoreCase("forest")) { - //Wolves can still spawn here. Horses cannot. - //Choose a mob type randomly. - EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; - int i=(int)(Math.random()*4)+2; - EntityType selected = mobs[(int)(mobs.length*Math.random())]; - ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); - debugmessages.add(" Spawned: "+i+" "+selected.getName()); - while (i>0) { - LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); - f.setRemoveWhenFarAway(false); //This should be a permanent mob. - i--; - } - }else { - if (b.getBiome().name().equalsIgnoreCase("jungle")) { - //Chance to spawn ocelots here. - EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.OCELOT}; - int i=(int)(Math.random()*4)+2; - EntityType selected = mobs[(int)(mobs.length*Math.random())]; - ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); - debugmessages.add(" Spawned: "+i+" "+selected.getName()); - while (i>0) { - LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); - f.setRemoveWhenFarAway(false); //This should be a permanent mob. - i--; - } - }else { - //Choose a mob type randomly. - EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN}; - int i=(int)(Math.random()*4)+2; - EntityType selected = mobs[(int)(mobs.length*Math.random())]; - ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); - debugmessages.add(" Spawned: "+i+" "+selected.getName()); - while (i>0) { - LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); - f.setRemoveWhenFarAway(false); //This should be a permanent mob. - i--; - } - } - } - } - } - } - } - ////Bukkit.getLogger().info("Biome here is "+b.getBiome().name()); - } - } - } - } - if (!customchunk.contains("diamond-generate")) { - customchunk.set("diamond-generate", Boolean.valueOf(true)); - Chunk c = e.getChunk(); - int adddiamond=0; - for (int x=0;x<16;x++) { - for (int y=5;y<25;y++) { - for (int z=0;z<16;z++) { - Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); - if (b!=null && b.getType()==Material.STONE) { - if (Math.random()<=0.000625) { - int i=(int)(Math.random()*8.0d)+1; - while (i>0) { - Block d = c.getBlock(x+(int)(Math.random()*i)-(int)(Math.random()*i), y+(int)(Math.random()*i)-(int)(Math.random()*i), z+(int)(Math.random()*i)-(int)(Math.random()*i)); - adddiamond++; - b.setType(Material.DIAMOND_ORE); - i--; - } - //Make a patch between 1 and 8. - } - } - } - } - } - ////Bukkit.getLogger().info("Generated "+adddiamond+" new diamonds for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()); - if (adddiamond>0) { - debugmessages.add(" Added "+adddiamond+" diamond"+((adddiamond!=1)?"s":"")+"."); - } - } - if (!customchunk.contains("limit-ore-generation")) { - customchunk.set("limit-ore-generation", Boolean.valueOf(true)); - Chunk c = e.getChunk(); - int removeore=0,totalore=0,newore=0; - for (int x=0;x<16;x++) { - for (int y=5;y<96;y++) { - for (int z=0;z<16;z++) { - Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); - if (b!=null && (b.getType()==Material.COAL_ORE || - b.getType()==Material.IRON_ORE || - b.getType()==Material.GOLD_ORE || - b.getType()==Material.REDSTONE_ORE || - b.getType()==Material.LAPIS_ORE || - b.getType()==Material.DIAMOND_ORE)) { - if (Math.random()<=0.60) { - removeore++; - b.setType(Material.STONE); - //Make a patch between 1 and 8. - } - totalore++; - } - } - } - } - for (int x=0;x<16;x++) { - for (int y=5;y<96;y++) { - for (int z=0;z<16;z++) { - Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); - if (b!=null && (b.getType()==Material.COAL_ORE || - b.getType()==Material.IRON_ORE || - b.getType()==Material.GOLD_ORE || - b.getType()==Material.REDSTONE_ORE || - b.getType()==Material.LAPIS_ORE || - b.getType()==Material.DIAMOND_ORE)) { - newore++; - } - } - } - } - ////Bukkit.getLogger().info("Removed "+removeore+"/"+totalore+" ore for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+". There are now "+newore+" ores left."); - debugmessages.add(" Removed: "+removeore+"/"+totalore+" ores."); - } - this.plugin.saveChunksConfig(customchunk, e.getChunk().getX(), e.getChunk().getZ()); - if (debugmessages.size()>0) { - for (int i=0;i640) { + this.plugin.chunk_queue_list.remove(0); } } @@ -5760,7 +5631,7 @@ public ItemStack getGoodie() { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { @Override public void run() { - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); } },5); //p.sendMessage("Your Health: "+p.getHealth()+", Damage: "+e.getDamage()+", Actual: "+this.plugin.DMGCALC.getDamage(p, e.getDamage(), DamageCause.ENTITY_ATTACK)); @@ -5879,7 +5750,7 @@ public ItemStack getGoodie() { public void onRegainHealth(EntityRegainHealthEvent e) { if (e.getEntity().getType()==EntityType.PLAYER) { Player p = (Player)e.getEntity(); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); try { Iterator effects = p.getActivePotionEffects().iterator(); //Figure out potion effects when player joins. @@ -6042,7 +5913,7 @@ public ItemStack getGoodie() { ////Bukkit.getLogger().info("Made it through 1."); if (e.getEntity().getType()==EntityType.PLAYER) { Player p = (Player)e.getEntity(); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); int slot=0; for (int i=0;iblocks = new ArrayList(); //Corresponds to helmet, chestplate, leggings, and boots. //Found the slot. Check armor values. double block_chance=0,speed_boost_chance=0; if (p.getEquipment().getBoots()!=null) { ItemStack item = p.getEquipment().getBoots(); + if (this.plugin.isBroken(item)) { + //Add it either to our inventory, or drop on the ground. + if (this.plugin.inventoryFull(p)) { + //Drop it on the ground. + p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+item.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory."); + p.getWorld().dropItemNaturally(p.getLocation(), item); + } else { + p.getInventory().addItem(item); + } + + //Remove it from the slot. + p.getEquipment().setBoots(new ItemStack(Material.AIR)); + } else if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { for (int i=0;i0 && Math.random()<=0.76+extradurability) { item.setDurability((short)(item.getDurability()-1)); ////Bukkit.getLogger().info("Armor durability now "+item.getDurability()); } @@ -6118,20 +6003,34 @@ public ItemStack getGoodie() { //Bukkit.getLogger().info("Made it through 2.1."); if (p.getEquipment().getChestplate()!=null) { ItemStack item = p.getEquipment().getChestplate(); + if (this.plugin.isBroken(item)) { + //Add it either to our inventory, or drop on the ground. + if (this.plugin.inventoryFull(p)) { + //Drop it on the ground. + p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+item.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory."); + p.getWorld().dropItemNaturally(p.getLocation(), item); + } else { + p.getInventory().addItem(item); + } + + //Remove it from the slot. + p.getEquipment().setChestplate(new ItemStack(Material.AIR)); + } else if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { for (int i=0;i100) { @@ -6159,7 +6058,7 @@ public ItemStack getGoodie() { } } } - if (Math.random()<=0.76+extradurability) { + if (extradurability>0 && Math.random()<=0.76+extradurability) { item.setDurability((short)(item.getDurability()-1)); ////Bukkit.getLogger().info("Armor durability now "+item.getDurability()); } @@ -6172,20 +6071,34 @@ public ItemStack getGoodie() { //Bukkit.getLogger().info("Made it through 2.2."); if (p.getEquipment().getLeggings()!=null) { ItemStack item = p.getEquipment().getLeggings(); + if (this.plugin.isBroken(item)) { + //Add it either to our inventory, or drop on the ground. + if (this.plugin.inventoryFull(p)) { + //Drop it on the ground. + p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+item.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory."); + p.getWorld().dropItemNaturally(p.getLocation(), item); + } else { + p.getInventory().addItem(item); + } + + //Remove it from the slot. + p.getEquipment().setLeggings(new ItemStack(Material.AIR)); + } else if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { for (int i=0;i100) { @@ -6213,7 +6126,7 @@ public ItemStack getGoodie() { } } } - if (Math.random()<=0.76+extradurability) { + if (extradurability>0 && Math.random()<=0.76+extradurability) { item.setDurability((short)(item.getDurability()-1)); ////Bukkit.getLogger().info("Armor durability now "+item.getDurability()); } @@ -6226,20 +6139,34 @@ public ItemStack getGoodie() { //Bukkit.getLogger().info("Made it through 2.3"); if (p.getEquipment().getHelmet()!=null) { ItemStack item = p.getEquipment().getHelmet(); + if (this.plugin.isBroken(item)) { + //Add it either to our inventory, or drop on the ground. + if (this.plugin.inventoryFull(p)) { + //Drop it on the ground. + p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+item.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory."); + p.getWorld().dropItemNaturally(p.getLocation(), item); + } else { + p.getInventory().addItem(item); + } + + //Remove it from the slot. + p.getEquipment().setHelmet(new ItemStack(Material.AIR)); + } else if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { for (int i=0;i100) { @@ -6267,7 +6194,7 @@ public ItemStack getGoodie() { } } } - if (Math.random()<=0.76+extradurability) { + if (extradurability>0 && Math.random()<=0.76+extradurability) { item.setDurability((short)(item.getDurability()-1)); ////Bukkit.getLogger().info("Armor durability now "+item.getDurability()); } @@ -6280,7 +6207,7 @@ public ItemStack getGoodie() { //Bukkit.getLogger().info("Made it through 3."); //This is the player getting hit. for (int i=0;i0) { - f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d))); + f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d/4))); } if (dmg>0) { e.setDamage(e.getDamage()+dmg); @@ -6671,7 +6613,7 @@ public ItemStack getGoodie() { } else { if (((Projectile)e.getDamager()).getShooter()!=null && ((Projectile)e.getDamager()).getShooter().getType()==EntityType.PLAYER) { Player p = (Player)((Projectile)e.getDamager()).getShooter(); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); ItemStack item = p.getItemInHand(); double critical_chance=0,armor_pen=0,life_steal=0,attack_speed=0,dmg=0; if (item.getType()==Material.BOW && item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { //Make sure we are using a ranged weapon. @@ -6680,7 +6622,7 @@ public ItemStack getGoodie() { if (critical_chance==0) { critical_chance+=this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i)); } else { - critical_chance+=critical_chance*(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/100d); + critical_chance+=(100-critical_chance)*(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/100d); } } if (this.plugin.containsEnchantment(item.getItemMeta().getLore().get(i), "Armor Penetration")) { @@ -6690,14 +6632,14 @@ public ItemStack getGoodie() { if (life_steal==0) { life_steal+=this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i)); } else { - life_steal+=life_steal*(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/100d); + life_steal+=(100-life_steal)*(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/100d); } } if (this.plugin.containsEnchantment(item.getItemMeta().getLore().get(i), "Attack Speed")) { if (attack_speed==0) { attack_speed+=this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i)); } else { - attack_speed+=attack_speed*(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/100d); + attack_speed+=(100-attack_speed)*(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/100d); } } if (this.plugin.containsEnchantment(item.getItemMeta().getLore().get(i), "Damage")) { @@ -6753,7 +6695,7 @@ public ItemStack getGoodie() { } } if (attack_speed>0) { - f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d))); + f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d/4))); } if (dmg>0) { e.setDamage(e.getDamage()+dmg); @@ -6854,7 +6796,7 @@ public ItemStack getGoodie() { } if (f.getKiller()!=null && f.getKiller().getType()==EntityType.PLAYER) { Player p = f.getKiller(); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); //p.sendMessage(f.getType()+" is mad at you."); //if (p.getName().equalsIgnoreCase("sigonasr2")) {p.sendMessage("You are the killer of "+f.getCustomName()+".");} if (this.plugin.PlayerinJob(p, "Hunter")) { @@ -7499,8 +7441,8 @@ public ItemStack getGoodie() { @EventHandler public void onItemBreak(PlayerItemBreakEvent e) { - Player p = e.getPlayer(); - ItemStack i = e.getBrokenItem(); + final Player p = e.getPlayer(); + final ItemStack i = e.getBrokenItem(); if (i.getItemMeta()!=null && i.getItemMeta().hasDisplayName() && i.getItemMeta().getDisplayName().compareTo("Spleef Wooden Shovel")==0) { i.setDurability((short)0); p.getInventory().addItem(i); @@ -7511,21 +7453,23 @@ public ItemStack getGoodie() { for (int j=0;j enchants1 = new ArrayList(); - List enchants2 = new ArrayList(); - ItemStack finalitem = null; - if (type==0) { - finalitem=new ItemStack(Material.DIAMOND_HELMET); - enchants1.add("Protective"); - enchants1.add("Fire-Proof"); - enchants1.add("Blast Resistant"); - enchants1.add("Untouchable"); - enchants1.add("Breathing"); - enchants1.add("Working"); - enchants1.add("Unbreaking"); - enchants1.add("Thorny"); - enchants2.add("Life"); - enchants2.add("Resistance"); - enchants2.add("Durability"); - enchants2.add("Protection"); - } - if (type==1) { - finalitem=new ItemStack(Material.DIAMOND_CHESTPLATE); - enchants1.add("Protective"); - enchants1.add("Fire-Proof"); - enchants1.add("Blast Resistant"); - enchants1.add("Untouchable"); - enchants1.add("Unbreaking"); - enchants1.add("Thorny"); - enchants2.add("Life"); - enchants2.add("Resistance"); - enchants2.add("Durability"); - enchants2.add("Protection"); - } - if (type==2) { - finalitem=new ItemStack(Material.DIAMOND_LEGGINGS); - enchants1.add("Protective"); - enchants1.add("Fire-Proof"); - enchants1.add("Blast Resistant"); - enchants1.add("Untouchable"); - enchants1.add("Unbreaking"); - enchants1.add("Thorny"); - enchants2.add("Life"); - enchants2.add("Resistance"); - enchants2.add("Durability"); - enchants2.add("Protection"); - } - if (type==3) { - finalitem=new ItemStack(Material.DIAMOND_BOOTS); - enchants1.add("Protective"); - enchants1.add("Fire-Proof"); - enchants1.add("Blast Resistant"); - enchants1.add("Untouchable"); - enchants1.add("Lightweight"); - enchants1.add("Unbreaking"); - enchants1.add("Thorny"); - enchants2.add("Life"); - enchants2.add("Resistance"); - enchants2.add("Durability"); - enchants2.add("Protection"); - } - if (type==4) { - finalitem=new ItemStack(Material.BOW); - enchants1.add("Power"); - enchants1.add("Punch"); - enchants1.add("Flaming"); - enchants1.add("Infinite"); - enchants1.add("Unbreaking"); - enchants2.add("Smiting"); - enchants2.add("Penetration"); - enchants2.add("Draining"); - enchants2.add("Fury"); - enchants2.add("Power"); - } - if (type==5) { - finalitem=new ItemStack(Material.DIAMOND_SWORD); - enchants1.add("Damaging"); - enchants1.add("Knockback"); - enchants1.add("Undead"); - enchants1.add("Baning"); - enchants1.add("Fiery"); - enchants1.add("Greedy"); - enchants1.add("Unbreaking"); - enchants2.add("Smiting"); - enchants2.add("Penetration"); - enchants2.add("Draining"); - enchants2.add("Fury"); - enchants2.add("Power"); - } - prefix = enchants1.get((int)(Math.random()*enchants1.size())); - suffix = enchants2.get((int)(Math.random()*enchants2.size())); - if (prefix.equalsIgnoreCase("Protective")) { - finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); - } - if (prefix.equalsIgnoreCase("Fire-Proof")) { - finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); - } - if (prefix.equalsIgnoreCase("Blast Resistant")) { - finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); - } - if (prefix.equalsIgnoreCase("Untouchable")) { - finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); - } - if (prefix.equalsIgnoreCase("Breathing")) { - finalitem.addUnsafeEnchantment(Enchantment.OXYGEN, 10); - } - if (prefix.equalsIgnoreCase("Working")) { - finalitem.addUnsafeEnchantment(Enchantment.WATER_WORKER, 10); - } - if (prefix.equalsIgnoreCase("Unbreaking")) { - finalitem.addUnsafeEnchantment(Enchantment.DURABILITY, 10); - } - if (prefix.equalsIgnoreCase("Thorny")) { - finalitem.addUnsafeEnchantment(Enchantment.THORNS, 10); - } - if (prefix.equalsIgnoreCase("Untouchable")) { - finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); - } - if (prefix.equalsIgnoreCase("Lightweight")) { - finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10); - } - if (prefix.equalsIgnoreCase("Power")) { - finalitem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10); - } - if (prefix.equalsIgnoreCase("Damaging")) { - finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10); - } - if (prefix.equalsIgnoreCase("Knockback")) { - finalitem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10); - } - if (prefix.equalsIgnoreCase("Punch")) { - finalitem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 10); - } - if (prefix.equalsIgnoreCase("Flaming")) { - finalitem.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10); - } - if (prefix.equalsIgnoreCase("Infinite")) { - finalitem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 10); - } - if (prefix.equalsIgnoreCase("Undead")) { - finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 10); - } - if (prefix.equalsIgnoreCase("Baning")) { - finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 10); - } - if (prefix.equalsIgnoreCase("Fiery")) { - finalitem.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 10); - } - if (prefix.equalsIgnoreCase("Greedy")) { - finalitem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10); - } - ItemMeta meta = finalitem.getItemMeta(); - meta.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+prefix+" "+convertToItemName(finalitem.getType().name())+" of "+suffix); - List setLore = new ArrayList(); - if (suffix.equalsIgnoreCase("Life")) { - setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10)+" "+ChatColor.BLUE+"Health"); - } - if (suffix.equalsIgnoreCase("Resistance")) { - setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*70)+20)+"% "+ChatColor.BLUE+"Damage Reduction"); - } - if (suffix.equalsIgnoreCase("Durability")) { - setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*200)+50)*10)+"% "+ChatColor.BLUE+"Durability"); - } - if (suffix.equalsIgnoreCase("Protection")) { - setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Block Chance"); - } - if (suffix.equalsIgnoreCase("Smiting")) { - setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Critical Chance"); - } - if (suffix.equalsIgnoreCase("Penetration")) { - setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*20)+5))+" "+ChatColor.BLUE+"Armor Penetration"); - } - if (suffix.equalsIgnoreCase("Draining")) { - setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*30)+20))+"% "+ChatColor.BLUE+"Life Steal"); - } - if (suffix.equalsIgnoreCase("Fury")) { - setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Attack Speed"); - } - if (suffix.equalsIgnoreCase("Power")) { - setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*10)+5))+" "+ChatColor.BLUE+"Damage"); - } - setLore.add(""); - setLore.add(ChatColor.YELLOW+"[Halloween]"); - setLore.add("This item was created during the Halloween"); - setLore.add("event. When this item breaks, it simply turns"); - setLore.add("into a \"broken\" state and has a recharge time"); - setLore.add("of 1 week. The item will be fully restored after"); - setLore.add("a week of cooldown."); - meta.setLore(setLore); - finalitem.setItemMeta(meta); - //finalitem.setDurability((short)1560); //TESTING. - boolean full=true; - for (int i=0;i enchants1 = new ArrayList(); + List enchants2 = new ArrayList(); + ItemStack finalitem = null; + if (type==0) { + finalitem=new ItemStack(Material.DIAMOND_HELMET); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Breathing"); + enchants1.add("Working"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==1) { + finalitem=new ItemStack(Material.DIAMOND_CHESTPLATE); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==2) { + finalitem=new ItemStack(Material.DIAMOND_LEGGINGS); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==3) { + finalitem=new ItemStack(Material.DIAMOND_BOOTS); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Lightweight"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==4) { + finalitem=new ItemStack(Material.BOW); + enchants1.add("Power"); + enchants1.add("Punch"); + enchants1.add("Flaming"); + enchants1.add("Infinite"); + enchants1.add("Unbreaking"); + enchants2.add("Smiting"); + enchants2.add("Penetration"); + enchants2.add("Draining"); + enchants2.add("Fury"); + enchants2.add("Power"); + } + if (type==5) { + finalitem=new ItemStack(Material.DIAMOND_SWORD); + enchants1.add("Damaging"); + enchants1.add("Knockback"); + enchants1.add("Undead"); + enchants1.add("Baning"); + enchants1.add("Fiery"); + enchants1.add("Greedy"); + enchants1.add("Unbreaking"); + enchants2.add("Smiting"); + enchants2.add("Penetration"); + enchants2.add("Draining"); + enchants2.add("Fury"); + enchants2.add("Power"); + } + prefix = enchants1.get((int)(Math.random()*enchants1.size())); + suffix = enchants2.get((int)(Math.random()*enchants2.size())); + if (prefix.equalsIgnoreCase("Protective")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); + } + if (prefix.equalsIgnoreCase("Fire-Proof")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); + } + if (prefix.equalsIgnoreCase("Blast Resistant")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); + } + if (prefix.equalsIgnoreCase("Untouchable")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + } + if (prefix.equalsIgnoreCase("Breathing")) { + finalitem.addUnsafeEnchantment(Enchantment.OXYGEN, 10); + } + if (prefix.equalsIgnoreCase("Working")) { + finalitem.addUnsafeEnchantment(Enchantment.WATER_WORKER, 10); + } + if (prefix.equalsIgnoreCase("Unbreaking")) { + finalitem.addUnsafeEnchantment(Enchantment.DURABILITY, 10); + } + if (prefix.equalsIgnoreCase("Thorny")) { + finalitem.addUnsafeEnchantment(Enchantment.THORNS, 10); + } + if (prefix.equalsIgnoreCase("Untouchable")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + } + if (prefix.equalsIgnoreCase("Lightweight")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10); + } + if (prefix.equalsIgnoreCase("Power")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10); + } + if (prefix.equalsIgnoreCase("Damaging")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10); + } + if (prefix.equalsIgnoreCase("Knockback")) { + finalitem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10); + } + if (prefix.equalsIgnoreCase("Punch")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 10); + } + if (prefix.equalsIgnoreCase("Flaming")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10); + } + if (prefix.equalsIgnoreCase("Infinite")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 10); + } + if (prefix.equalsIgnoreCase("Undead")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 10); + } + if (prefix.equalsIgnoreCase("Baning")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 10); + } + if (prefix.equalsIgnoreCase("Fiery")) { + finalitem.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 10); + } + if (prefix.equalsIgnoreCase("Greedy")) { + finalitem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10); + } + ItemMeta meta = finalitem.getItemMeta(); + meta.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+prefix+" "+convertToItemName(finalitem.getType().name())+" of "+suffix); + List setLore = new ArrayList(); + if (suffix.equalsIgnoreCase("Life")) { + setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10)+" "+ChatColor.BLUE+"Health"); + } + if (suffix.equalsIgnoreCase("Resistance")) { + setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*70)+20)+"% "+ChatColor.BLUE+"Damage Reduction"); + } + if (suffix.equalsIgnoreCase("Durability")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*200)+50)*10)+"% "+ChatColor.BLUE+"Durability"); + } + if (suffix.equalsIgnoreCase("Protection")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Block Chance"); + } + if (suffix.equalsIgnoreCase("Smiting")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Critical Chance"); + } + if (suffix.equalsIgnoreCase("Penetration")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*20)+5))+" "+ChatColor.BLUE+"Armor Penetration"); + } + if (suffix.equalsIgnoreCase("Draining")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*30)+20))+"% "+ChatColor.BLUE+"Life Steal"); + } + if (suffix.equalsIgnoreCase("Fury")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Attack Speed"); + } + if (suffix.equalsIgnoreCase("Power")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*10)+5))+" "+ChatColor.BLUE+"Damage"); + } + setLore.add(""); + setLore.add(ChatColor.YELLOW+"[Halloween]"); + setLore.add("This item was created during the Halloween"); + setLore.add("event. When this item breaks, it simply turns"); + setLore.add("into a \"broken\" state and has a recharge time"); + setLore.add("of 1 week. The item will be fully restored after"); + setLore.add("a week of cooldown."); + meta.setLore(setLore); + finalitem.setItemMeta(meta); + //finalitem.setDurability((short)1560); //TESTING. + boolean full=true; + for (int i=0;i='a'&&mod[i]<='z') { + mod[i]-=32; + first=true; + } else + if (i==0) { + if (mod[i]>='A'&&mod[i]<='Z') { + first=true; + } + } else { + if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { + first=true; + } + } + } else { + if (mod[i-1]!=' ') { + if (mod[i]>='A'&&mod[i]<='Z') { + mod[i]+=32; + } + } + } + } + return String.valueOf(mod); +} + + public void giveLegendaryItem(Player p) { + String prefix = ""; + String suffix = ""; + int type=(int)(Math.random()*6); + //int type=5; //TESTING. + List enchants1 = new ArrayList(); + List enchants2 = new ArrayList(); + ItemStack finalitem = null; + if (type==0) { + finalitem=new ItemStack(Material.DIAMOND_HELMET); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Breathing"); + enchants1.add("Working"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==1) { + finalitem=new ItemStack(Material.DIAMOND_CHESTPLATE); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==2) { + finalitem=new ItemStack(Material.DIAMOND_LEGGINGS); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==3) { + finalitem=new ItemStack(Material.DIAMOND_BOOTS); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Lightweight"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==4) { + finalitem=new ItemStack(Material.BOW); + enchants1.add("Power"); + enchants1.add("Punch"); + enchants1.add("Flaming"); + enchants1.add("Infinite"); + enchants1.add("Unbreaking"); + enchants2.add("Smiting"); + enchants2.add("Penetration"); + enchants2.add("Draining"); + enchants2.add("Fury"); + enchants2.add("Power"); + } + if (type==5) { + finalitem=new ItemStack(Material.DIAMOND_SWORD); + enchants1.add("Damaging"); + enchants1.add("Knockback"); + enchants1.add("Undead"); + enchants1.add("Baning"); + enchants1.add("Fiery"); + enchants1.add("Greedy"); + enchants1.add("Unbreaking"); + enchants2.add("Smiting"); + enchants2.add("Penetration"); + enchants2.add("Draining"); + enchants2.add("Fury"); + enchants2.add("Power"); + } + prefix = enchants1.get((int)(Math.random()*enchants1.size())); + suffix = enchants2.get((int)(Math.random()*enchants2.size())); + if (prefix.equalsIgnoreCase("Protective")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); + } + if (prefix.equalsIgnoreCase("Fire-Proof")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); + } + if (prefix.equalsIgnoreCase("Blast Resistant")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); + } + if (prefix.equalsIgnoreCase("Untouchable")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + } + if (prefix.equalsIgnoreCase("Breathing")) { + finalitem.addUnsafeEnchantment(Enchantment.OXYGEN, 10); + } + if (prefix.equalsIgnoreCase("Working")) { + finalitem.addUnsafeEnchantment(Enchantment.WATER_WORKER, 10); + } + if (prefix.equalsIgnoreCase("Unbreaking")) { + finalitem.addUnsafeEnchantment(Enchantment.DURABILITY, 10); + } + if (prefix.equalsIgnoreCase("Thorny")) { + finalitem.addUnsafeEnchantment(Enchantment.THORNS, 10); + } + if (prefix.equalsIgnoreCase("Untouchable")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + } + if (prefix.equalsIgnoreCase("Lightweight")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10); + } + if (prefix.equalsIgnoreCase("Power")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10); + } + if (prefix.equalsIgnoreCase("Damaging")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10); + } + if (prefix.equalsIgnoreCase("Knockback")) { + finalitem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10); + } + if (prefix.equalsIgnoreCase("Punch")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 10); + } + if (prefix.equalsIgnoreCase("Flaming")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10); + } + if (prefix.equalsIgnoreCase("Infinite")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 10); + } + if (prefix.equalsIgnoreCase("Undead")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 10); + } + if (prefix.equalsIgnoreCase("Baning")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 10); + } + if (prefix.equalsIgnoreCase("Fiery")) { + finalitem.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 10); + } + if (prefix.equalsIgnoreCase("Greedy")) { + finalitem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10); + } + ItemMeta meta = finalitem.getItemMeta(); + meta.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+prefix+" "+convertToItemName(finalitem.getType().name())+" of "+suffix); + List setLore = new ArrayList(); + if (suffix.equalsIgnoreCase("Life")) { + setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10)+" "+ChatColor.BLUE+"Health"); + } + if (suffix.equalsIgnoreCase("Resistance")) { + setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*70)+20)+"% "+ChatColor.BLUE+"Damage Reduction"); + } + if (suffix.equalsIgnoreCase("Durability")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*200)+50)*10)+"% "+ChatColor.BLUE+"Durability"); + } + if (suffix.equalsIgnoreCase("Protection")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Block Chance"); + } + if (suffix.equalsIgnoreCase("Smiting")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Critical Chance"); + } + if (suffix.equalsIgnoreCase("Penetration")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*20)+5))+" "+ChatColor.BLUE+"Armor Penetration"); + } + if (suffix.equalsIgnoreCase("Draining")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*30)+20))+"% "+ChatColor.BLUE+"Life Steal"); + } + if (suffix.equalsIgnoreCase("Fury")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Attack Speed"); + } + if (suffix.equalsIgnoreCase("Power")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*10)+5))+" "+ChatColor.BLUE+"Damage"); + } + setLore.add(""); + setLore.add(ChatColor.YELLOW+"[Halloween]"); + setLore.add("This item was created during the Halloween"); + setLore.add("event. When this item breaks, it simply turns"); + setLore.add("into a \"broken\" state and has a recharge time"); + setLore.add("of 1 week. The item will be fully restored after"); + setLore.add("a week of cooldown."); + meta.setLore(setLore); + finalitem.setItemMeta(meta); + //finalitem.setDurability((short)1560); //TESTING. + boolean full=true; + for (int i=0;i