Filled "save-all" when server empty

Discussion in 'Archived: Plugin Requests' started by MrAndu, Feb 5, 2014.

  1. Offline

    MrAndu

    Plugin category: Admin Tools
    Suggested name: SaveOnEmpty
    Ideas for commands: /soe timeout <time> - change timeout (seconds) in config
    Ideas for permissions: soe.timeout.change

    Could not find a plugin that would meet the simple requirements:

    Need to "save-all" when server is empty after a small timeout.

    I have enough RAM to keep server running for 24H straigh but saving the world inbetween restarts creates so much lag that it kicks everyone off, so I want to save while nobody is on (happens a few times a day) - small server.
    The timeout is there because sometimes people might reconnect while playing alone and there is no point to have so many "save-all's.

    Here's how it should work (I know programming but not in java):

    trigger if someone quits:
    Check if server is empty
    If it is, start a timeout (configureable or 1 minute)
    If server is not empty, do nothing (sleep)
    If someone joins while timeout is counting: cancel timeout and do nothing (sleep)
    If noone joins while timeout is counting and timeout reaches end: do "save-all"

    or a more code like for developers:
    Code:
    if (player.action = quit) {
        if (!server.empty) go.back.to.sleep();
        time = time.from.config;
        while (!player.action.join) {
            sleep.for.whatever.time.interval();
            time--;
            if (time=0) { do.command(save-all); go.back.to.sleep(); }
        }
        go.back.to.sleep();
    }
    or if it has already been done by any plugin for bukkit 1.7.2+, let me know ( I could not find any myself)

    Thanks.
     
  2. Offline

    Necrodoom

    Removed adf.ly link post.
    Reread rules before posting.
     
  3. Just wrote a simple plugin for you, nothing special, not even config at the moment.
    But see if you like it and maybe I can at some configuration later :)

    It checks if a users logs out, waits 10 seconds, checks if the server is empty and saves.

    https://www.dropbox.com/s/org808z0tlckung/SaveOnEmpty.jar
     
  4. Offline

    MrAndu

    Nice, thanks, but it doesn't work, "missing plugin.yml"

    I would very much like it to be configurable, or the default timeout to be atleast 1 minute.

    also, took the liberty to decompile it and take a peek since this was your first post and I'm a bit cautios.
    I can read and debug almost any code no problem but I have no experience with java code.
     
  5. Oeps, forget to export the plugin.yml with it :)
    It's done now, made it 1 minute, but I will add some configuration.

    Edit: Updated, now has configuration where you can set the timout in seconds.
    Edit2: You can get the plugin on Bukkit to now: http://dev.bukkit.org/bukkit-plugins/saveonempty/
     
    MrAndu likes this.
  6. Offline

    MrAndu

    ahh, great!

    edit: needs a little tweaking,
    1) It prevents any console output while it waits (should not do that)
    2) It does not let me log back in while it waits

    priority too high?

    should we contiune discussion on the bukkit plugin page?

    EDIT:

    I've considered this as filled, further improvements and discussion on the plugin page:
    http://dev.bukkit.org/bukkit-plugins/saveonempty/
     

Share This Page