/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/TemplateCommand.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/TemplateCommand.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1752 by torben, Mon Mar 19 08:09:08 2012 UTC revision 1759 by torben, Mon Mar 19 20:21:14 2012 UTC
# Line 53  public class TemplateCommand implements Line 53  public class TemplateCommand implements
53                          return true;                          return true;
54                  }                                }              
55    
56                  File templateFile = new File( plugin.getDataFolder(), "template_" + args[0] + ".txt");                            File templateFile = new File( plugin.getDataFolder(), "templates/" + args[0] + ".txt");        
57                  if (! templateFile.exists()  ) {                  if (! templateFile.exists()  ) {
58                          sender.sendMessage( ChatColor.YELLOW + "Template not found" );                          sender.sendMessage( ChatColor.YELLOW + "Template not found" );
59                          return true;                          return true;
# Line 120  public class TemplateCommand implements Line 120  public class TemplateCommand implements
120                          if (line.length() == 0)                          if (line.length() == 0)
121                                  continue;                                  continue;
122    
123                          if (line.charAt(0) == '-')                          if (line.charAt(0) == '#')
124                                  continue;                                  continue;
125                            
126                            if ( y >= ysize) {
127                                    throw new Exception( "Template: found more levels in file than specified in header" );
128                            }
129    
130                          String elements[] = line.split(",");                          String elements[] = line.split(",");
131                          if (elements.length != zsize) {                          if (elements.length != zsize) {
# Line 141  public class TemplateCommand implements Line 145  public class TemplateCommand implements
145                                          throw new Exception( "Template: invalid value on line " + lines + ": " + element[0] );                                          throw new Exception( "Template: invalid value on line " + lines + ": " + element[0] );
146                                  }                                  }
147                                                                    
148                                  if (val < 0 || val>255) {                                  if (val < -1 || val>255) {
149                                          throw new Exception( "Template: invalid value on line " + lines + ": " + val );                                          throw new Exception( "Template: invalid value on line " + lines + ": " + val );
150                                  }                                  }
151                                                                    
# Line 214  public class TemplateCommand implements Line 218  public class TemplateCommand implements
218    
219                                          int type = template[i][j][k].id;                                          int type = template[i][j][k].id;
220                                          byte data = (byte) template[i][j][k].subId;                                          byte data = (byte) template[i][j][k].subId;
221                                            
222                                            if (type == -1) {
223                                                    continue;
224                                            }
225    
226                                          //plugin.getLogger().info(  String.format(  "Setting typeid at %d,%d,%d  to %d", x,y,z, type)  );                                          //plugin.getLogger().info(  String.format(  "Setting typeid at %d,%d,%d  to %d", x,y,z, type)  );
227    
# Line 224  public class TemplateCommand implements Line 232  public class TemplateCommand implements
232                                                          continue;                                                          continue;
233                                                  if (type == 68) // sign                                                  if (type == 68) // sign
234                                                          continue;                                                          continue;
235                                                    if (type == 65) // ladder
236                                                            continue;
237                                                    if (type == 67) // steps
238                                                            continue;                                              
239                                          }                                          }
240                                                                                    
241                                          world.getBlockAt(x, y, z).setTypeIdAndData(type, data, true);                                          world.getBlockAt(x, y, z).setTypeIdAndData(type, data, true);

Legend:
Removed from v.1752  
changed lines
  Added in v.1759

  ViewVC Help
Powered by ViewVC 1.1.20