You shouldn't save every second.
|
|

NO FLAME
please note I made this for my palidino 508
Code:package acrixium.server.player; import acrixium.server.Engine; /** * * @author Sir Tom * */ public class PlayerSave implements Runnable { ThreadGroup threads = new ThreadGroup("Workers"); PlayerSave() { new Thread(threads, new PlayerSave(), "PlayerSaving").start(); } public void run() { while (true) { for (Player p : Engine.players) { if (p == null) { continue; } else if (p.online) { try { Engine.fileManager.saveCharacter(p); } catch (Exception e) { e.printStackTrace(); } try { Thread.sleep(1000 * 60); } catch (Exception e) { e.printStackTrace(); } } } } } }
You shouldn't save every second.

Good Job Tom![]()
![]()

Your making it save one player then sleep for min then save another player also add a shuitdown hock and make it save then.
fixed
Code:while (true) { try { for (Player p : Engine.players) { if (p == null) { continue; } else if (p.online) { try { Engine.fileManager.saveCharacter(p); } catch (Exception e) { continue; } } } } catch (Exception e) { e.printStackTrace(); } Thread.sleep(1000 * 60); }

oh dear




why ppl are so stupid??
Just make a proper exception handler and then save all players on shutdown..
if u use a shutdown hook,and safe shutdown ,u can make it save.
or if before u call your destruct method ,make char save could also work.
| « [614] RSRegionObjectsManager | Fixing dkk's server » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |