Closed shawshark closed 10 years ago
This should already happen, look at this method: https://github.com/niccholaspage/Fe/blob/master/src/org/melonbrew/fe/database/Database.java#L148
What will failure due to the way HashSet and sets in general work. You need to use a Iterator. In my fork I fixed here is the code to fix the method.
public void close()
{
Iterator<Account> iterator= cachedAccounts.iterator();
while(iterator.hasNext())
{
Account account = iterator.next();
account.save(account.getMoney());
iterator.remove();
}
save players accounts on shutdown.