From df4a0b905abd17f6fc64685a12481948beb1fe6d Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 25 Nov 2013 03:49:12 -0700 Subject: [PATCH] Revert "Fire modifications. Move of tick code." This reverts commit 35c249bc8fd3861966df8794126c3638ba7fdb2b. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 2610 ++++++++--------- .../src/me/kaZep/Base/PlayerListener.java | 97 +- .../me/kaZep/Base/RecyclingCenterNode.java | 6 +- 3 files changed, 1315 insertions(+), 1398 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 1e77256..0e68621 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -62,7 +62,6 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.ShapedRecipe; -import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.map.MapRenderer; @@ -109,7 +108,6 @@ public class Main extends JavaPlugin public long last_bank_deposit_use_time=0; public String last_bank_deposit_user=""; public long last_bank_withdraw_use_time=0; - public long last_player_death_time=0; public String last_bank_withdraw_user=""; public long last_boss_dungeon_time=0; public long check_nether_time=0; @@ -502,19 +500,6 @@ public class Main extends JavaPlugin item_cube.setIngredient('c', Material.EMERALD_BLOCK); Bukkit.addRecipe(item_cube); - ItemStack artifact = new ItemStack(Material.CLAY_BALL); - artifact.addEnchantment(Enchantment.LOOT_BONUS_MOBS, 0); - ItemMeta meta = artifact.getItemMeta(); - List lore = new ArrayList(); - lore.add("This clump of material seems to"); - lore.add("be part of something ancient."); - lore.add(""); - lore.add(ChatColor.LIGHT_PURPLE+""+ChatColor.ITALIC+"There is a small chance the piece will"); - lore.add(ChatColor.LIGHT_PURPLE+""+ChatColor.ITALIC+"be restored."); - meta.setLore(lore); - artifact.setItemMeta(meta); - ShapelessRecipe artifact_recipe = new ShapelessRecipe(artifact); - DMGCALC = new DamageAPI(); //System.out.println("Running BankEconomy in "+this.getDataFolder().getAbsolutePath()); //System.out.println("File size: "+f.length()); @@ -1068,477 +1053,390 @@ public class Main extends JavaPlugin sign.update(); } -final public void runTick() { - Bukkit.getLogger().info("Run tick "+SERVER_TICK_TIME); - Main.SERVER_TICK_TIME++; - for (int i=0;i arrows = Bukkit.getWorld("world").getEntities(); - for (int j=0;j60) { - //Remove old arrows that have existed long enough. (2 seconds) - arrows.get(j).remove(); +public void runTick() { + final Main plugin = this; + this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ + public void run(){ + SERVER_TICK_TIME++; + for (int i=0;i arrows = Bukkit.getWorld("world").getEntities(); + for (int j=0;j60) { + //Remove old arrows that have existed long enough. (2 seconds) + arrows.get(j).remove(); + } + } + } + if (shooter.timer<=0) { + ARROW_SHOOTERS.remove(i); + i--; } } - } - if (shooter.timer<=0) { - ARROW_SHOOTERS.remove(i); - i--; - } - } - for (int i=0;ininjavisible_list.get(i).resettime) { - //Recloak this ninja if it's still alive. - List entities = Bukkit.getWorld("world").getEntities(); - for (int j=0;jninjavisible_list.get(i).resettime) { + //Recloak this ninja if it's still alive. + List entities = Bukkit.getWorld("world").getEntities(); + for (int j=0;j0) { - Bukkit.getWorld("world").playEffect(new Location(POLYMORPH_LOC.getWorld(),POLYMORPH_LOC.getX()+(Math.random()-Math.random())*2,POLYMORPH_LOC.getY()+(Math.random())*2+2,POLYMORPH_LOC.getZ()+(Math.random()-Math.random())*2), Effect.STEP_SOUND, Material.EMERALD_BLOCK); - Bukkit.getWorld("world").playEffect(new Location(POLYMORPH_LOC.getWorld(),POLYMORPH_LOC.getX()+(Math.random()-Math.random())*2,POLYMORPH_LOC.getY()+(Math.random())*2+2,POLYMORPH_LOC.getZ()+(Math.random()-Math.random())*2), Effect.STEP_SOUND, Material.WATER); - if (POLYMORPH==1) { - Bukkit.getWorld("world").playEffect(new Location(POLYMORPH_LOC.getWorld(),POLYMORPH_LOC.getX()+(Math.random()-Math.random())*2,POLYMORPH_LOC.getY()+(Math.random())*2+2,POLYMORPH_LOC.getZ()+(Math.random()-Math.random())*2), Effect.POTION_BREAK, 0); - } - POLYMORPH--; - } - if (BOSS_DEFEAT>0) { - if (BOSS_DEFEAT%4==0) { - Bukkit.getWorld("world").playEffect(BOSS_DEFEAT_LOC.add(Math.random()*5-Math.random()*5, BOSS_DEFEAT/20, Math.random()*5-Math.random()*5), Effect.SMOKE, 0); - } - if (BOSS_DEFEAT==1) { - Bukkit.getWorld("world").playEffect(BOSS_DEFEAT_LOC, Effect.ZOMBIE_DESTROY_DOOR, 0); - } - BOSS_DEFEAT--; - } - if (REVIVE_EFFECT>0) { - switch (REVIVE_EFFECT) { //starts at 90. - case 90: - case 88: - case 86: - case 84: - case 82: - case 80: { - Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX(),REVIVE_EFFECT_LOC.getY()+(90-REVIVE_EFFECT)/2,REVIVE_EFFECT_LOC.getZ()), Effect.MOBSPAWNER_FLAMES, 0); - }break; - case 89: - case 85: - case 79: - case 75: - case 70: - case 65: - case 60: - case 55: - case 50: - case 45: - case 40: - case 35: - case 30: - case 25: - case 20: - case 15: - case 10: - case 5:{ - Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY(),REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.EXTINGUISH, 0); - }break; - case 87: - case 83: - case 77: - case 72: - case 67: - case 62: - case 57: - case 52: - case 47: - case 42: - case 37: - case 32: - case 27: - case 22: - case 17: - case 12: - case 7: { - Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY()+(Math.random())*2,REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.SMOKE, (int)(Math.random()*9)); - }break; - } - Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY()+(Math.random())*2,REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.STEP_SOUND, Material.BEACON); - REVIVE_EFFECT--; - //Bukkit.getPlayer("sigonasr2").sendMessage(REVIVE_EFFECT+""); - } - List lineofsight_check = new ArrayList(); - if (Main.SERVER_TICK_TIME%100==0) { - //This is for events that occur once every 5 seconds. - List world_entities = Bukkit.getWorld("world").getEntities(); - for (int i=0;il.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))) { - DecimalFormat df = new DecimalFormat("#0.0"); - //Bukkit.broadcastMessage("Healing for "+(+5+(0.2*(l.getMaxHealth()/l.getHealth())))+" health. "+df.format(l.getHealth())+"/"+l.getMaxHealth()+" HP"); - l.setHealth(l.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))); - } + //Put your code here... + //Bukkit.getPlayer("sigonasr2").sendMessage("Server Tick "+Main.SERVER_TICK_TIME); + if (POLYMORPH>0) { + Bukkit.getWorld("world").playEffect(new Location(POLYMORPH_LOC.getWorld(),POLYMORPH_LOC.getX()+(Math.random()-Math.random())*2,POLYMORPH_LOC.getY()+(Math.random())*2+2,POLYMORPH_LOC.getZ()+(Math.random()-Math.random())*2), Effect.STEP_SOUND, Material.EMERALD_BLOCK); + Bukkit.getWorld("world").playEffect(new Location(POLYMORPH_LOC.getWorld(),POLYMORPH_LOC.getX()+(Math.random()-Math.random())*2,POLYMORPH_LOC.getY()+(Math.random())*2+2,POLYMORPH_LOC.getZ()+(Math.random()-Math.random())*2), Effect.STEP_SOUND, Material.WATER); + if (POLYMORPH==1) { + Bukkit.getWorld("world").playEffect(new Location(POLYMORPH_LOC.getWorld(),POLYMORPH_LOC.getX()+(Math.random()-Math.random())*2,POLYMORPH_LOC.getY()+(Math.random())*2+2,POLYMORPH_LOC.getZ()+(Math.random()-Math.random())*2), Effect.POTION_BREAK, 0); } + POLYMORPH--; } - } - world_entities = Bukkit.getWorld("world_nether").getEntities(); - for (int i=0;il.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))) { - DecimalFormat df = new DecimalFormat("#0.0"); - //Bukkit.broadcastMessage("Healing for "+(+5+(0.2*(l.getMaxHealth()/l.getHealth())))+" health. "+df.format(l.getHealth())+"/"+l.getMaxHealth()+" HP"); - l.setHealth(l.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))); - } + if (BOSS_DEFEAT>0) { + if (BOSS_DEFEAT%4==0) { + Bukkit.getWorld("world").playEffect(BOSS_DEFEAT_LOC.add(Math.random()*5-Math.random()*5, BOSS_DEFEAT/20, Math.random()*5-Math.random()*5), Effect.SMOKE, 0); + } + if (BOSS_DEFEAT==1) { + Bukkit.getWorld("world").playEffect(BOSS_DEFEAT_LOC, Effect.ZOMBIE_DESTROY_DOOR, 0); } + BOSS_DEFEAT--; } - } - world_entities = Bukkit.getWorld("world_the_end").getEntities(); - for (int i=0;il.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))) { - DecimalFormat df = new DecimalFormat("#0.0"); - //Bukkit.broadcastMessage("Healing for "+(+5+(0.2*(l.getMaxHealth()/l.getHealth())))+" health. "+df.format(l.getHealth())+"/"+l.getMaxHealth()+" HP"); - l.setHealth(l.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))); - } + if (REVIVE_EFFECT>0) { + switch (REVIVE_EFFECT) { //starts at 90. + case 90: + case 88: + case 86: + case 84: + case 82: + case 80: { + Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX(),REVIVE_EFFECT_LOC.getY()+(90-REVIVE_EFFECT)/2,REVIVE_EFFECT_LOC.getZ()), Effect.MOBSPAWNER_FLAMES, 0); + }break; + case 89: + case 85: + case 79: + case 75: + case 70: + case 65: + case 60: + case 55: + case 50: + case 45: + case 40: + case 35: + case 30: + case 25: + case 20: + case 15: + case 10: + case 5:{ + Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY(),REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.EXTINGUISH, 0); + }break; + case 87: + case 83: + case 77: + case 72: + case 67: + case 62: + case 57: + case 52: + case 47: + case 42: + case 37: + case 32: + case 27: + case 22: + case 17: + case 12: + case 7: { + Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY()+(Math.random())*2,REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.SMOKE, (int)(Math.random()*9)); + }break; } + Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY()+(Math.random())*2,REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.STEP_SOUND, Material.BEACON); + REVIVE_EFFECT--; + //Bukkit.getPlayer("sigonasr2").sendMessage(REVIVE_EFFECT+""); } - } - } - for (int zx=0;zx2) { - Bukkit.getPlayer("sigonasr2").sendMessage("Previous Time: "+Bukkit.getWorld("world").getTime()); - Bukkit.getWorld("world").setTime((long) (Bukkit.getWorld("world").getTime()-((Bukkit.getWorld("world").getTime()-last_world_time)/2.0d))); - last_world_time = Bukkit.getWorld("world").getTime(); - Bukkit.getPlayer("sigonasr2").sendMessage("New Time: "+Bukkit.getWorld("world").getTime()); - } - }*/ - //last_world_time = Main.SERVER_TICK_TIME; - if (p.getWorld().getName().compareTo("world")==0) { - //Bukkit.getWorld("world").spawnEntity(p.getLocation(), EntityType.EXPERIENCE_ORB); - //Bukkit.getWorld("world").dropItemNaturally(p.getLocation(), new ItemStack(Material.DIRT)); - if (getConfig().getBoolean("halloween-enabled") && Main.SERVER_TICK_TIME%10==0) { - //1551,69,275 - Location testloc = new Location(p.getWorld(),1551,69,-275); - if (p.getLocation().distanceSquared(testloc)<900) { - //p.sendMessage("In range."); - //We are close enough to the sheep pen. Check out the sheep. - List ents = p.getNearbyEntities(15, 15, 15); - for (int i=0;i lineofsight_check = new ArrayList(); + if (Main.SERVER_TICK_TIME%100==0) { + //This is for events that occur once every 5 seconds. + List world_entities = Bukkit.getWorld("world").getEntities(); + for (int i=0;il.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))) { + DecimalFormat df = new DecimalFormat("#0.0"); + //Bukkit.broadcastMessage("Healing for "+(+5+(0.2*(l.getMaxHealth()/l.getHealth())))+" health. "+df.format(l.getHealth())+"/"+l.getMaxHealth()+" HP"); + l.setHealth(l.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))); + } + } } } - boolean colorone=false; - for (int i=0;il.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))) { + DecimalFormat df = new DecimalFormat("#0.0"); + //Bukkit.broadcastMessage("Healing for "+(+5+(0.2*(l.getMaxHealth()/l.getHealth())))+" health. "+df.format(l.getHealth())+"/"+l.getMaxHealth()+" HP"); + l.setHealth(l.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))); } - } else { - if (!colorone && Math.random()<=0.005) { - s.setColor(DyeColor.BLUE); - colorone=true; + } + } + } + world_entities = Bukkit.getWorld("world_the_end").getEntities(); + for (int i=0;il.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))) { + DecimalFormat df = new DecimalFormat("#0.0"); + //Bukkit.broadcastMessage("Healing for "+(+5+(0.2*(l.getMaxHealth()/l.getHealth())))+" health. "+df.format(l.getHealth())+"/"+l.getMaxHealth()+" HP"); + l.setHealth(l.getHealth()+5+(0.2*(l.getMaxHealth()/l.getHealth()))); } } } } } - } - if (getConfig().getBoolean("halloween-enabled") && Bukkit.getWorld("world").hasStorm() && Main.SERVER_TICK_TIME%20==0) { - Item i = null; - int item = (int)(Math.random()*4); - switch (item) { - case 0: {i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.PUMPKIN));}break; - case 1: {i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.EGG));}break; - case 2: {i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.SUGAR));}break; - case 3: {i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.PUMPKIN_PIE));}break; - } - i.setTicksLived(3600); - } - if (Main.SERVER_TICK_TIME%90==0) { - for (int i=-15;i<=15;i++) { - for (int j=-15;j<=15;j++) { - for (int k=-15;k<=15;k++) { - if (Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getType()==Material.MOB_SPAWNER) { - int g=0,maxiter=1000; - CreatureSpawner spawner = (CreatureSpawner)Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getState(); - List nearbylist = p.getNearbyEntities(15, 15, 5); - List nearbylist2 = p.getNearbyEntities(3, 3, 5); - for (int l=0;l10) { - for (int l=0;l2) { + Bukkit.getPlayer("sigonasr2").sendMessage("Previous Time: "+Bukkit.getWorld("world").getTime()); + Bukkit.getWorld("world").setTime((long) (Bukkit.getWorld("world").getTime()-((Bukkit.getWorld("world").getTime()-last_world_time)/2.0d))); + last_world_time = Bukkit.getWorld("world").getTime(); + Bukkit.getPlayer("sigonasr2").sendMessage("New Time: "+Bukkit.getWorld("world").getTime()); + } + }*/ + //last_world_time = Main.SERVER_TICK_TIME; + if (p.getWorld().getName().compareTo("world")==0) { + //Bukkit.getWorld("world").spawnEntity(p.getLocation(), EntityType.EXPERIENCE_ORB); + //Bukkit.getWorld("world").dropItemNaturally(p.getLocation(), new ItemStack(Material.DIRT)); + if (getConfig().getBoolean("halloween-enabled") && Main.SERVER_TICK_TIME%10==0) { + //1551,69,275 + Location testloc = new Location(p.getWorld(),1551,69,-275); + if (p.getLocation().distanceSquared(testloc)<900) { + //p.sendMessage("In range."); + //We are close enough to the sheep pen. Check out the sheep. + List ents = p.getNearbyEntities(15, 15, 15); + for (int i=0;i nearby = p.getNearbyEntities(30, 30, 30); - boolean exists=false; - for (int m=0;m e_list = Bukkit.getWorld("world").getEntitiesByClass(EnderDragon.class).iterator(); - boolean first=false; - while (e_list.hasNext()) { - //p.sendMessage("Moving Enderdragon to "+new Location(p.getWorld(),p.getLocation().getBlockX()+i,-50,p.getLocation().getBlockZ()+j)); - EnderDragon next = e_list.next(); - if (!first) { - first=true; - } else { - next.remove(); + } else { + if (!colorone && Math.random()<=0.005) { + s.setColor(DyeColor.BLUE); + colorone=true; } - }*/ + } } } } } - } - } - if (Main.SERVER_TICK_TIME%20==0) { - for (int d=0;d0 && 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(Main.SERVER_TICK_TIME+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--; + if (getConfig().getBoolean("halloween-enabled") && Bukkit.getWorld("world").hasStorm() && Main.SERVER_TICK_TIME%20==0) { + Item i = null; + int item = (int)(Math.random()*4); + switch (item) { + case 0: {i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.PUMPKIN));}break; + case 1: {i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.EGG));}break; + case 2: {i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.SUGAR));}break; + case 3: {i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.PUMPKIN_PIE));}break; + } + i.setTicksLived(3600); + } + if (Main.SERVER_TICK_TIME%90==0) { + for (int i=-15;i<=15;i++) { + for (int j=-15;j<=15;j++) { + for (int k=-15;k<=15;k++) { + if (Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getType()==Material.MOB_SPAWNER) { + int g=0,maxiter=1000; + CreatureSpawner spawner = (CreatureSpawner)Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getState(); + List nearbylist = p.getNearbyEntities(15, 15, 5); + List nearbylist2 = p.getNearbyEntities(3, 3, 5); + for (int l=0;l10) { + for (int l=0;l0) { - 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--; + } + } + if (nearbylist2.size()<5) { + if (Math.random()<=0.2d) { + int l=0; + while (l<5) { + //CreatureSpawner spawner = (CreatureSpawner)Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getState(); + Location testloc = new Location(Bukkit.getWorld("world"),spawner.getLocation().getX()+Math.random()*2-Math.random()*2,spawner.getLocation().getY()+Math.random()*5,spawner.getLocation().getZ()+Math.random()*2-Math.random()*2); + if (p.getNearbyEntities(15, 15, 5).size()<50 && Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.AIR || Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.WEB) { + Bukkit.getWorld("world").spawnCreature(testloc,spawner.getCreatureType()); } - }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--; - } + l++; + } + } + } + } + if (Math.abs(i)<4 && Math.abs(j)<4 && Math.abs(k)<4 &&Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getType()==Material.COMMAND) { + //Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).setType(Material.COBBLESTONE); + List nearby = p.getNearbyEntities(30, 30, 30); + boolean exists=false; + for (int m=0;m e_list = Bukkit.getWorld("world").getEntitiesByClass(EnderDragon.class).iterator(); + boolean first=false; + while (e_list.hasNext()) { + //p.sendMessage("Moving Enderdragon to "+new Location(p.getWorld(),p.getLocation().getBlockX()+i,-50,p.getLocation().getBlockZ()+j)); + EnderDragon next = e_list.next(); + if (!first) { + first=true; + } else { + next.remove(); + } + }*/ + } } } - ////Bukkit.getLogger().info("Biome here is "+b.getBiome().name()); } } - } else { - //Check the value and regenerate if necessary. - if (Main.SERVER_TICK_TIME>customchunk.getLong("animal-reset2")) { - customchunk.set("animal-reset2", Long.valueOf(Main.SERVER_TICK_TIME+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. + } + if (Main.SERVER_TICK_TIME%20==0) { + for (int d=0;d0 && 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(Main.SERVER_TICK_TIME+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.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + 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()+"."); @@ -1548,10 +1446,11 @@ final public void runTick() { 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}; + } 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()+"."); @@ -1562,8 +1461,55 @@ final public void runTick() { 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 (Main.SERVER_TICK_TIME>customchunk.getLong("animal-reset2")) { + customchunk.set("animal-reset2", Long.valueOf(Main.SERVER_TICK_TIME+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.PIG,EntityType.SHEEP,EntityType.CHICKEN}; + 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()+"."); @@ -1573,383 +1519,424 @@ final public void runTick() { 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()); } } - ////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--; + } + } + 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. + } } - //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. + ////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++; + } } - 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++; + 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;i=96) { - heightmodifier=126; - } else { - heightmodifier=63; - } - if (nearby.get(i).getType()==EntityType.CREEPER) { - LivingEntity l = (LivingEntity)nearby.get(i); - if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { - if (l.getLocation().getY()<=40 && Math.random()<=0.08+((heightmodifier-l.getLocation().getY())*0.01d)) { - if (Math.random()<=0.35) { - l.setCustomName(ChatColor.YELLOW+"Explosive Creeper"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(Warning(l.getMaxHealth()*1.25d,1)); - } else - if (Math.random()<=0.15) { - l.setCustomName(ChatColor.GOLD+"Explosive Creeper II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(Warning(l.getMaxHealth()*1.75d,2)); - } else - if (Math.random()<=0.35) { - l.setCustomName(ChatColor.YELLOW+"Destructive Creeper"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(Warning(l.getMaxHealth()*1.25d,3)); - } else { - l.setCustomName(ChatColor.GOLD+"Destructive Creeper II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(Warning(l.getMaxHealth()*1.75d,4)); - } - if (l!=null && l.isValid()) { - l.setHealth(Warning(l.getMaxHealth(),20)); + ////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;i=96) { + heightmodifier=126; + } else { + heightmodifier=63; } - l.setTicksLived(6400); - } - } else - if (nearby.get(i).getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity)nearby.get(i); - if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { - if (l.getLocation().getY()<=35 && Math.random()<=0.15) { - if (Math.random()<=0.85) { - l.setCustomName(ChatColor.YELLOW+"Charge Zombie"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(Warning(l.getMaxHealth()+5,12)); - } else { - l.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - Warning(l,13); - if (l!=null && l.isValid()) { - l.setMaxHealth(l.getMaxHealth()+20); + if (nearby.get(i).getType()==EntityType.CREEPER) { + LivingEntity l = (LivingEntity)nearby.get(i); + if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + if (l.getLocation().getY()<=40 && Math.random()<=0.08+((heightmodifier-l.getLocation().getY())*0.01d)) { + if (Math.random()<=0.35) { + l.setCustomName(ChatColor.YELLOW+"Explosive Creeper"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()*1.25d,1)); + } else + if (Math.random()<=0.15) { + l.setCustomName(ChatColor.GOLD+"Explosive Creeper II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()*1.75d,2)); + } else + if (Math.random()<=0.35) { + l.setCustomName(ChatColor.YELLOW+"Destructive Creeper"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()*1.25d,3)); + } else { + l.setCustomName(ChatColor.GOLD+"Destructive Creeper II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()*1.75d,4)); + } + if (l!=null && l.isValid()) { + l.setHealth(Warning(l.getMaxHealth(),20)); + } } + l.setTicksLived(6400); } - Warning(l,23); - if (l!=null && l.isValid()) { - l.setMaxHealth(l.getMaxHealth()); - } - } else { - if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { - if (Math.random()<=0.25) { - l.setCustomName(ChatColor.GRAY+"Zombie Ninja"); - l.setCustomNameVisible(false); - l.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 0, true)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 2, true)); - //l.setCustomNameVisible(true); - //A Zombie Ninja will not wear armor to stay hidden. But may carry a sword. - l.getEquipment().setChestplate(new ItemStack(Material.AIR)); - l.getEquipment().setBoots(new ItemStack(Material.AIR)); - l.getEquipment().setLeggings(new ItemStack(Material.AIR)); - l.getEquipment().setHelmet(new ItemStack(Material.AIR)); - Zombie g = (Zombie)l; - g.setBaby(true); - Warning(l,14); + } else + if (nearby.get(i).getType()==EntityType.SPIDER) { + LivingEntity l = (LivingEntity)nearby.get(i); + if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + if (Math.random()<=0.08+((heightmodifier-l.getLocation().getY())*0.01d)) { + if (Math.random()<=0.35) { + l.setCustomName(ChatColor.YELLOW+"Venomous Spider"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth(),5)); + } else + if (Math.random()<=0.15) { + l.setCustomName(ChatColor.GOLD+"Venomous Spider II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()*1.5,6)); + } else + if (Math.random()<=0.35) { + l.setCustomName(ChatColor.YELLOW+"Snaring Spider"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()*1.5,7)); + } else { + l.setCustomName(ChatColor.GOLD+"Snaring Spider II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()*2,8)); + } if (l!=null && l.isValid()) { - l.setMaxHealth(l.getMaxHealth()*0.65d); - Warning(l,15); - if (l!=null && l.isValid()) { - l.setHealth(l.getMaxHealth()); - } + l.setHealth(Warning(l.getMaxHealth(),21)); } } + l.setTicksLived(6400); } - } - l.setTicksLived(6400); - } else { - if (l.getCustomName()!=null && (l.getCustomName().compareTo(ChatColor.YELLOW+"Charge Zombie")==0 || l.getCustomName().compareTo(ChatColor.GOLD+"Charge Zombie II")==0 || l.getCustomName().compareTo(ChatColor.DARK_PURPLE+"Charge Zombie III")==0)) { - //Destroy blocks around it. - /*Block b = l.getLocation().getBlock(); - if (b.getType()==Material.WATER || b.getType()==Material.STATIONARY_WATER || - b.getType()==Material.LAVA || b.getType()==Material.STATIONARY_LAVA) { - Vector knockback = l.getVelocity().multiply(8f); - l.setVelocity(knockback);*/ - boolean doit=true; - if (l.getKiller()!=null && l.getKiller().getLocation().getY()>l.getLocation().getY()) { - doit=false; - } - if (l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { - l.removePotionEffect(PotionEffectType.INVISIBILITY); + } else + if (nearby.get(i).getType()==EntityType.SKELETON) { + LivingEntity l = (LivingEntity)nearby.get(i); + if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { + if (Math.random()<=0.85) { + l.setCustomName(ChatColor.YELLOW+"Sniper"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()/2,9)); + } else { + l.setCustomName(ChatColor.GOLD+"Sniper II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()/4,10)); + } + if (l!=null && l.isValid()) { + l.setHealth(Warning(l.getMaxHealth(),11)); + } + } + l.setTicksLived(6400); } - if (doit) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Charge Zombie!"); - if (l.getCustomName().compareTo(ChatColor.DARK_PURPLE+"Charge Zombie III")==0 && !l.isDead()) { - /*//OLD CHARGE ZOMBIE BEHAVIOR. Charge Zombie II now does this weak block destruction. - for (int k=-1;k<2;k++) { - for (int j=-1;j<2;j++) { - Location checkloc = l.getLocation().add(k,1,j); - Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,2,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,0,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - } - }*/ - for (int k=-2;k<3;k++) { - for (int j=-2;j<3;j++) { - Location checkloc = l.getLocation().add(k,1,j); - Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,2,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,0,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,-1,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } + } else + if (nearby.get(i).getType()==EntityType.ZOMBIE) { + LivingEntity l = (LivingEntity)nearby.get(i); + if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + if (l.getLocation().getY()<=35 && Math.random()<=0.15) { + if (Math.random()<=0.85) { + l.setCustomName(ChatColor.YELLOW+"Charge Zombie"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(Warning(l.getMaxHealth()+5,12)); + } else { + l.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + Warning(l,13); + if (l!=null && l.isValid()) { + l.setMaxHealth(l.getMaxHealth()+20); } } + Warning(l,23); + if (l!=null && l.isValid()) { + l.setMaxHealth(l.getMaxHealth()); + } } else { - if (l.getCustomName().compareTo(ChatColor.GOLD+"Charge Zombie II")==0 && !l.isDead() && l.getKiller()!=null) { - /* - for (int k=-1;k<2;k++) { - for (int j=-1;j<2;j++) { - Location checkloc = l.getLocation().add(k,1,j); - Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,2,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,0,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); + if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { + if (Math.random()<=0.25) { + l.setCustomName(ChatColor.GRAY+"Zombie Ninja"); + l.setCustomNameVisible(false); + l.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 0, true)); + l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 2, true)); + //l.setCustomNameVisible(true); + //A Zombie Ninja will not wear armor to stay hidden. But may carry a sword. + l.getEquipment().setChestplate(new ItemStack(Material.AIR)); + l.getEquipment().setBoots(new ItemStack(Material.AIR)); + l.getEquipment().setLeggings(new ItemStack(Material.AIR)); + l.getEquipment().setHelmet(new ItemStack(Material.AIR)); + Zombie g = (Zombie)l; + g.setBaby(true); + Warning(l,14); + if (l!=null && l.isValid()) { + l.setMaxHealth(l.getMaxHealth()*0.65d); + Warning(l,15); + if (l!=null && l.isValid()) { + l.setHealth(l.getMaxHealth()); + } } } - }*/ //Charge Zombie II's now only break blocks when YOU get hit by them. - //OLD CHARGE ZOMBIE II BEHAVIOR. - for (int k=-2;k<3;k++) { - for (int j=-2;j<3;j++) { - Location checkloc = l.getLocation().add(k,1,j); - Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { - bl.breakNaturally(); - } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,2,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { - bl.breakNaturally(); + } + } + l.setTicksLived(6400); + } else { + if (l.getCustomName()!=null && (l.getCustomName().compareTo(ChatColor.YELLOW+"Charge Zombie")==0 || l.getCustomName().compareTo(ChatColor.GOLD+"Charge Zombie II")==0 || l.getCustomName().compareTo(ChatColor.DARK_PURPLE+"Charge Zombie III")==0)) { + //Destroy blocks around it. + /*Block b = l.getLocation().getBlock(); + if (b.getType()==Material.WATER || b.getType()==Material.STATIONARY_WATER || + b.getType()==Material.LAVA || b.getType()==Material.STATIONARY_LAVA) { + Vector knockback = l.getVelocity().multiply(8f); + l.setVelocity(knockback);*/ + boolean doit=true; + if (l.getKiller()!=null && l.getKiller().getLocation().getY()>l.getLocation().getY()) { + doit=false; + } + if (l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + l.removePotionEffect(PotionEffectType.INVISIBILITY); + } + if (doit) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Charge Zombie!"); + if (l.getCustomName().compareTo(ChatColor.DARK_PURPLE+"Charge Zombie III")==0 && !l.isDead()) { + /*//OLD CHARGE ZOMBIE BEHAVIOR. Charge Zombie II now does this weak block destruction. + for (int k=-1;k<2;k++) { + for (int j=-1;j<2;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,0,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { - bl.breakNaturally(); + }*/ + for (int k=-2;k<3;k++) { + for (int j=-2;j<3;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,-1,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } } } - } - } else - if (l.getCustomName().compareTo(ChatColor.YELLOW+"Charge Zombie")==0 && !l.isDead() && l.getKiller()!=null) { - for (int k=-1;k<2;k++) { - for (int j=-1;j<2;j++) { - Location checkloc = l.getLocation().add(k,1,j); - Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); + } else { + if (l.getCustomName().compareTo(ChatColor.GOLD+"Charge Zombie II")==0 && !l.isDead() && l.getKiller()!=null) { + /* + for (int k=-1;k<2;k++) { + for (int j=-1;j<2;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,2,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); + }*/ //Charge Zombie II's now only break blocks when YOU get hit by them. + //OLD CHARGE ZOMBIE II BEHAVIOR. + for (int k=-2;k<3;k++) { + for (int j=-2;j<3;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && bl.getType()!=Material.COMMAND) { + bl.breakNaturally(); + } + } } - bl = Bukkit.getWorld("world").getBlockAt(checkloc); - checkloc = l.getLocation().add(k,0,j); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { - bl.breakNaturally(); + } else + if (l.getCustomName().compareTo(ChatColor.YELLOW+"Charge Zombie")==0 && !l.isDead() && l.getKiller()!=null) { + for (int k=-1;k<2;k++) { + for (int j=-1;j<2;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + } } } } @@ -1960,588 +1947,583 @@ final public void runTick() { } } } - } - } - if (p.getWorld().getName().compareTo("world_nether")==0) { - if (Main.SERVER_TICK_TIME%60==0) { - for (int i=-15;i<=15;i++) { - for (int j=-15;j<=15;j++) { - for (int k=-5;k<=5;k++) { - if (Bukkit.getWorld("world_nether").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getType()==Material.MOB_SPAWNER) { - if (Math.random()<=0.5) { - CreatureSpawner spawner = (CreatureSpawner)Bukkit.getWorld("world_nether").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getState(); - Location testloc = new Location(Bukkit.getWorld("world_nether"),spawner.getLocation().getX()+Math.random()*5,spawner.getLocation().getY()+Math.random()*3,spawner.getLocation().getZ()+Math.random()*5); - if (Bukkit.getWorld("world_nether").getBlockAt(testloc).getType()==Material.AIR && Bukkit.getWorld("world_nether").getBlockAt(testloc.add(0,1,0)).getType()==Material.AIR) { - Bukkit.getWorld("world_nether").spawnCreature(testloc,spawner.getCreatureType()); + if (p.getWorld().getName().compareTo("world_nether")==0) { + if (Main.SERVER_TICK_TIME%60==0) { + for (int i=-15;i<=15;i++) { + for (int j=-15;j<=15;j++) { + for (int k=-5;k<=5;k++) { + if (Bukkit.getWorld("world_nether").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getType()==Material.MOB_SPAWNER) { + if (Math.random()<=0.5) { + CreatureSpawner spawner = (CreatureSpawner)Bukkit.getWorld("world_nether").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getState(); + Location testloc = new Location(Bukkit.getWorld("world_nether"),spawner.getLocation().getX()+Math.random()*5,spawner.getLocation().getY()+Math.random()*3,spawner.getLocation().getZ()+Math.random()*5); + if (Bukkit.getWorld("world_nether").getBlockAt(testloc).getType()==Material.AIR && Bukkit.getWorld("world_nether").getBlockAt(testloc.add(0,1,0)).getType()==Material.AIR) { + Bukkit.getWorld("world_nether").spawnCreature(testloc,spawner.getCreatureType()); + } + Bukkit.getWorld("world_nether").spawnCreature(spawner.getLocation(),spawner.getCreatureType()); + } + } - Bukkit.getWorld("world_nether").spawnCreature(spawner.getLocation(),spawner.getCreatureType()); } - } } - } - } - List nearby = p.getNearbyEntities(30, 30, 30); - try { - for (int i=0;i nearby = p.getNearbyEntities(30, 30, 30); + try { + for (int i=0;i13000) { - //Bukkit.getPlayer("sigonasr2").sendMessage("It's night now..."); - turnedon=true; - for (int x=1562;x<1645;x++) { - for (int y=64;y<80;y++) { - for (int z=-357;z<-211;z++) { - Block theblock=Bukkit.getWorld("world").getBlockAt(x,y,z); - if (theblock.getType()==Material.REDSTONE_LAMP_OFF) { - theblock.setType(Material.REDSTONE_LAMP_ON); + if (Main.SERVER_TICK_TIME%600==0) { + saveAccountsConfig(); + if (turnedon==false && Bukkit.getWorld("world").getTime()>13000) { + //Bukkit.getPlayer("sigonasr2").sendMessage("It's night now..."); + turnedon=true; + for (int x=1562;x<1645;x++) { + for (int y=64;y<80;y++) { + for (int z=-357;z<-211;z++) { + Block theblock=Bukkit.getWorld("world").getBlockAt(x,y,z); + if (theblock.getType()==Material.REDSTONE_LAMP_OFF) { + theblock.setType(Material.REDSTONE_LAMP_ON); + } + } } } } - } - } - if (turnedon==true && Bukkit.getWorld("world").getTime()<13000) { - turnedon=false; - //Bukkit.getPlayer("sigonasr2").sendMessage("It's day now..."); - for (int x=1562;x<1645;x++) { - for (int y=64;y<80;y++) { - for (int z=-357;z<-211;z++) { - Block theblock=Bukkit.getWorld("world").getBlockAt(x,y,z); - if (theblock.getType()==Material.REDSTONE_LAMP_ON) { - theblock.setType(Material.REDSTONE_LAMP_OFF); + if (turnedon==true && Bukkit.getWorld("world").getTime()<13000) { + turnedon=false; + //Bukkit.getPlayer("sigonasr2").sendMessage("It's day now..."); + for (int x=1562;x<1645;x++) { + for (int y=64;y<80;y++) { + for (int z=-357;z<-211;z++) { + Block theblock=Bukkit.getWorld("world").getBlockAt(x,y,z); + if (theblock.getType()==Material.REDSTONE_LAMP_ON) { + theblock.setType(Material.REDSTONE_LAMP_OFF); + } + } } } } } - } - } - if (Main.SERVER_TICK_TIME%10==0) { - if (getConfig().getBoolean("spleef4insession")) { - //Check to see if we fall off. - if ((p.getLocation().getX()<1585 || p.getLocation().getX()>1600 || p.getLocation().getZ()<24 || p.getLocation().getZ()>39 || p.getLocation().getY()<86.5d) && ( - (p.getName().compareTo(getConfig().getString("spleefrequesta4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestb4player"))==0 - || p.getName().compareTo(getConfig().getString("spleefrequestc4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestd4player"))==0))) { - //You lose. - //See if we're the winner. - int countdead=0; //We're looking for 3. - - - Player winningplayer = p,losingplayer = p; - if (getConfig().getString("spleefrequesta4player").compareTo("none")==0) { - countdead++; - } else { - if (getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { - losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequesta4player")); - } else { - winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequesta4player")); - } - } - if (getConfig().getString("spleefrequestb4player").compareTo("none")==0) { - countdead++; - } else { - if (getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0) { - losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestb4player")); - } else { - winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestb4player")); - } - } - if (getConfig().getString("spleefrequestc4player").compareTo("none")==0) { - countdead++; - } else { - if (getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0) { - losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestc4player")); - } else { - winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestc4player")); - } - } - if (getConfig().getString("spleefrequestd4player").compareTo("none")==0) { - countdead++; - } else { - if (getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0) { - losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestd4player")); - } else { - winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestd4player")); - } - } - if (countdead==2) { - getConfig().set("spleef4insession", Boolean.valueOf(false)); - - - - - - //Stand someplace else when you win. - - - //Losing player has losing player stuff happen. - //This was a player that lost. - //Move them out, give them back their stuff. - Location newloc = p.getLocation(); - //Look for the special shovel for the sake of storing it. - /* - ItemStack[] shovelstack = p.getInventory().getContents(); - boolean shovelfound=false; - ItemStack shovel = shovelstack[0]; - for (int i=0;i1600 || p.getLocation().getZ()<24 || p.getLocation().getZ()>39 || p.getLocation().getY()<86.5d) && ( + (p.getName().compareTo(getConfig().getString("spleefrequesta4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestb4player"))==0 + || p.getName().compareTo(getConfig().getString("spleefrequestc4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestd4player"))==0))) { + //You lose. + //See if we're the winner. + int countdead=0; //We're looking for 3. + + + Player winningplayer = p,losingplayer = p; + if (getConfig().getString("spleefrequesta4player").compareTo("none")==0) { + countdead++; + } else { + if (getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequesta4player")); + } else { + winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequesta4player")); } } - store_shovel = shovel; - */ - p.getInventory().clear(); - p.getInventory().clear(p.getInventory().getHeldItemSlot()); - //Give inventories back. - if (getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { - for (int i=0;i=400) { + //WE have come to a standstill. Pick winner based on who has more blocks. + int player_a_blocks=0,player_b_blocks=0; + for (int i=Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).getLocation().getBlockX()-4;iplayer_b_blocks) { + blockwinner=1; + } else { + blockwinner=2; + } + } else + if ((p.getLocation().getY()<86.5d || p.getLocation().getZ()<52.0d || p.getLocation().getZ()>65.0d || p.getLocation().getX()>1628.0d || p.getLocation().getX()<1615.0d) || blockwinner!=0) { + //We lose. Other player wins. + getConfig().set("spleefinsession", Boolean.valueOf(false)); + //Find out if we're player A, or player B. + Player winningplayer,losingplayer; + if (p.getName().compareTo(getConfig().getString("spleefrequestaplayer"))==0 || blockwinner==2) { + //We're player A. + //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestbplayer")+" is the winner of this spleef game! "+getConfig().getString("spleefrequestaplayer")+" loses."); + losingplayer=p; + winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestbplayer")); + + double val1,val2,value,newval1,newval2; + if (getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { + val1 = getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); + } else { + val1 = 1000.0d; } - getConfig().set("spleefrequestc4player",String.valueOf("none")); - } else - if (getConfig().getString("spleefrequestd4player").compareTo(winningplayer.getName())==0) { - for (int i=0;i=400) { - //WE have come to a standstill. Pick winner based on who has more blocks. - int player_a_blocks=0,player_b_blocks=0; - for (int i=Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).getLocation().getBlockX()-4;iplayer_b_blocks) { - blockwinner=1; - } else { - blockwinner=2; - } - } else - if ((p.getLocation().getY()<86.5d || p.getLocation().getZ()<52.0d || p.getLocation().getZ()>65.0d || p.getLocation().getX()>1628.0d || p.getLocation().getX()<1615.0d) || blockwinner!=0) { - //We lose. Other player wins. - getConfig().set("spleefinsession", Boolean.valueOf(false)); - //Find out if we're player A, or player B. - Player winningplayer,losingplayer; - if (p.getName().compareTo(getConfig().getString("spleefrequestaplayer"))==0 || blockwinner==2) { - //We're player A. - //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestbplayer")+" is the winner of this spleef game! "+getConfig().getString("spleefrequestaplayer")+" loses."); - losingplayer=p; - winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestbplayer")); - - double val1,val2,value,newval1,newval2; - if (getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { - val1 = getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); - } else { - val1 = 1000.0d; - } - if (getAccountsConfig().contains(losingplayer.getName()+".spleefrating")) { - val2 = getAccountsConfig().getDouble(losingplayer.getName()+".spleefrating"); - } else { - val2 = 1000.0d; - } - value = 1.0d/(1.0d+Math.pow(10.0d, ((val2-val1)/400.0d))); - if (getAccountsConfig().contains(winningplayer.getName()+".spleefwins")) { - getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(getAccountsConfig().getInt(winningplayer.getName()+".spleefwins")+1)); - } else { - getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(1)); - } - if (getAccountsConfig().contains(winningplayer.getName()+".spleeflosses")) { - getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(getAccountsConfig().getInt(winningplayer.getName()+".spleeflosses"))); - } else { - getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(0)); - } - if (getAccountsConfig().contains(losingplayer.getName()+".spleefwins")) { - getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(getAccountsConfig().getInt(losingplayer.getName()+".spleefwins"))); - } else { - getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(0)); - } - if (getAccountsConfig().contains(losingplayer.getName()+".spleeflosses")) { - getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(getAccountsConfig().getInt(losingplayer.getName()+".spleeflosses")+1)); - } else { - getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(1)); + //Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).updateInventory(); + //Bukkit.getPlayer(getConfig().getString("spleefrequestbplayer")).updateInventory(); } - newval1 = (val1+Math.round(((50.0d/((getAccountsConfig().getDouble(winningplayer.getName()+".spleefwins")+getAccountsConfig().getDouble(winningplayer.getName()+".spleeflosses"))/20.0d))*(1.0d-value)))); - newval2 = (val2+Math.round(((50.0d/((getAccountsConfig().getDouble(losingplayer.getName()+".spleefwins")+getAccountsConfig().getDouble(losingplayer.getName()+".spleeflosses"))/20.0d))*(0.0d-value)))); - getAccountsConfig().set(winningplayer.getName()+".spleefrating",Double.valueOf(newval1)); - getAccountsConfig().set(losingplayer.getName()+".spleefrating",Double.valueOf(newval2)); - Location newloc = winningplayer.getLocation(); - - Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestbplayer")+"["+(int)newval1/10+"] is the winner of this spleef game! "+getConfig().getString("spleefrequestaplayer")+"["+(int)newval2/10+"] loses."); - newloc.setX(1622.5d); - newloc.setY(87.0d); - newloc.setZ(51.65d); - winningplayer.teleport(newloc); - updateTopSPLEEFSigns(); - //saveAccountsConfig() //Commented out; } else { - //We're player B. - //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestaplayer")+" is the winner of this spleef game! "+getConfig().getString("spleefrequestbplayer")+" loses."); - losingplayer=p; - winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")); - double val1,val2,value,newval1,newval2; - if (getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { - val1 = getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); - } else { - val1 = 1000.0d; - } - if (getAccountsConfig().contains(losingplayer.getName()+".spleefrating")) { - val2 = getAccountsConfig().getDouble(losingplayer.getName()+".spleefrating"); - } else { - val2 = 1000.0d; - } - value = 1.0d/(1.0d+Math.pow(10.0d, ((val2-val1)/400.0d))); - if (getAccountsConfig().contains(winningplayer.getName()+".spleefwins")) { - getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(getAccountsConfig().getInt(winningplayer.getName()+".spleefwins")+1)); - } else { - getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(1)); - } - if (getAccountsConfig().contains(winningplayer.getName()+".spleeflosses")) { - getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(getAccountsConfig().getInt(winningplayer.getName()+".spleeflosses"))); - } else { - getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(0)); - } - if (getAccountsConfig().contains(losingplayer.getName()+".spleefwins")) { - getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(getAccountsConfig().getInt(losingplayer.getName()+".spleefwins"))); - } else { - getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(0)); - } - if (getAccountsConfig().contains(losingplayer.getName()+".spleeflosses")) { - getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(getAccountsConfig().getInt(losingplayer.getName()+".spleeflosses")+1)); - } else { - getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(1)); - } - newval1 = ((val1+Math.round((50.0d/((getAccountsConfig().getDouble(winningplayer.getName()+".spleefwins")+getAccountsConfig().getDouble(winningplayer.getName()+".spleeflosses"))/20.0d))*(1.0d-value)))); - newval2 = ((val2+Math.round((50.0d/((getAccountsConfig().getDouble(losingplayer.getName()+".spleefwins")+getAccountsConfig().getDouble(losingplayer.getName()+".spleeflosses"))/20.0d))*(0.0d-value)))); - getAccountsConfig().set(winningplayer.getName()+".spleefrating",Double.valueOf(newval1)); - getAccountsConfig().set(losingplayer.getName()+".spleefrating",Double.valueOf(newval2)); - Location newloc = winningplayer.getLocation(); - - Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestaplayer")+"["+(int)newval1/10+"] is the winner of this spleef game! "+getConfig().getString("spleefrequestbplayer")+"["+(int)newval2/10+"] loses."); - newloc.setX(1622.5d); - newloc.setY(87.0d); - newloc.setZ(51.65d); - winningplayer.teleport(newloc); - updateTopSPLEEFSigns(); - //saveAccountsConfig() //Commented out; - } - //Look for the special shovel. - /* - ItemStack[] shovelstack = Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).getInventory().getContents(); - boolean shovelfound=false; - ItemStack shovel = shovelstack[0]; - Bukkit.getPlayer("sigonasr2").sendMessage("Starting shovel check."); - for (int i=0;i78.0d && p.getLocation().getZ()>53.0d && p.getLocation().getZ()<64.0d && p.getLocation().getX()<1627.0d && p.getLocation().getX()>1616.0d) { + Location newloc = p.getLocation(); + newloc.setX(1622.5d); + newloc.setY(87.0d); + newloc.setZ(51.65d); + p.teleport(newloc); + p.sendMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"You are a spectator! What are you thinking?!"); } } } - if (shovelfound) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Found a shovel, transporting in chest box."); - Location l1 = new Location(Bukkit.getWorld("world"), 1622, 85, 58); - Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); - c.getBlockInventory().setItem((int)(Math.random()*27.0d), shovel); - }*/ - Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).getInventory().clear(); - Bukkit.getPlayer(getConfig().getString("spleefrequestbplayer")).getInventory().clear(); - Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).getInventory().clear(Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).getInventory().getHeldItemSlot()); - Bukkit.getPlayer(getConfig().getString("spleefrequestbplayer")).getInventory().clear(Bukkit.getPlayer(getConfig().getString("spleefrequestbplayer")).getInventory().getHeldItemSlot()); - //Give inventories back. - for (int i=0;i78.0d && p.getLocation().getZ()>53.0d && p.getLocation().getZ()<64.0d && p.getLocation().getX()<1627.0d && p.getLocation().getX()>1616.0d) { - Location newloc = p.getLocation(); - newloc.setX(1622.5d); - newloc.setY(87.0d); - newloc.setZ(51.65d); - p.teleport(newloc); - p.sendMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"You are a spectator! What are you thinking?!"); - } } } - } - } - this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ - public void run(){ - runTick(); - } }, 1l, 1l); } diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index e5c90a8..2b49c27 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -3646,7 +3646,6 @@ implements Listener e.getBlock().getType()==Material.SAND || e.getBlock().getType()==Material.GRAVEL && Math.random()<=0.0025 /*0.25% chance*/) { ItemStack artifact = new ItemStack(Material.CLAY_BALL); - artifact.addEnchantment(Enchantment.LOOT_BONUS_MOBS, 0); ItemMeta meta = artifact.getItemMeta(); List lore = new ArrayList(); lore.add("This clump of material seems to"); @@ -7108,59 +7107,6 @@ implements Listener ev.event=0; this.plugin.explorers.add(ev); } - - final public void doFireAspectDamage(final LivingEntity l, final Main plug) { - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - if (l.getHealth()!=0 && l.getFireTicks()>60 && !l.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) { - double firedmg=1; - double oldfireticks=l.getFireTicks(); - DecimalFormat df = new DecimalFormat("#0.0"); - DecimalFormat df2 = new DecimalFormat("#0"); - //Bukkit.getLogger().info(l.getType().name()+" health: "+l.getHealth()+", Fire ticks:"+l.getFireTicks()); - //Get all fire protection values. - if (l.getEquipment().getBoots()!=null) { - for (int i=0;i0) { - l.setHealth(l.getHealth()-firedmg); - } else { - l.setHealth(0); - } - if (l instanceof Player) { - if (plug.getAccountsConfig().getBoolean(((Player)l).getName()+".settings.notify5")) { - ((Player)l).sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(firedmg)+" damage from "+ChatColor.WHITE+"FIRE_TICK"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((firedmg)/l.getMaxHealth())*100)+"%)"); - } - } - doFireAspectDamage(l, plug); - } - } - },(int)(20/((double)l.getFireTicks()/60))+1); - } @EventHandler public void onHurt(EntityDamageEvent e) { @@ -7177,7 +7123,7 @@ implements Listener } },5); //p.sendMessage("Your Health: "+p.getHealth()+", Damage: "+e.getDamage()+", Actual: "+this.plugin.DMGCALC.getDamage(p, e.getDamage(), DamageCause.ENTITY_ATTACK)); - //double actualdmg = this.plugin.DMGCALC.getDamage(p, e.getDamage(), e.getCause()); + double actualdmg = this.plugin.DMGCALC.getDamage(p, e.getDamage(), e.getCause()); List nearby = p.getNearbyEntities(10, 10, 10); for (int i=0;i=20) { @@ -7254,11 +7200,14 @@ implements Listener } } 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}; - boolean contains=e.getEntity() instanceof LivingEntity; + boolean contains=e.getEntity() instanceof Monster; if (contains) { LivingEntity l = (LivingEntity)e.getEntity(); - if (l.getFireTicks()>60 && e.getCause()==DamageCause.LAVA && !l.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) { - l.setFireTicks(l.getFireTicks()+20); + if ((l.getCustomName()==null || (!l.getCustomName().contains(ChatColor.DARK_PURPLE+"") && !l.getCustomName().contains(ChatColor.DARK_AQUA+""))) && l.getType()!=EntityType.ENDER_DRAGON) { + if ((l.getTicksLived()<120 && e.getCause()==DamageCause.SUFFOCATION)) { + l.remove(); + e.setCancelled(true); + } } } } @@ -7322,9 +7271,6 @@ implements Listener @EventHandler public void onPlayerOnFire(EntityCombustEvent e) { - if (e.getEntity() instanceof LivingEntity) { - doFireAspectDamage(((LivingEntity)e.getEntity()), this.plugin); - } if (e.getEntity().getType()==EntityType.PLAYER) { Player p = (Player)e.getEntity(); if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")>0) { @@ -7399,16 +7345,6 @@ implements Listener if (e.getEntity() instanceof LivingEntity) { final LivingEntity l = (LivingEntity)e.getEntity(); - if (e.getDamager() instanceof LivingEntity) { - //They are both living entities. Check if damager has fire aspect. - LivingEntity l2 = (LivingEntity)e.getDamager(); - if (l2.getEquipment().getItemInHand().getEnchantmentLevel(Enchantment.FIRE_ASPECT)>0) { - l.setFireTicks(l.getFireTicks()+l2.getEquipment().getItemInHand().getEnchantmentLevel(Enchantment.FIRE_ASPECT)*60); - } - if (l2.getEquipment().getItemInHand().getEnchantmentLevel(Enchantment.ARROW_FIRE)>0) { - l.setFireTicks(l.getFireTicks()+l2.getEquipment().getItemInHand().getEnchantmentLevel(Enchantment.ARROW_FIRE)*60); - } - } if (l instanceof Player) { e.setDamage(e.getDamage()*1.45d); if (e.getDamager() instanceof Wither) { @@ -10955,7 +10891,7 @@ implements Listener } //There is a small chance we can swap items between two centers. - if (Math.random()<=0.1) { + if (Math.random()<=0.01) { //Get the first center. It's randomly picked. if (this.plugin.recycling_center_list.size()<=2) { //If there are only two centers in the list, it has to be those two... @@ -11815,7 +11751,6 @@ implements Listener final Player p = e.getEntity(); e.setDeathMessage(e.getDeathMessage().replace(p.getScoreboard().getTeam(p.getName()).getPrefix()+p.getName()+p.getScoreboard().getTeam(p.getName()).getSuffix(),p.getName())); p.getScoreboard().getTeam(p.getName()).setSuffix(""); - this.plugin.last_player_death_time = Main.SERVER_TICK_TIME; boolean survivor=false; if (this.plugin.PlayerinJob(p, "Explorer")) { if (this.plugin.getJobLv("Explorer", p)>=10) { @@ -12621,6 +12556,10 @@ implements Listener //******************************//All Job Buff related items go in here. if (e.getAction()==Action.LEFT_CLICK_BLOCK || e.getAction()==Action.RIGHT_CLICK_AIR) { if (this.plugin.hasJobBuff("Builder", p, Job.JOB10)) { + if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) { + p.removePotionEffect(PotionEffectType.JUMP); + p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9)); + } if (this.plugin.hasJobBuff("Builder", p, Job.JOB40) && !p.getAllowFlight()) { p.setAllowFlight(true); p.sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Flight enabled..."); @@ -12646,10 +12585,6 @@ implements Listener pd.SetClickedBlock(checkblock.getLocation()); } else { if (pd.GetClickedBlock().distance(checkblock.getLocation())<=500) {//Make sure the range is small enough. - if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) { - p.removePotionEffect(PotionEffectType.JUMP); - p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9)); - } //Compare the blocks and see if they are the same. boolean successful=true; int expbefore = (int)this.plugin.getPlayerCurrentJobExp(p, "Builder"); @@ -12782,6 +12717,10 @@ implements Listener } } if (e.getAction()==Action.LEFT_CLICK_BLOCK && this.plugin.hasJobBuff("Builder", p, Job.JOB5)) { + if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) { + p.removePotionEffect(PotionEffectType.JUMP); + p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9)); + } if (this.plugin.hasJobBuff("Builder", p, Job.JOB40) && !p.getAllowFlight()) { p.setAllowFlight(true); p.sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Flight enabled..."); @@ -12800,10 +12739,6 @@ implements Listener pd.SetClickedBlock(e.getClickedBlock().getLocation()); } else { if (pd.GetClickedBlock().distance(e.getClickedBlock().getLocation())<=500) {//Make sure the range is small enough. - if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) { - p.removePotionEffect(PotionEffectType.JUMP); - p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9)); - } int expbefore = (int)this.plugin.getPlayerCurrentJobExp(p, "Builder"); //Compare the blocks and see if they are the same. boolean successful=true; diff --git a/BankEconomyMod/src/me/kaZep/Base/RecyclingCenterNode.java b/BankEconomyMod/src/me/kaZep/Base/RecyclingCenterNode.java index 4b049ad..889670c 100644 --- a/BankEconomyMod/src/me/kaZep/Base/RecyclingCenterNode.java +++ b/BankEconomyMod/src/me/kaZep/Base/RecyclingCenterNode.java @@ -15,8 +15,8 @@ import org.bukkit.plugin.Plugin; //deposit, choosing the closest one. public class RecyclingCenterNode { - public static double chanceincrease = 1.5; //The amount of chance that each item will increase the chest as it gets placed. Increase this for less items. - public static double chestdecrease = 0.25; //The amount of chance that each item will decrease the chest. Increase this for more items. + public static double chanceincrease = 3.0; //The amount of chance that each item will increase the chest as it gets placed. Increase this for less items. + public static double chestdecrease = 0.05; //The amount of chance that each item will decrease the chest. Increase this for more items. //Store our items we can give out array along with our rare items we might potentially track. public static int[] items = {1,3,4,5,6,12,13,14,15,17,18,20,22,23,24,25,27,28,39,31,32,33,35,37,38,39,40,41,42,44,45,46,47,48,49,50,53,54,57,58,61,65,66,67,69,70,72,76,77,78,80,81,82,84,85,86,87,88,89,91,96,98,101,102,103,106,107,108,109,111,112,113,114,116,121,122,123,126,128,130,131,133,134,135,136,138,139,143,145,146,147,148,151,152,154,155,156,157,158,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267}; //Rare items can only be given out in quantities of 1. To prevent massive amounts of OP. @@ -102,7 +102,7 @@ public class RecyclingCenterNode { tempchance*=2.0d; } } - if (Math.random()*tempchance<1.0d || (Main.SERVER_TICK_TIME-this.plugin.last_player_death_time<=12000 && Math.random()*tempchance<4.0d) /*Drop items frequently for the next 10 minutes if someone just died.*/) { + if (Math.random()*tempchance<1.0d) { boolean contains=false; for (int k=0;k