ArrayList<Block> a = new ArrayList<Block>();
@Override
public void onEnable() {
this.saveDefaultConfig();
c = getConfig();
for (String b : c.getConfigurationSection("blocks").getKeys(false)) {
a.add(Bukkit.getWorld("blocks."+b+"world").getBlockAt(c.getInt("blocks."+b+"x"), c.getInt("blocks."+b+"y"), c.getInt("blocks."+b+"z")));
}
}
private void addToList(Block b) {
a.add(b);
}
public void onDisable() {
for (String b : c.getConfigurationSection("blocks").getKeys(false)) {
c.set("blocks."+b, null);
}
for (int i=0;i<a.size();i++) {
Block b = a.get(i);
String w = b.getWorld().getName();
int x = b.getX();
int y = b.getY();
int z = b.getZ();
c.set("blocks."+i+".world", w);
c.set("blocks."+i+".x", x);
c.set("blocks."+i+".y", y);
c.set("blocks."+i+".z", z);
saveConfig();
}
}