This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
Hello!
I had some concerns in the save, I looked at the code and I rectified this which go much better:
package net.sradonia.bukkit.alphachest;
public class InventoryIO {
public static Inventory loadFromTextfile(File file) throws IOException { final Inventory inventory = Bukkit.getServer().createInventory(null, 6 * 9);
final BufferedReader in = new BufferedReader(new FileReader(file));
String line; int slot = 0; while ((line = in.readLine()) != null) { if (!line.equals("")) { final String[] parts = line.split(":"); try { int type = Integer.parseInt(parts[0]); Material mat = Material.getMaterial(parts[0]); //-------------- Material mat ... int amount = Integer.parseInt(parts[1]); short damage = Short.parseShort(parts[2]); if (type != 0) { inventory.setItem(slot, new ItemStack(mat, amount, damage)); //------- Material mat
// @SuppressWarnings("deprecation") with type } } catch (NumberFormatException e) { } ++slot; } } in.close(); return inventory; }
tanks sowerdb :)
To post a comment, please login or register a new account.