[ADMIN] MCSignOnDoor 1.9 - So Your Server Can Say "Gone Fishin' Back in Five!"

Discussion in 'Bukkit Tools' started by tustin2121, Mar 16, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    cricrithezar

    How can I make this work with bungeecord ? i doesn't send me an error when it should exit sentry mode just a message saying 127.0.0.1 tried to cennect (which is normal, bungeecord is on the same machine), then it shows a black line with the time and doesn't exit as it should. It has worked before bungeecord and I think it would be amazing to have many different servers that players can just "turn on" without having to have ennormous amounts of power. that way, if some of my players want to have a hunger games they can just turn on that part of the multiserver that is made possible by bungeecord but without having to suffer from lag caused by ten or more servers on the same machine
     
    Spawnstah likes this.
  2. Offline

    Squawkers13

    http://dev.bukkit.org/server-mods/serversleeper/
    This is supposed to work with McSod.
    http://dev.bukkit.org/bukkit-mods/emptyserverstopper/
    This too.
    But how do I make it execute the sleep batch file only when the sleep-shutdown plugin quits it?

    EDIT: How do you make it so players with Minecraft version 1.5.2 (or any other) can hit "Join Server"?
    I ran it with -v "1.5.2" and the client treated it as a foreign MC version labeled 1.5.2!
    EDIT 2: Fixed this by changing the protocol in the manifest to 61. This should be fixed.

    EDIT 3: Looping two scripts (server and mcsod) seems to work.
     
  3. Offline

    andrewabosh

    Great tool :)
     
    tustin2121 likes this.
  4. Offline

    Brian_Entei

    Well, I've written a pretty neat little batch file script for my server(the script includes mcsod, of course), and seeing as how it is pretty useful(in my opinion, anyway), I'ma share it.

    Note that is uses two external files, called "wait.bat" and "choice.exe" as resources. I've attached choice43a.zip to this post, which should get you set up with choice.exe. :)

    You can get Choice43a.zip here.

    Bukkit disclaimer: Use the posted .exe file at your own risk. (It's a clean file, but I have to post this disclaimer)

    Main code:
    Show Spoiler
    Code:
    @echo off
    ::ONLY EDIT THE FOLLOWING SEVEN LINES, AND ONLY BETWEEN THE STARTING '=' AND THE ENDING '"' FOR EACH LINE
     
    :: === "VARNAME=VARVALUE" =============================== DESCRIPTION ====
     
    set "memoryMin=512" ::The minimum memory to allocate to your server(In MegaBytes).
    set "memoryMax=1024" ::The maximum memory to allocate to your server(In MegaBytes).
    set "serverName=YOUR SERVER'S NAME HERE" ::The name of your server.(This is only used for the cmd window title)
    set "port=25564" ::The port that you want McSod to lsiten on(usually the same port as your server)
    set "playerCount=0/20" ::The player count that McSod sends clients
    set "motd=§6YOUR SERVER'S MOTD HERE" ::The motd that McSod sends clients
    set "mcsodMsg=YOUR CUSTOMIZED MCSOD MESSAGE HERE" ::The message McSignOnDoor.jar sends clients
    set "titlePrefix=[Server Management]: " ::The Cmd Window prefix(The window that opens when using this script)
     
    ::======= WARNING WARNING WARNING =======
    ::
    ::DO NOT EDIT ANYTHING PAST HERE, UNLESS YOU KNOW WHAT YOU ARE DOING.
    ::
    ::======= WARNING WARNING WARNING =======
     
    set memoryMin="%memoryMin%"
    set memoryMin=%memoryMin:"=%
    set memoryMax="%memoryMax%"
    set memoryMax=%memoryMax:"=%
    set serverName="%serverName%"
    set serverName=%serverName:"=%
    set port="%port%"
    set port=%port:"=%
    set playerCount="%playerCount%"
    set playerCount=%playerCount:"=%
    set motd="%motd%"
    set motd=%motd:"=%
    set mcsodMsg="%mcsodMsg%"
    set mcsodMsg=%mcsodMsg:"=%
    set titlePrefix="%titlePrefix%"
    set titlePrefix=%titlePrefix:"=%
    set NLM=^
     
     
    set NL=^^^%NLM%%NLM%^%NLM%%NLM%
    title=%titlePrefix%Choose an option...
    cls
    choice.exe /c:NY1 /b /n /t:Y,10 "Would you like to start the server now? Y=Start Server; N=Standby. Auto-starting in 10 seconds!"
    if errorlevel 3 (goto BOTTOM)
    if not errorlevel 3 if errorlevel 2 (goto strt) else (echo Server start aborted; standing by.%NL%)
    if not errorlevel 3 (goto STANDBY)
    goto BOTTOM
     
    :strt
    echo Starting Server...
    title=%titlePrefix%%serverName%
    start "%titlePrefix%%serverName%" /B /WAIT "java" -Xms%memoryMin% -Xmx%memory
    max% -jar "craftbukkit.jar"
    ::start "cmdWindowTitle" /B /WAIT notepad.exe
    title=%titlePrefix%Choose an option...
    choice.exe /c:SR1 /b /n /t:R,05 "Restarting server in 5 seconds - Press R to restart Now, or S to Standby."
    if not errorlevel 3 if errorlevel 2 (goto strt) else echo Restart aborted; standing by.
    goto STANDBY
     
    :STANDBY
    title=%titlePrefix%McSignOnDoor.jar
    echo Type Ctrl + C to stop MCSignOnDoor, then press n and enter to continue to DOS.
    java -jar MCSignOnDoor.jar --message "%mcsodMsg%" --motd "%motd%" --players "%playerCount%" --port "%port%"
    title=%titlePrefix%Choose an option...
    choice.exe /c:NY1 /b /n "Press Y to start the server when you are ready, N to exit."
    if errorlevel 3 (echo Error level 3)
    if not errorlevel 3 if errorlevel 2 (goto strt)
    if not errorlevel 3 if not errorlevel 2 (goto BOTTOM)
     
    :BOTTOM
    title=%titlePrefix%Shutting down...
    echo This window will close automatically in 10 seconds.
    wait.bat 10 /silent
    exit


    And now the wait.bat code:
    Show Spoiler
    Code:batch
    1. @echo off
    2. set waittime=%1
    3. set input=%2
    4. set input=%input:"=%
    5. set word=seconds
    6. set "msg=Press any key to return to msdos..."
    7. set msg=%msg:"=%
    8. IF "%1"=="" goto SYNTAX
    9. IF "%1"=="1" (set word=second)
    10. IF "%1"=="01" (set word=second)
    11. IF NOT "%2"=="/silent" if "%2"=="" (echo Waiting %waittime% %word%.) else (echo %input%)
    12. choice.exe /c:NY1 /b /n /t:Y,%waittime% >NUL
    13. goto BOTTOM
    14. :SYNTAX
    15. echo Usage: "wait N" OR "wait N /silent"
    16. echo Where 'N' is the number of seconds to wait. The number
    17. echo must be greater than or equal to 0.
    18. echo Example: "wait 900" would wait 900 seconds and say so,
    19. echo whilst "wait 10 /silent" would wait 10 seconds and echo nothing.
    20. echo.
    21. echo %msg%
    22. PAUSE >nul
    23. :BOTTOM
    24.  
     

    Attached Files:

  5. Offline

    tyzoid

  6. Offline

    Brian_Entei

    Really? How so? It just doesn't load, or what?(I run the server that it's on, so I need to know what the webpage is telling you when you click on it, so that I may fix it)

    Edit: Well, every time I check, the file is accessible, so either you're using Firefox and it's auto-correcting the link and adding "https://"(which will NOT work with my simple server), or you just can't open the link for some odd reason.
     
  7. Offline

    ryansw_com

    I have just created a program like this! MCSSI (MineCraft Server Stand-In) or Minecraft "Server Down" Message. I hope you will not mind my development. Mine supports color, underline, italics, and obfuscation and has a GUI system for users who aren't fond of consoles. If you would like me to stop development, I am understanding. Thank you!
    Server Down Message
     
    tustin2121 likes this.
  8. Offline

    Squawkers13

    What's the protocol for 1.6.1?
     
  9. Offline

    secretofdreams

  10. Offline

    secretofdreams

    1.6.2 Protocol Version 74
     
  11. Offline

    Brian_Entei

    tustin2121

    With or without my startup script, mcsod doesn't recognize your --act-as-version arg. Is it not implemented yet?

    Here's what McSod tells me when I start it up:

    Command line:
    Show Spoiler
    echo Type Ctrl + C to stop MCSignOnDoor, then press n and enter to continue to DOS.
    java -jar MCSignOnDoor.jar --act-as-version 74 --message "&6The server is down for maintenance. E-mail me at &[email protected]&6 for more info." --motd "Brian_Entei's SkyBlock Survival" --players "0/4"


    McSod output:
    Show Spoiler
    Would you like to start the server now? Y=Start Server; N=Standby. Auto-starting in 10 seconds!N
    Server start aborted; standing by.

    Type Ctrl + C to stop MCSignOnDoor, then press n and enter to continue to DOS.
    Unknown command line switch "--act-as-version". Continuing...
    Unknown command line switch "74". Continuing...
    2013-07-18 12:36:55 McSod [INFO]: MCSignOnDoor Client Notifier v1.9 by Tustin2121
    2013-07-18 12:36:55 McSod [INFO]: Starting server on port 25565 with message "º6The server is down for maintenance.\nE-mail me at º[email protected]
    mail.comº6 for more info."
    2013-07-18 12:36:55 McSod [INFO]: Server set to respond to pings with motd "Brian_Entei's SkyBlock Survival" and player ratio 0/4
    2013-07-18 12:36:55 McSod [INFO]: Server protocol set to latest (60).
    2013-07-18 12:36:55 McSod [WARNING]: Message length exceeds 80 characters. You may add newlines by using the sequence "\n" in a message.


    Also, here's what my server listing looks like in the Minecraft client with McSod running:
    Show Spoiler

    [​IMG]

    EDIT: I was using Minecraft 1.5.2 to take the screenshot, but I am also trying to get McSod to work with 1.6.2, but it won't...
     
  12. Offline

    MaliciousMan

    Is there any way this code could be ported into a form usable by a web host? My reason is that my entire server is OFF and this is the closest anyone's gotten to what I was looking for xD

    Just a reply would be fantastic as I know this is 2 years old.
     
  13. Offline

    tyzoid

    No, unfortunately. This is designed for a server, not a host. Your average web host wouldn't allow you to use any port other than 80.
     
  14. Offline

    totokaka

    Great tool!
    I've recently been playing around with Minecraft and SRV records, and this can be used to automatically show the "server is off" message when the server is not responding!

    For those of you that don't know what an SRV record is, it's a DNS record that has port and hostname combination for servers. It was originally added to minecraft so it should be possible to run multiple servers on the same machine, with different ports, but "clean" addresses without ports.

    However SRV records may also be used for server-balancing and backup. Before you do what I describe here, you should follow this guide, I konw it's no-ip specific but it should be similar for other hosts.

    To use McSoD as a backup message for offline servers you have to always have McSoD running, preferrably on a physical server from the minecraft server. I would suggest starting McSoD like this:
    Code:
    java -jar McSoD.jar --port    25500 \
                        --adress  0.0.0.0 \
                        --message "Hmm, Server is off!" \
                        --motd    "This server is off" \
                        --players "0/1" \
                        -v        "Offline"
    then you add an SRV record for your main server as described in the guide, but change priority to 1. and then add a new one, with priority 2, and port 25500.

    I was only able to test this on a high-ping server myself, so the offline server kicked in sometimes when it shouldn't, but on servers with better networks this should not happen.
     
  15. Offline

    Squawkers13

    Does this work with 1.7?
    (new Netty prtocol)
     
  16. Offline

    tustin2121

    Well, technically, since the addition of the protocol version into the mix, as long as McSod calls out the protocol that it is using, it should in theory continue to work.

    That being said, it looks like there's quite a few things they added with login protocol version 4 (4 already? What happened to 3??). This includes things like a favicon and outright spelling out what the various parameters are in JSON. so, there's a few things here to take advantage of.

    THAT being said, I haven't even downloaded the horse version of minecraft yet, let alone played it and done stuff with it. And that will be difficult to do with crunch time at work. So don't expect something immedeately.
     
  17. Offline

    tyzoid

  18. Offline

    tustin2121

    Oh, God, the backlog of messages that bukkit NEVER SENT, or that they sent and ended up in the spam folder. STUPID SYSTEM.

    If this works for you, do it! If I do development, I will tell people if I add something to detect. And, actually, from the looks of the status protocol, everything is done in JSON now, so I could easily add a custom "isMcSod" key to the JSON without adverse effects to the normal workings of things. However, seeing as someone seems to be making a competing program... ;) Maybe we could standardize on something, like "standin" or "signondoor" or "sign" or something. And speaking of...


    WHY WOULD I WANT YOU TO STOP?! I'm all about the free market! Plus, you know, you're actually doing active development, while people are complaining of my lack of ability to update the stupid manifest file with each tiny patch to minecraft.

    I'd only be annoyed if you stole my code to branch off, but seeing as it looks like you didn't even know this existed when you started, by all means continue! :D When I started, I had to test and probe minecraft to see what it did when it connected. Now there's a freaking website dedicated to the protocol. I fully expect others to jump on.

    But, I, in being one of the first (if not the first, I honestly don't know), am sensitive to having a way to distinguish the "Sign on Door" message program from a normal server without having to try logging in. See the aforementioned mention of a "sign" or "standin" field in the JSON.

    Now excuse me while I kick gmail in the head.
     
    tyzoid likes this.
  19. Offline

    xTrollxDudex

    tustin2121
    You know this is completely possible with a bukkit plugin right? In fact, I'll just show code ;) wrote it up on the spot.
    PHP:
    package com.gmail.woodyc40.downtime

    import org
    .bukkit.plugin.java.JavaPlugin;
    import org.bukkit.command.*;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerLoginEvent;

    public class 
    Downtime extends JavaPlugin {
        
        private 
    String message "";
        
        public 
    void onEnable() {
            
    message "Gone fishing, back in five!";
            
    getServer().getPluginManager().registerEvents(thisthis);
        }

        public 
    boolean onCommand(CommandSender senderCommand cmdString labelString[] args) {
            if(
    cmd.getName().equalsIgnoreCase("downtime") && sender instanceof ConsoleSender && args.length >= 1) {
                
    StringBuilder sb = new StringBuilder();
                for(
    int in 1in <= args.lengthin++) {
                    
    sb.append(args[in]).append(" ");
                }
                
    message sb.toString();

                return 
    true;
            }
            return 
    false;
        }

        @
    EventHandler
        
    public void onPlayerLogin(PlayerLoginEvent e) {
            
    e.getPlayer().kickPlayer(message);
        }
    }
    Written on an iPad like a baws ;)
     
  20. Offline

    tyzoid

    xTrollxDudex
    But it doesn't work on new versions of minecraft. MCSod emulates new protocols to alert users that the server is down.
     
  21. Offline

    xTrollxDudex

    tyzoid
    I'm not sure how that is possible using Bukkit code?
     
  22. Offline

    tyzoid

    tustin2121 likes this.
  23. Offline

    xTrollxDudex

    tyzoid
    Okay, I'm not following :p

    This is pretty much update proof:
    And tustins's MCSignOnDoor?
     
  24. Offline

    tyzoid

    xTrollxDudex
    In the OP under FAQ:
     
    tustin2121 likes this.
  25. Offline

    tustin2121

    You do realize, Mr. Troll Dude, that the purpose of this program is to allow you to NOT have to start bukkit? The purpose of this program is to make it so people can shut down their servers, free up resources, perhaps edit the world behind the scenes, do backups, or some other operation that may go awry if the world files are in a state of constantly and sporadically being written to. The purpose of this program is to be lightweight. Bukkit, and in fact Minecraft in general, is NOT lightweight. It is a behemoth that usually takes up several gigs of memory, disallowing easy use of background programs.

    Therefore, your effort to transfer the program into bukkit (and presumably prove some kind of point as well) is wasted. But hey, you didn't have to come to me. Go make your little thing there into an actual bukkit plugin and see how much attention it garners. Start maintaining it, and providing a service to the Minecraft community with your little plugin.

    Unless of course, as I suspect, you're simply trying to live up to your name, Mr. Troll.
     
  26. Offline

    xTrollxDudex

    tustin2121
    Actually, I can just run that using like 15MB.

    Provided that you CANNOT use this at the same time as your server provides a limitation that you can't edit your regions and have a sign on your door. That's where a plugin becomes advantageous.

    In fact, using McSignOnDoor could potentially an extra load on the TCP socket used by the server. Otherwise, if you're not editing something on the server at the same time, the run a 15MB bukkit server at lowest priority for the system.

    Both achieve equally the same thing is my point, each however has its limits and strengths over the other.
     
  27. Offline

    tustin2121

    Hey, like I said, if you wish to package, distribute, and maintain your plugin idea for this, be my guest. I'm not stopping you. I'm not switching this to a plugin, it is it's own program and it is advantageous in many ways for it to be its own program.

    Regardless to your initial intentions, some people might thank you shortly for pulling me back this way. Though, I don't know how much time I can devote to this project what with stuff going full crunch time at the place where I'm actually paid to code. I've decided to overhaul McSod's code for its 2.0 release (because a major version change is a perfect excuse to do so), using fun new things I learned recently to make the code easier to look at if not also easier to update, to say the least. Plus, JSON config and support for handshake protocol 4 (and possibly those between 1 and 4 also, if I can). Submit your requests now.
     
  28. Offline

    xTrollxDudex

    Alright. Thanks for your understanding in the end if not your original intentions with your first reply :)
     
  29. Offline

    Morthion



    I really appreciate your hard work on this. I've been using it on my 1.6.2 server and had the serversleeper plugin turn off the server when it wasn't being used and it looped to the McSod so that whenever anyone wanted to join they could start it up themselves. We are starting a 1.7.4 server now and when I use McSod in your genius sentry mode it just hangs on "Logging in..." I'm 100% sure this is due to the new login protocol you mentioned above. The 2.0 release sounds really promising. Thanks for your hard work!
     
  30. Offline

    Laloeka#

    Hi, just wondering.. are you still working on this?
    I'd love to be able to put my server on standby :D
     
Thread Status:
Not open for further replies.

Share This Page