[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


    MCSignOnDoor Client Notifier v1.9 (or McSod)
    By Tustin2121

    Download Latest: MCSignOnDoor.jar

    Older Versions (open)

    1.9 for up to Protocol 60 and beyond* (MC version 1.5.1)
    1.8 for up to Protocol 49 (MC version 1.4.4)
    1.7.1 for up to Protocol 39 (MC version 1.3.1)
    1.7 for up to Protocol 39 (MC version 1.3.1)

    Versions Previous to the Protocol Update (will not function for Minecraft Release 1.3.1 and up):
    1.6.1, 1.6, 1.5, 1.4, 1.3, 1.2

    *Since McSod Version 1.9, McSod assumes that new versions of minecraft will use the same protocol methods as the previous versions. Updates to a particular protocol number will simply update what it thinks is the "current" protocol number. Should the actual protocol methods change, McSod will still need to update to handle the new methods.

    Have you ever had to take your server down for maintenance and had people connecting and wondering when it was going to go back up? Or perhaps the server is moving to another IP and people will still be connecting to the old IP address! Or perhaps your players are just being exceptionally ungrateful today!

    MCSignOnDoor is here to help. The Sign On Door program emulates an active server on the ip and port your minecraft server is usually on. Any connections destined for your out-of-commission minecraft server will be caught by this program. It will emulate the connection behavior of a minecraft server and immediately turn the client away, sending the client a custom message and notifying the player of the status of the server! Now they don't have to wonder if the server is down!

    The program is very lightweight, so you can stop the server to use MCEdit or backup the world while this program provides to your many fans the reason the server is down!

    ARasputin has created a quite excellent wizard batch file for those Windows users who don't want to fiddle with the batch file every time you wish to change McSod's message. It will ask you the switches and message when you run it!

    MINECRAFT Sign On Door
    Version 1.8
    by Tustin2121
    This program tells players attempting to connect to a minecraft server on this
    machine a message (defaulting to a 'server is off' message). This program
    cannot and is not meant to run while the minecraft server itself is running;
    it is meant to give a message to players as to why the server is not running.
    Usage: java -jar MCSignOnDoor.jar [switches]
    Command line switches:
            -? --help
                        Displays this message and quits
            -p --port [port]
                        Sets the port the messenger runs on (default: 25565)
            -i --address [ip]
                        Sets the ip address the messenger runs on (default: null)
            -m --message [message]
                        Sets the message to send to connecting players (250 char max)
                        (default: The server is not currently running.)
            -w --white-message [message]
                        Sets the message for whitelisted players. Default: does not
                        differentiate between normal and whitelisted players.[1]
            -b --black-message --banned-message [message]
                        Sets the message for blacklisted players. Default: does not
                        differentiate between normal and blacklisted players.[1]
              --ipmessage [message]
                        Sets the message for ip-banned players. Default: does not
                        differentiate between normal and ip-banned players.[1][2]
              --motd [message]
                        Sets the server list message of the day. Default: the message
                        setting, truncated. (<=60 char max)
                        Sets McSod to ignore incoming pings; Server appears offline.
                        Sets McSod to ignore incoming pings from banned IPs.
              --players [ratio]
                        Sets the player ratio given in pings (in form "1/10")[3]
            -v --reported-version [versionstring]
                    Sets the version reported over motd. Default: Offline
            -# --show-version
                    Forces the client to show the reported version string in red.
              --act-as-protocol [version]
                        Sets which protocol version to act as. Defaults to latest.
                        (Warning: advanced functionality - you don't need this)
            -l --log [file]
                        Supplies a log file to write to (default: does not use log file)
            -s --silent
                        Does not print output to the screen
                        When someone not banned tries to connect to the server, McSod
                        will exit immediately with the return value 12. Useful in
                        conjunction with a looping script.
            -c --config [file]
                        Tells McSod to read the configuration file specified. All command
                        line switches after this one will be ignored.
              --outputconfig [filename]
                        Outputs a template config file to the specified filename. This file
                        can be edited and used with the --config command line switch.
    [1] When using special case messages (white and banned list messages), McSod
        will attempt to load the appropriate files that the Minecraft server uses
        to store these lists.
    [2] If a blacklist message is set, it is also applied to ip-banned players,
        unless the ip-banned players message is separately set.
    [3] When setting the player ratio to show, non-numbers and a ratio with 0 max
        players will display as "???" on the client. Player ratio also cuts into
        the max length of the motd setting.
    [*] Some command lines treat the bang (!) as a special command character.
        If you would like to use a bang in your server message, be sure to escape
        it with a backslash (\).
    [*] Messages can also contain color codes by using an ampersand (&) followed
        by a hexadecimal value (0-9 a-f). See the MC wiki's Classic Server
        Protocol page.
    Usage examples:
    java -jar MCSignOnDoor
    java -jar MCSignOnDoor -c mcsod.cfg
    java -jar MCSignOnDoor -m "The server is down for maintenance."
    java -jar MCSignOnDoor -m "OH! You woke me up!\nGive me a minute to
    wake back up and reconnect!" --sentrymode
    java -jar MCSignOnDoor -ip -m "Still waiting for bukkit to
    java -jar MCSignOnDoor -p 54321 --message "The &eMinecraftWB &fserver has
    moved to\!" --motd "Moved to"
    java -jar MCSignOnDoor -l logfile.log -s -m "Slim's server is currently
    being removed of excessive genitalia." --motd "Removing d*cks"
    --players "6/9"
    Example! (open)

    I started the MCSignOnDoor program like so:
    java -jar MCSignOnDoor.jar --message "Gone Fishin' Back in Five Minutes!"
    Now, when anyone tries to connect to my server, they get this screen:


    It's that easy! Plus the program keeps track of who tried to connect (IP and username) in the logs! (just a coincidence of the protocol :) )

    Third Party Use! (open)

    Many providers of server management tools have already incorporated MCSignOnDoor into their programs! If you are using any of the following programs (listed in no particular order), you already have McSod to use on your server!
    Is your product using or want to use McSod? Just give me credit somewhere (at the very least, show the start-up text, which has my handle in it) and you can use it however is best! Post on this thread or PM me and I'll add you to this list! :)

    FAQ (open)

    I can't get this plugin to work with Bukkit! What do I need to do?
    Please note that this is not a Bukkit plugin! McSod is a standalone java program. You start McSod in the same manner you start Craftbukkit, and Craftbukkit cannot run at the same time McSod is running. See the above example for how to start McSod.

    Ok, well, is there an easier way to start McSod than using the command line all the time?
    Yes, you can use a batch file or shell script, just like you can do with Craftbukkit:

    Batch (Windows) (Copy-Paste into a .bat file):
    [USER=90771833]Echo[/USER] OFF
    java.exe -jar MCSignOnDoor.jar -m "[Message Here]"
    Shell script (Mac / Linux) (Copy-Paste into a .sh file):
    #! /bin/sh
    java -jar MCSignOnDoor.jar -m "[Message Here]"
    Or, ARasputin has created a quite excellent wizard batch file for those Windows users who don't want to fiddle with the batch file every time you wish to change McSod's message. It will ask you the switches and message when you run it!

    McSod servers suddenly started showing up as "Server Out Of Date" in the server list with this latest update when I don't want them to!
    This is an unfortunate side effect of the modern "protocol version" system Minecraft is now using. But fear not, it's simple to fix and you don't even have to update McSod anymore if this happens (usually)! That is, if you know what you're doing. For those of you who don't know what a jar file's manifest is, its probably best if you wait for a new version (or leave a little note in the thread or something).

    For those who do know or are curious enough to find out: in McSod's manifest file there's a key called Specification-Version. McSod, on startup, grabs this number and uses it as the "current minecraft protocol version". Just go find out what the current version is here and update the number in the manifest. Now everything should work fine again!

    Or, you can just start using the -# switch to always force a wrong protocol version report, which has the side effect of showing the neat string you put in the "version number" (default: "Offline")! Isn't this what we wanted way back when I first made McSod work in the server list anyway? A way to display to the user "It's Offline!". :)

    How do you stop this thing?![
    Use Control + C or kill it another way. McSod is designed to be killed violently (or, for the more computationally inclined, via signals) and does not provide a way to stop itself.

    How do I make McSod shut down my server?
    Alas, seeing as McSod is not a plugin, it cannot do that. You will have to find an actual plugin do to that. Something like Vincs's EmptyServerStopper or my own ServerSleeper. Shop around and see if there are any others to your liking. (PICK MINE!) :)

    My question is not listed here!
    Feel free to leave a comment in the thread below! I get an email when new posts appear, so I'll get notified that you left a comment fairly quickly (assuming I'm not out of WiFi range for a weekend or something). :)

    Changelog (open)

    Version 1.9:
    - Changed the way protocols are handled, so now with a new protocol version, McSod will just assume everything works from the previous protocol version.
    - The current protocol version will still need to be updated for the server to not show as out of date or "offline" to a prospective client's server listing.
    - Fixed a bug with logging exceptions not printing the stack trace
    - Made the project harder to debug in eclipse, but at the same time made it so I won't have to actually use eclipse as much.

    Version 1.8:
    - Added protocol checking and updated the version of the MOTD to conform to the new way to do it.
    - Added an option to change reported versions and to force the client to show said version (which makes it block against connecting).
    - Fixed a long standing bug where if a config file was used...
    - ...to specify an ip banned list, it would instead load it into the blacklist, thereby making banned ips not function.
    - ...to enable pings, it would instead disable pings, and vice-versa.
    - Changed how the config file works, using hierarchy-type keys.
    - ...other things I'm sure I forgot

    Version 1.7:
    - Fixed a bug when handling requests from Minecraft 1.3.1
    - Kept backwards compatability with Minecraft 1.3 and below (in theory).
    - Added "forward" compatability, for when the protocol version changes.
    - Added Sentry Mode, where McSod will close with exit code 12 (because... 12) upon someone (not banned) connects to the server. This is for scripts with a loop, so servers can start back up automatically.
    - Discovered that Minecraft 1.3.1 supports newlines on the "door", and so added support for messages with "\n" in them to translate to a newline.
    - Fixed a supposebly long-standing bug with default MOTD generation.
    - Removed versions 1.1 and 1.0 from the previous version list at the top of this post: Minecraft Beta is no longer really available and version Beta 1.5 was so long ago. Links to those versions will continue to work for the time being.

    Version 1.6.1: (Yay! My first double point release! Oh, wait, that's a bad thing... :/)
    - Fixed a bug where the logfile command-line switch would not take a windows path
    - Removed the undocumented and unnecessary ability to use forward-slash command-line switches.

    Version 1.6:
    - Added ability to read/use the whitelist and blacklist files a server keeps
    - Send different messages to clients on different lists​
    - Ignore ping requests from IP banned users​
    - Added config file
    - Use a config file with the --config command line switch​
    - Create a template config file with the --outputconfig command line switch​
    - Cleaned up code (now using packages + new class used internally)
    - Cleaned up help output
    - Cleaned up log output (slightly... okay, not much at all)

    Version 1.5:
    - Added support for Minecraft 1.8 Server List MOTD. By default, McSod will respond to server list pings with the same message used as the sign on the door (except truncated and with color codes stripped) and report the player ratio as an invalid number (minecraft will show "???"). Added command line switches for setting motd and player ratio, and for turning off server list support.

    Version 1.4:
    - Added support for minecraft color codes (see here) (Thanks to FrozenBrain and his MessageChanger plugin for giving me the idea... and stealing his code. ;) His plugin is a complement to this program in that you can change the default messages sent to the clients while the server is running! Go check it out!)

    Version 1.3:
    - Added a IP address switch, for instances where more than one IP address could be used on a server.
    - Now command line switches can be prefixed with slashes (like is usually used in Windows)
    - Minor code cleanup

    Version 1.2:
    - Fixed for the Minecraft 1.5 update
    - Added a function where a "\!" in the message is automatically replaced with a "!" (for command lines where a ! causes an error or is misinterpreted as another command)

    Version 1.1:
    - Added logfile switch, to allow saving to a file
    - Added silent switch, to turn off logging to the console
    - Fixed bug where it would print tons of IOExceptions when properly shutdown

    Version 1.0:
    - Initial Release

    (By request, source code as been uploaded to github. Source code is licensed under Creative Commons Attribution-Noncommercial-ShareAlike. Feel free to send me a pull request if you do something neat.)

    Feel free to suggest features or garner help below. :D
  2. Offline


    Amazing stuff! Great work :)
    Will definately use this on my server! ^^
  3. Offline


    This is bloody brilliant I'm using it on my server now. :D I wonder if it can fool stuff like minecraftserver.net the status plugin/sites things
  4. Offline


    Do you know how those status things work? If they just try to make a connection, then yes this will fool them. If... well, actually how else is there to check if the server is running than trying to make a connection? Yes I think this will fool them. That was totally unintentional (as I didn't even know such a thing existed). :p

    Also, thank you, to both of you. :D
  5. Offline


    Haha found out it does fool it and this helped me so much today :'( my server was down for 3 hours but my server status never went down bwahaha nice script dude. but no I don't know how they work :'(
  6. Offline


    Sources please? I need to add cyrillic letters support ...
  7. Offline


    What do you mean? Like, Cyrillic letters in the logs, or Cyrillic letters in what is sent to the clients? If the latter, does passing a message in Cyrillic not do what is expected of it?
  8. Offline


    This is really nice - Cake for you!
  9. Offline


    omg i used your tutorial to code a basic plugin then i tried to make a new one but it was outdated :(
  10. Offline


  11. Offline


    Yes thank you so much!
    I really suck at java but I actually made a decent plugin with ur tut.
  12. Offline

    City Builder

    Thanks very much. This is certainly very useful for when I want to take the server offline to do some updates to it but still want people to know what's going on. Very useful indeed.
  13. Offline


    I had to bring my server down for a bit today so that I could download the world, trim off some some long explored legs, and re-upload it, and this worked perfectly for announcing to my players what was going on. Thanks a lot!
  14. Offline


    Awesome utility, I see myself using this a lot in the future! :)

    Only problem I ran into, is that I get like several hundred lines like this when I try to stop McSod with Ctrl-C :
    2011-04-04 16:20 McSod [SEVERE]: IOException accepting client!
    Is there any other way I am supposed to exit McSod?
    I'm running it on Linux (Cent OS 5) and the output of "java -version" is:
    java version "1.6.0_17"
    OpenJDK Runtime Environment (IcedTea6 1.7.5) (rhel-1.16.b17.el5-i386)
    OpenJDK Client VM (build 14.0-b16, mixed mode)
  15. Offline


    Oh dear... that's not supposed to happen. No, there is no other way to stop McSod besides Ctrl+C-ing it, and I made it specifically to Ctrl+C to exit. Does this happen only sometimes, or all the time? If sometimes, can you reproduce it? If you can, give me step-by-step.

    Also, thank you all for the complements. :)

    Wait, I found the problem. Turns out the Ctrl+C ing thing doesn't quite work how I thought it worked. It's fixed right now. Let me implement the one other thing I was going to implement, and then I'll update to the next version. :)

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


    This is an amazing idea. This is finally a solution for those short periods when I take the server down to do a full backup, or mcedit some griefer's work away. You'd be surprised how short a time it can take players to respond to the server being down. I've literally had the server down for under a minute and had three people ask me what happened. It's ridiculous. Anyway I'll be using this heavily, so thank you again.
    tustin2121 likes this.
  17. Offline


    When I send message with cyrillic symbols, there is java error showing instead of the message.
    For example:
    java -jar "%~dp0MCSignOnDoor.jar" -p 25565 -m "На сервере работы"
    I need sources to encode all string's characters.
  18. Offline


    So I have looked into this and the exception above is caused by my simply converting from char to byte, which loses the information of the upper 8 bits (used in java for Unicode characters).

    However, I have played with this string you supplied, and from what I can gather, Minecraft simply doesn't support proper UTF-8 - or even Java's modified UTF-8. I've thrown 3 different solutions at this problem and not only do no cyrillic characters show up on the client, but it seems to break the display of Ascii characters. The solutions I've tried don't throw an exception like the one above, but rather the characters simply don't display, which makes me think that the game doesn't have these characters in the font. And then some roman characters seem to vanish, which likely means that the formatter in Minecraft doesn't work properly.

    I'm sorry to say, but Minecraft simply can't display these characters. So I see no need to support extra-Ascii characters until the client side can. :(
  19. Offline


    Of course Minecraft CAN display cyrillic characters, I know what I am talking about.
    I have modified client, so client-side support exists.[​IMG]
  20. Offline


    Then would you like to give me a recommended method of sending those characters as bytes that your mod will accept? I suppose I can add a command line switch to enable unicode if doing so will interfere with ascii.
  21. Offline


    Version 1.1 is up! Change log:
    - Added logfile switch, to allow saving to a file
    - Added silent switch, to turn off logging to the console
    - Fixed bug where it would print tons of IOExceptions when properly shutdown

    Unicode support is not present at this time. Given that Minecraft itself doesn't support unicode (see these tweets) that's not going to affect many.
  22. Offline


    I love you.
  23. Offline


    This is great. Thanks a lot.
  24. Offline


    It isnt working for me. When I try to connect to my server's IP, I smply get an "End of Stream" Message... I have the program in its own folder with the exact file from the "Example! spoiler. Please Help me!
  25. Offline


    I got the same problem... Using minecraft 1.5_02 and bukkit 689
  26. Offline


    I haven't yet tested things with the latest release of Minecraft (hell, I haven't even downloaded the latest release of Minecraft yet, I've been so busy). I will look into it later today. Technically, if nothing in the login process has changed, then it shouldn't be broken. But it could have changed. Anyone else getting any errors?

    Also, bukkit build doesn't matter, as this isn't a bukkit plugin. It is its own program. :)
  27. Offline


    So, do you know anything about my "End of Stream" error? I would love help, as the people on my server are not very patient for the new update...
  28. Offline


    End of Stream usually means that the server has cut off its TCP connection to the game client, which makes since as McSod simply replies can cuts off the connection. It's a type of Java exception. I still have to test to see why it's doing it, if it's perhaps the new update, and I cannot do that until later today when I have a working testbed and am not busy. This should be around 8pm UTC.

    Is there anything special that McSod is outputting when you get the End of Stream exception?

    Update: So it seems that Minecraft now has some support for Unicode. You can see this when, upon connecting, the reported client name has spaces between each letter. These are actually the Unicode upper bytes. I'm still looking into the End of Stream exception, but this added unicode support probably has something to do with it.

    Edit: In addition to this new Unicode support, notch has also condensed the protocol a bit. The reason for the "End of Stream" exception is because the disconnect packet was sent separate from the message packet, but now it's not. The point being that this might take a little longer than anticipated. (Oh yeah, and my mac still freezes upon closing Minecraft normally... >.< )

    FIXED! :D

    As a side note, Unicode support is sort of added. My Minecraft client does not display anything when given the string supplied by Instead above, but it does not cause an error on the client. This update to minecraft obviously added some base work for unicode, but it's not there yet.

    Also, I added a thing where you can escape an exclamation point (or "bang") in your message (ie, "Hello World\!") and McSod will parse out the slash so it will appear as "Hello World!" on the client. Before if you attempted to put a bang in your message, even a quoted message, the command line would misinterpret the command line to be something else entirely. Escaping it with a slash made this behavior go away, but would leave the slash in the message that gets sent to the client. Now it doesn't! :D

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


    Works here!
    I'm currently using McSod in my Minecraft server maintenance script, where the server is automatically shutdown after 10 seconds, and then a McSod is put up to inform users of the current downtime ;)
    Thanks for the update! :D
  30. Offline


    Thanks for the recent update! It works great! Check it out, mc.jakegirard.com
Thread Status:
Not open for further replies.

Share This Page