--- miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/TemplateCommand.java 2012/03/19 08:09:08 1752 +++ miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/TemplateCommand.java 2012/03/19 15:04:57 1758 @@ -53,7 +53,7 @@ return true; } - File templateFile = new File( plugin.getDataFolder(), "template_" + args[0] + ".txt"); + File templateFile = new File( plugin.getDataFolder(), "templates/" + args[0] + ".txt"); if (! templateFile.exists() ) { sender.sendMessage( ChatColor.YELLOW + "Template not found" ); return true; @@ -122,6 +122,10 @@ if (line.charAt(0) == '-') continue; + + if ( y >= ysize) { + throw new Exception( "Template: found more levels in file than specified in header" ); + } String elements[] = line.split(","); if (elements.length != zsize) { @@ -141,7 +145,7 @@ throw new Exception( "Template: invalid value on line " + lines + ": " + element[0] ); } - if (val < 0 || val>255) { + if (val < -1 || val>255) { throw new Exception( "Template: invalid value on line " + lines + ": " + val ); } @@ -214,6 +218,10 @@ int type = template[i][j][k].id; byte data = (byte) template[i][j][k].subId; + + if (type == -1) { + continue; + } //plugin.getLogger().info( String.format( "Setting typeid at %d,%d,%d to %d", x,y,z, type) ); @@ -224,6 +232,10 @@ continue; if (type == 68) // sign continue; + if (type == 65) // ladder + continue; + if (type == 67) // steps + continue; } world.getBlockAt(x, y, z).setTypeIdAndData(type, data, true);