config.java
It should automaticly save every 1 minute and 30 seconds.
|
config.java
It should automaticly save every 1 minute and 30 seconds.
Why would you want to make it save every 30 seconds? It causes a lot of lag. If you are worried about rollbacks add a shutdown hook. PlayerHandler.java :
Code:public static PlayerSave save; static { Runtime.getRuntime().addShutdownHook(new Thread(){ public void run() { System.out.println("Saving players..."); synchronized(this) { for(int i = 0; i < Config.MAX_PLAYERS; i++) if(players[i] != null) save.saveGame((Client)players[i]); } } }); }
Oh my fucking god.
//public static final int SAVE_TIMER = 30; // save every 1 minute
// changed to 15, andrew, 6/25/11
public static final int SAVE_TIMER = 15; // save every 30 seconds
Just add a shutdown hook. PlayerHandler -Code:public static PlayerSave save; static { Runtime.getRuntime().addShutdownHook(new Thread(){ public void run() { System.out.println("Saving players..."); synchronized(this) { for(int i = 0; i < Config.MAX_PLAYERS; i++) if(players[i] != null) save.saveGame((Client)players[i]); } } }); }
i havebut it still doesnt save anybody on server shutdownpublic static PlayerSave save;
static {
Runtime.getRuntime().addShutdownHook(new Thread());
PlayerSave playerSave;
Client cliento1;
for(int i = 0; i < Config.MAX_PLAYERS; i++)
if(players[i] != null)
((Client)players[i]).save.saveGame(Client.cliento2);
}
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |