Nvm, fixed that.
Code:
[12/30/11 1:44 PM]: java.lang.NumberFormatException: For input string: "item = 1"
[12/30/11 1:44 PM]: at java.lang.NumberFormatException.forInputString(Unknown Source)
[12/30/11 1:44 PM]: at java.lang.Integer.parseInt(Unknown Source)
[12/30/11 1:44 PM]: at java.lang.Integer.parseInt(Unknown Source)
[12/30/11 1:44 PM]: at server.model.items.ItemDefinition.<init>(ItemDefinition.java:28)
[12/30/11 1:44 PM]: at server.model.items.ItemDefinition.load(ItemDefinition.java:51)
[12/30/11 1:44 PM]: at server.Server.main(Server.java:91)
Code:
package server.model.items;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class ItemDefinition {
public static ItemDefinition[] definitions;
public int id;
public int slot;
public boolean stackable;
public boolean note;
public int reverseId;
public int value;
public int shopValue;
public String name;
public String examine;
public ItemDefinition(String[] values) {
this.id = Integer.parseInt(values[0]);
this.name = values[1];
this.examine = values[2];
this.value = Integer.parseInt(values[3]);
this.shopValue = Integer.parseInt(values[4]);
this.slot = Integer.parseInt(values[5]);
this.stackable = values[6].equals("1");
this.note = values[7].equals("1");
this.reverseId = Integer.parseInt(values[8]);
definitions[this.id] = this;
}
public static void load() {
definitions = new ItemDefinition[21000];
try {
Scanner e = new Scanner(new File("./data/itemdef.txt"));
e.nextLine();
while(e.hasNextLine()) {
String line = e.nextLine();
if(!line.startsWith("//")) {
String[] values = line.split("\t");
new ItemDefinition(values);
}
}
} catch (Exception var3) {
var3.printStackTrace();
System.exit(1);
}
}
public static void dump() throws IOException {
FileWriter fw = new FileWriter(new File("./data/itemdef.txt"));
ItemDefinition[] var4 = definitions;
int var3 = definitions.length;
for(int var2 = 0; var2 < var3; ++var2) {
ItemDefinition def = var4[var2];
if(def != null) {
fw.write(def.id + "\t" + def.name + "\t" + def.examine + "\t" + def.value + "\t" + def.shopValue + "\t");
fw.write(def.slot + "\t" + (def.stackable?"1":"0") + "\t" + (def.note?"1":"0") + "\t" + def.reverseId + "\r\n");
}
}
fw.flush();
fw.close();
}
public static ItemDefinition get(int id) {
return definitions[id];
}
}