[Release] AutoSave function
PHP Code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package net.sf.odinms.server;
import net.sf.odinms.client.MapleCharacter;
import net.sf.odinms.net.channel.ChannelServer;
/**
*
* @author <deleted>
*/
public class AutoSave {
private static AutoSave instance;
public AutoSave() {
super();
}
public static void main(String[] args) {
if (instance == null) return;
instance.run();
}
public static void run() {
for (int i = 0; i < ChannelServer.getAllInstances().size(); i++) {
for (MapleCharacter character : ChannelServer.getInstance(i).getPlayerStorage().getAllCharacters()) {
if (character == null) continue;
try {
character.saveToDB(true);
character.dropMessage("You have been auto-saved");
} catch (Exception e) {
character.dropMessage("You haven't been auto-saved because of an error");
}
}
}
}
public static void createInstance(AutoSave inst) {
instance = inst;
}
public static AutoSave getInstance() {
return instance;
}
}
put this in the run() of channelserver
AutoSave.createInstance(new AutoSave());
To run from a bat file use
Code:
@echo off
color 4b
set CLASSPATH=.;dist\odinms.jar
java net.sf.odinms.server.AutoSave
pause
after you saved all of your characters without being online, you can restart your server without rollback
Enjoy (This is my first release D: so no flames)
This is untested, but should work
PS:
you can put this in your autorestarter, so it saves right before it shuts down
Re: [Release] AutoSave function
Re: [Release] AutoSave function
Re: [Release] AutoSave function
well this isn't autosave, just saving all characters w.e being online.
Re: [Release] AutoSave function
lol i know
nice try
i remember when titanms was alive
the PRO's had the auto save function
lol so all the other servers rolled back =/
Re: [Release] AutoSave function
Can you set auto save time?
Re: [Release] AutoSave function
Nice Release. - But in Valhalla, it saves to the database every time a person levels up.
Re: [Release] AutoSave function
nice release..i think this means that..if you dun wan to go into game and ask ppl to type @save or you type !saveall..you can just run that bat..and just close those world, login and channel without any rollbacks for players..
Re: [Release] AutoSave function
Not hard.
Why are you in these forums?
Re: [Release] AutoSave function
!shutdown will do, why made another shyt?
Re: [Release] AutoSave function
i remember a fag add the saveToDB at levelUp function, his name start with m something..
btw, with this release, we can run the bat before restarting the server without save all database in game.
Re: [Release] AutoSave function
Re: [Release] AutoSave function
Yea. Nice release. Finally something usefull.
@MSDartz Fuck off
Re: [Release] AutoSave function
Not useful. Most sources have an autosave at a certain point.
Re: [Release] AutoSave function
So? Doesent matter. At least hes contributing.