Thread: z525 autosaving

Results 1 to 2 of 2
  1. #1 z525 autosaving 
    Registered Member
    Join Date
    Nov 2007
    Posts
    107
    Thanks given
    7
    Thanks received
    1
    Rep Power
    3
    Can anyone help me add Auto saving since i cant find no wher
    Reply With Quote  
     

  2. #2  
    Banned
    Join Date
    Feb 2009
    Age
    30
    Posts
    214
    Thanks given
    5
    Thanks received
    1
    Rep Power
    0
    Make a file called PlayerSave.java and put this in it

    Code:
    /*
     * Class PlayerSave
     *
     * Version 1.0
     *
     * Friday, August 22, 2008
     *
     * Created by Palidino76
     */
    
    package blank.z525.base.model;
    
    import blank.z525.base.Engine;
    
    public class PlayerSave implements Runnable {
        /**
         * Class thread.
         */
        private Thread saveThread;
        /**
         * True to run the charater saver.
         */
        private boolean saveRunning = true;
    
        /**
         * Constructs a new PlayerSave class.
         */
        public PlayerSave() {
            saveThread = new Thread(this);
            saveThread.start();
        }
    
        /**
         * Save character files every 10 seconds or so.
         */
        public void run() {
            while (saveRunning) {
                for (Player p : Engine.players) {
                    if (p == null) {
                        continue;
                    }
                    try {
                        if (p == null || !p.online) {
                            continue;
                        }
                        Engine.fileManager.saveCharacter(p);
    		    Engine.fileManager.saveFList(p);
                    } catch (Exception e) {
                    }
                }
                try {
                    Thread.sleep(10000);
                } catch (Exception e) {
                }
            }
        }
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •