diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 87271f8..4d508c8 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -858,9 +858,9 @@ public class Main extends JavaPlugin ShapedRecipe wood_sword_upgrade_recipe = new ShapedRecipe(new ItemStack(Material.WOOD_SWORD)); MaterialData base_mat = new MaterialData(Material.STICK); + wood_sword_upgrade_recipe.shape("aaa","aba","aaa"); wood_sword_upgrade_recipe.setIngredient('a', base_mat); wood_sword_upgrade_recipe.setIngredient('b', Material.WOOD_SWORD); - wood_sword_upgrade_recipe.shape("aaa","aba","aaa"); Bukkit.addRecipe(wood_sword_upgrade_recipe); base_mat = new MaterialData(Material.WOOD); wood_sword_upgrade_recipe.setIngredient('a', base_mat); @@ -873,9 +873,9 @@ public class Main extends JavaPlugin Bukkit.addRecipe(wood_sword_upgrade_recipe); ShapedRecipe stone_sword_upgrade_recipe = new ShapedRecipe(new ItemStack(Material.STONE_SWORD)); base_mat = new MaterialData(Material.COBBLESTONE); + stone_sword_upgrade_recipe.shape("aaa","aba","aaa"); stone_sword_upgrade_recipe.setIngredient('a', base_mat); stone_sword_upgrade_recipe.setIngredient('b', Material.STONE_SWORD); - stone_sword_upgrade_recipe.shape("aaa","aba","aaa"); Bukkit.addRecipe(stone_sword_upgrade_recipe); base_mat = new MaterialData(Material.STONE); stone_sword_upgrade_recipe.setIngredient('a', base_mat); @@ -888,9 +888,9 @@ public class Main extends JavaPlugin Bukkit.addRecipe(stone_sword_upgrade_recipe); ShapedRecipe iron_sword_upgrade_recipe = new ShapedRecipe(new ItemStack(Material.IRON_SWORD)); base_mat = new MaterialData(Material.IRON_INGOT); + iron_sword_upgrade_recipe.shape("aaa","aba","aaa"); iron_sword_upgrade_recipe.setIngredient('a', base_mat); iron_sword_upgrade_recipe.setIngredient('b', Material.IRON_SWORD); - iron_sword_upgrade_recipe.shape("aaa","aba","aaa"); Bukkit.addRecipe(iron_sword_upgrade_recipe); base_mat = new MaterialData(Material.IRON_BLOCK); iron_sword_upgrade_recipe.setIngredient('a', base_mat); @@ -903,9 +903,9 @@ public class Main extends JavaPlugin Bukkit.addRecipe(iron_sword_upgrade_recipe); ShapedRecipe gold_sword_upgrade_recipe = new ShapedRecipe(new ItemStack(Material.GOLD_SWORD)); base_mat = new MaterialData(Material.GOLD_INGOT); + gold_sword_upgrade_recipe.shape("aaa","aba","aaa"); gold_sword_upgrade_recipe.setIngredient('a', base_mat); gold_sword_upgrade_recipe.setIngredient('b', Material.IRON_SWORD); - gold_sword_upgrade_recipe.shape("aaa","aba","aaa"); Bukkit.addRecipe(gold_sword_upgrade_recipe); base_mat = new MaterialData(Material.GOLD_BLOCK); gold_sword_upgrade_recipe.setIngredient('a', base_mat); @@ -918,9 +918,9 @@ public class Main extends JavaPlugin Bukkit.addRecipe(gold_sword_upgrade_recipe); ShapedRecipe diamond_sword_upgrade_recipe = new ShapedRecipe(new ItemStack(Material.DIAMOND_SWORD)); base_mat = new MaterialData(Material.DIAMOND); + diamond_sword_upgrade_recipe.shape("aaa","aba","aaa"); diamond_sword_upgrade_recipe.setIngredient('a', base_mat); diamond_sword_upgrade_recipe.setIngredient('b', Material.DIAMOND_SWORD); - diamond_sword_upgrade_recipe.shape("aaa","aba","aaa"); Bukkit.addRecipe(diamond_sword_upgrade_recipe); base_mat = new MaterialData(Material.DIAMOND_BLOCK); diamond_sword_upgrade_recipe.setIngredient('a', base_mat); @@ -2177,7 +2177,7 @@ public void runTick() { 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.DIAMOND_ORE)) { - if (Math.random()<=0.60) { + if (Math.random()<=0.32) { removeore++; b.setType(Material.STONE); } @@ -2331,6 +2331,51 @@ public void runTick() { } } } + if (nearby.get(i).getType()==EntityType.ZOMBIE) { + Creature l = (Creature)nearby.get(i); + if (l.getCustomName().compareTo(ChatColor.GOLD+"Charge Zombie II")==0 && !l.isDead() && l.getKiller()!=null) { + 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 && naturalBlock(bl.getType())) { + 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 && naturalBlock(bl.getType())) { + 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 && naturalBlock(bl.getType())) { + bl.breakNaturally(); + } + } + } + } + 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.getType()!=Material.COMMAND && naturalBlock(bl.getType())) { + 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 && naturalBlock(bl.getType())) { + 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 && naturalBlock(bl.getType())) { + bl.breakNaturally(); + } + } + } + } + } if (nearby.get(i).getType()==EntityType.ENDERMAN) { Creature l = (Creature)nearby.get(i); if (l.getCustomName()!=null && l.getCustomName().equalsIgnoreCase(ChatColor.RED+"Lightning Mage") && l.getTarget()!=null) { @@ -3242,7 +3287,7 @@ public void checkJukeboxes() { } } //Bukkit.getLogger().info("For player "+list[i].getName()+", Chunk air density is "+((double)airmeasure/12800)*100.0d+"%"); - if (!spawneddungeon && ((double)airmeasure/12800)*100.0d<=10) { //Make sure the air density is small enough that we are allowed to carve things. + if (!spawneddungeon && ((double)airmeasure/12800)*100.0d<=6.5) { //Make sure the air density is small enough that we are allowed to carve things. //See if the player is very far underground and there is nothing around him/her. This would be odd behavior (Hint at strip mining) and we will force Charge Zombie II's to spawn and create areas. List nearby = list[i].getNearbyEntities(20, 5, 20); for (int j=0;j-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k,spread+l)); if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { - b.setType(Material.AIR); + //b.setType(Material.AIR); } } } @@ -3303,7 +3348,7 @@ public void checkJukeboxes() { for (int l=lb2;l>-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(-20+j,k,spread+l)); if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { - b.setType(Material.AIR); + //b.setType(Material.AIR); } } } @@ -3328,7 +3373,7 @@ public void checkJukeboxes() { for (int l=lb2;l>-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k,20+l)); if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { - b.setType(Material.AIR); + //b.setType(Material.AIR); } } } @@ -3353,7 +3398,7 @@ public void checkJukeboxes() { for (int l=lb2;l>-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k,-20+l)); if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { - b.setType(Material.AIR); + //b.setType(Material.AIR); } } } diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index f022de5..0dff335 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -2896,7 +2896,7 @@ implements Listener } } } - if (((double)airmeasure/12800)*100.0d<=10) { + if (((double)airmeasure/12800)*100.0d<=6.5) { int size=((int)(Math.random()*5))+1; for (int k=-size;k-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(10+j,k,spread+l)); if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { - b.setType(Material.AIR); + //b.setType(Material.AIR); } } } @@ -4866,7 +4866,7 @@ implements Listener for (int l=lb2;l>-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(-10+j,k,spread+l)); if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { - b.setType(Material.AIR); + //b.setType(Material.AIR); } } } @@ -4893,7 +4893,7 @@ implements Listener for (int l=lb2;l>-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,10+l)); if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { - b.setType(Material.AIR); + //b.setType(Material.AIR); } } } @@ -4920,7 +4920,7 @@ implements Listener for (int l=lb2;l>-ub2;l--) { Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,-10+l)); if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME && naturalBlock(b.getType())) { - b.setType(Material.AIR); + //b.setType(Material.AIR); } } } @@ -9813,8 +9813,8 @@ implements Listener } if (p.getItemInHand()!=null) { if (p.getItemInHand().getType().toString().toLowerCase().contains("sword")) { - //Divide damage by 4. - e.setDamage(e.getDamage()/4.0d); + //Divide damage by 2.4. + e.setDamage(e.getDamage()/2.4d); //Increase damage based on power level of weapon. double dmg_ratio = 0; if (p.getItemInHand().getType()==Material.WOOD_SWORD) { diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 7a83364..f1f8923 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -627,6 +627,124 @@ public String convertToItemName(String val) { p.sendMessage("Changed name tag's title to "+p.getItemInHand().getItemMeta().getDisplayName()+"."); } } else + if (cmd.getName().toLowerCase().equalsIgnoreCase("event") && args.length==3 && p.hasPermission("maintenance-mode-admin")) { + + + if (args[0].equalsIgnoreCase("regen_chunk") /*DISABLED to prevent accidental execution.*/) { + if (p.hasPermission("maintenance-mode-admin")) { + //boolean result=p.getWorld().regenerateChunk(p.getLocation().getBlockX()/16, p.getLocation().getBlockZ()/16); + //Bukkit.getLogger().info("Chunk regenerated: "+result+" ("+p.getLocation().getBlockX()/16+","+p.getLocation().getBlockZ()/16+")"); + /*byte[] worldarray = p.getWorld().getGenerator().generate(p.getWorld(), new Random(), p.getLocation().getBlockX()/16, p.getLocation().getBlockZ()/16); + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + for (int y = 0; y < 128; y++) { + Bukkit.getLogger().info("Block @ ("+x+","+y+","+z+") is "+worldarray[(x * 16 + z) * 128 + y]); + } + } + }*/ + /* + //Create a new tempworld that mimics the real world, generator-wise. + World newworld = Bukkit.createWorld(new WorldCreator("newworld").copy(p.getWorld())); + p.teleport(new Location(newworld,0,0,0)); + for (int x=-720;x<721;x++) { + for (int z=-720;z<721;z++) { + Bukkit.getLogger().info("Creating new chunk at ("+x+","+z+") for world newworld."); + newworld.loadChunk(x,z,true); + } + }*/ + + Location CenterPoint = new Location(p.getWorld(),1627,67,-268); //Center of Twoside. + int iterations=100*(Integer.valueOf(args[1])+50); + for (int MASTER_i=-Integer.valueOf(args[1]);MASTER_i0;y--) { + boolean found=false; + /* + for (int x=0;x<16;x++) { + for (int z=0;z<16;z++) { + if (!naturalBlock(p.getWorld().getBlockAt(chunkx*16+x,y,chunkz*16+z).getType())) { + found=true; + lowest-=8; + y-=7; + break; + } + } + if (found) {break;} + }*/ + if (!found) { + boolean found2=false; + for (int x=0;x<16;x++) { + for (int yy=0;yy<8;yy++) { + for (int z=0;z<16;z++) { + if (!naturalBlock(p.getWorld().getBlockAt(chunkx*16+x,y+yy,chunkz*16+z).getType())) { + found2=true; + lowest-=8; + y-=7; + break; + } + } + } + if (!found2) {break;} + } + if (!found2) {break;} + } + } + + final Location loc1 = new Location(p.getWorld(),chunkx*16-16,Math.max(lowest,1),chunkz*16-16); + final Location loc2 = new Location(p.getWorld(),chunkx*16+32,128,chunkz*16+32); + final File saveFile = new File("plugins/WorldEdit/schematics/world_save"); + try { + tm.saveTerrain(saveFile, loc1, loc2); + } catch (FilenameException ex) { + // TODO Auto-generated catch block + ex.printStackTrace(); + } catch (DataException ex) { + // TODO Auto-generated catch block + ex.printStackTrace(); + } catch (IOException ex) { + // TODO Auto-generated catch block + ex.printStackTrace(); + } + //final ChunkSnapshot savedChunk = p.getWorld().getChunkAt(chunkx, chunkz).getChunkSnapshot(); + final Player p2 = p; + final int chunkx2=chunkx,chunkz2=chunkz; + p.getWorld().regenerateChunk(chunkx2, chunkz2); + + try { + tm.loadSchematic(saveFile); + } catch (FilenameException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (MaxChangedBlocksException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (EmptyClipboardException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (DataException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //Bukkit.getLogger().info("->Updated this layer. ("+(int)(iterations/10000d*100)+"%)"); + p.getWorld().unloadChunkRequest(chunkx2, chunkz2); + } + } + } + } + } if (cmd.getName().toLowerCase().equalsIgnoreCase("event") && args.length==1 && p.hasPermission("maintenance-mode-admin")) { if (args[0].equalsIgnoreCase("halloween")) { if (this.plugin.getConfig().getBoolean("halloween-enabled")) { @@ -1024,117 +1142,6 @@ public String convertToItemName(String val) { i.setItemMeta(meta); f.getInventory().addItem(i); } - - if (args[0].equalsIgnoreCase("regen_chunk") && 0==1 /*DISABLED to prevent accidental execution.*/) { - if (p.hasPermission("maintenance-mode-admin")) { - //boolean result=p.getWorld().regenerateChunk(p.getLocation().getBlockX()/16, p.getLocation().getBlockZ()/16); - //Bukkit.getLogger().info("Chunk regenerated: "+result+" ("+p.getLocation().getBlockX()/16+","+p.getLocation().getBlockZ()/16+")"); - /*byte[] worldarray = p.getWorld().getGenerator().generate(p.getWorld(), new Random(), p.getLocation().getBlockX()/16, p.getLocation().getBlockZ()/16); - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - for (int y = 0; y < 128; y++) { - Bukkit.getLogger().info("Block @ ("+x+","+y+","+z+") is "+worldarray[(x * 16 + z) * 128 + y]); - } - } - }*/ - /* - //Create a new tempworld that mimics the real world, generator-wise. - World newworld = Bukkit.createWorld(new WorldCreator("newworld").copy(p.getWorld())); - p.teleport(new Location(newworld,0,0,0)); - for (int x=-720;x<721;x++) { - for (int z=-720;z<721;z++) { - Bukkit.getLogger().info("Creating new chunk at ("+x+","+z+") for world newworld."); - newworld.loadChunk(x,z,true); - } - }*/ - - Location CenterPoint = new Location(p.getWorld(),1627,67,-268); //Center of Twoside. - int iterations=100*(Integer.valueOf(args[1])+50); - for (int MASTER_i=Integer.valueOf(args[1]);MASTER_i<51;MASTER_i++) { - p.getWorld().save(); - for (int MASTER_j=-50;MASTER_j<51;MASTER_j++) { - iterations++; - Bukkit.getLogger().info(""); - Bukkit.getLogger().info("BEGINNING Chunk ("+MASTER_i+","+MASTER_j+") correction..."); - //int rand_factor = (int)(Math.random()*200d); - int chunkx=(MASTER_i*16+CenterPoint.getBlockX()+8)/16, chunkz=(MASTER_j*16+CenterPoint.getBlockZ()+8)/16; - WorldEditPlugin wep = (WorldEditPlugin)Bukkit.getPluginManager().getPlugin("WorldEdit"); - final TerrainManager tm = new TerrainManager(wep, p.getWorld()); - - int lowest=62; - for (int y=lowest;y>0;y--) { - boolean found=false; - for (int x=0;x<16;x++) { - for (int z=0;z<16;z++) { - if (!naturalBlock(p.getWorld().getBlockAt(chunkx*16+x,y,chunkz*16+z).getType())) { - found=true; - lowest--; - break; - } - } - if (found) {break;} - } - if (!found) { - boolean found2=false; - for (int x=0;x<16;x++) { - for (int yy=1;yy<4;yy++) { - for (int z=0;z<16;z++) { - if (!naturalBlock(p.getWorld().getBlockAt(chunkx*16+x,y+yy,chunkz*16+z).getType())) { - found2=true; - break; - } - } - } - if (!found2) {break;} - } - if (!found2) {break;} - } - } - - final Location loc1 = new Location(p.getWorld(),chunkx*16-16,lowest,chunkz*16-16); - final Location loc2 = new Location(p.getWorld(),chunkx*16+32,128,chunkz*16+32); - final File saveFile = new File("plugins/WorldEdit/schematics/world_save"); - try { - tm.saveTerrain(saveFile, loc1, loc2); - } catch (FilenameException ex) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } catch (DataException ex) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } catch (IOException ex) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } - //final ChunkSnapshot savedChunk = p.getWorld().getChunkAt(chunkx, chunkz).getChunkSnapshot(); - final Player p2 = p; - final int chunkx2=chunkx,chunkz2=chunkz; - p.getWorld().regenerateChunk(chunkx2, chunkz2); - - try { - tm.loadSchematic(saveFile); - } catch (FilenameException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (MaxChangedBlocksException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (EmptyClipboardException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (DataException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - Bukkit.getLogger().info("->Updated this layer. ("+(int)(iterations/10000d*100)+"%)"); - p.getWorld().unloadChunkRequest(chunkx2, chunkz2); - } - } - } - } if (args[0].equalsIgnoreCase("halloween") && args[1].equalsIgnoreCase("end")) { p.sendMessage(ChatColor.GRAY+"Ending Harrowing night... Did you make sure it was night time? If not, type this command again after /time night instead."); this.plugin.harrowing_night=true;