Server Hibernation

Discussion in 'Archived: Plugin Requests' started by hikeno19, Feb 18, 2013.

  1. Offline

    hikeno19

    Plugin category: Admin/Fix

    Suggested name: Server Hibernation

    What I want: If server is inactive for X amount of time, it will go to "Sleep" or "Inactive" till someone joins which makes the server to "Wake up".

    Ideas for commands: Might be a good idea for like a config reload plugin. Like /sh reload or /serhib reload.

    Ideas for permissions: Serhib.reload

    When I'd like it by: Don't really have a time limit, but if possible by next week.
     
  2. Offline

    Double0negative

    I'll make this, was actually thinking about making something like this.
     
  3. Offline

    ohtwo

    what exactly is the point of this?
     
  4. Offline

    Mitch_

    If its home run, it will stop using all your ram and CPU. And it will stop the console getting clogged up with all the things that run every 5 mins :)
     
  5. Offline

    ohtwo

    Somehow I think it's unrealistic. I'm not sure how Bukkit (or Minecraft server) works in depth, but I doubt a plugin can better manage what it does when there aren't users online.
     
  6. Offline

    Mitch_

    It could, prob hard coding tho, its possible via multicraft
     
  7. Offline

    Double0negative

    ohtwo Mitch_

    It is very possible to stop the cpu usage, Ram usage, not so much.

    hikeno19

    http://mc-sg.org/plugins/ServerHibernate/releases/ServerHibernate.jar

    Just note that when no one is online, it's going to respond badly to pings, and it might take just a bit for the first person to login. It probably wont even be noticeable however. with my test the server ran at 0% cpu usage with no one online.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  8. Offline

    Hoolean Retired Staff

    May I ask how you achieved this ;D
     
  9. Offline

    Double0negative

    Code:
    package org.mcsg.double0negative.serverhibernate;
    
    import org.bukkit.Bukkit;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class ServerHibernate extends JavaPlugin implements Listener{
        
        
        public void onEnable(){
            
            Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
                public void run(){
                    if(Bukkit.getOnlinePlayers().length == 0) { try{Thread.sleep(1000);}catch(Exception e){} }
                }
            }, 200, 1);
            
            
            
            
        }
        
    }
    
    ;)
     
    MrBluebear3 likes this.

Share This Page