[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


    can you make this so when a player gets banned or kicked or when they try to connect when banned or non-whitelisted we can have a custom message?
  2. Offline


    Well, McSod isn't a server plugin, so it cannot affect the behavior of the server while it is running - this means kicking and banning messages.

    However, seeing as the banned list and the whitelist are text files separate from the server, it is entirely possible for McSod to read these files on startup and use them to alter its own behavior, especially since the connecting client does report its player name as it is attempting to connect. Please note, though, that McSod doesn't check the validity of the player name, so the player could report a different name (though it doesn't really matter, because the player can't get in anyway).

    I am intrigued by this premise. And, since the command line is getting kind of full with all these options now, I think I'm also going to add support for a properties file, so you can list off all the configuration stuff you want and just point McSod to the file. :)
  3. Offline


    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)

    I must say that I like this little spike in the click rate of the McSod download link right around the release of Minecraft 1.8. :p

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

    Don Redhorse

    also you can take a look at message changer..
  5. Offline


    This batch file will make it a little more user friendly.
    You can input your message before the actual sign goes up, it also asks for confirmation of the message to which you can reply with "Yes", "No" or "Cancel". After I wake up I am probably going to include options for command parameters etc. :)

    Yes (open)

    No (open)

    Cancel (open)


    @echo off
    SET /P MESSAGE=What would you like your message to be?
    echo Your message: %MESSAGE%
    SET /P ANSWER=Do you want to continue (Y/N/Cancel)?
    echo You chose: %ANSWER%
    if /i {%ANSWER%}=={y} (goto :yes)
    if /i {%ANSWER%}=={yes} (goto :yes)
    if /i {%ANSWER%}=={cancel} (goto :cancel)
    goto :no
    java -jar MCSignOnDoor.jar --message "%Message%"
    goto :main
    echo Cancelling...
    Updated the batch file, much more fleshed out and has a great many more options.

    Gone Fishin.bat (open)

    @echo off
    SET /P WELCOME=Welcome to MCSoD. (Start/Help/Cancel)
    echo Your choice: %WELCOME%
    if /i {%WELCOME%}=={start} (goto :switches)
    if /i {%WELCOME%}=={help} (goto :help)
    if /i {%WELCOME%}=={cancel} (goto :cancel)
    if /i {%WELCOME%}=={h} (goto :help)
    if /i {%WELCOME%}=={c} (goto :cancel)
    if /i {%WELCOME%}=={s} (goto :switches)
    goto :error
    echo Command not supported! Restarting...
    goto :main
    SET /P SWITCHES=What switches would you like to use?
    echo Your choice(s): %SWITCHES%
    SET /P SWITCHANSWER=Is this correct? (Yes/No/Cancel)
    if /i {%SWITCHANSWER%}=={y} (goto :message)
    if /i {%SWITCHANSWER%}=={yes} (goto :message)
    if /i {%SWITCHANSWER%}=={cancel} (goto :cancel)
    if /i {%SWITCHANSWER%}=={c} (goto :cancel)
    if /i {%SWITCHANSWER%}=={no} (goto :switches)
    if /i {%SWITCHANSWER%}=={n} (goto :switches)
    goto :error
    SET /P MESSAGE=What would you like your message to be?
    echo Your message will be: %MESSAGE%
    SET /P MESSAGEANSWER=Is this correct? (Yes/No/Cancel)
    if /i {%MESSAGEANSWER%}=={y} (goto :run)
    if /i {%MESSAGEANSWER%}=={yes} (goto :run)
    if /i {%MESSAGEANSWER%}=={cancel} (goto :cancel)
    if /i {%MESSAGEANSWER%}=={c} (goto :cancel)
    if /i {%MESSAGEANSWER%}=={no} (goto :message)
    if /i {%MESSAGEANSWER%}=={n} (goto :message)
    goto :error
    java -jar MCSignOnDoor.jar %SWITCHES% "%Message%"
    echo This program tells players attempting to connect to a minecraft server on this
    echo machine a message (defaulting to a 'server is off' message). This program
    echo cannot and is not meant to run while the minecraft server itself is running;
    echo it is meant to give a message to players as to why the server is not running.
    echo Command line switches:
    echo    -? --help
    echo            Displays this message and quits
    echo    -p --port [port]
    echo            Sets the port the messenger runs on (default: 25565)
    echo    -i --address [ip]
    echo            Sets the ip address the messenger runs on (default: null)
    echo    -m --message [message]
    echo            Sets the message to send to connecting players (250 char max)
    echo            (default: The server is not currently running.)
    echo    -w --white-message [message]
    echo            Sets the message for whitelisted players. Default: does not
    echo            differentiate between normal and whitelisted players.[1]
    echo    -b --black-message --banned-message [message]
    echo            Sets the message for blacklisted players. Default: does not
    echo            differentiate between normal and blacklisted players.[1]
    echo       --ipmessage [message]
    echo            Sets the message for ip-banned players. Default: does not
    echo            differentiate between normal and ip-banned players.[1][2]
    echo       --motd [message]
    echo               Sets the server list message of the day. Default: the message
    echo               setting, truncated. (<=60 char max)
    echo       --ignoreping
    echo            Sets McSod to ignore incoming pings; Server appears offline.
    echo       --ignorebannedping
    echo            Sets McSod to ignore incoming pings from banned IPs.
    echo       --players [ratio]
    echo            Sets the player ratio given in pings (in form "1/10")[3]
    echo    -l --log [file]
    echo            Supplies a log file to write to (default: does not use log file)
    echo    -s --silent
    echo            Does not print output to the screen
    echo    -c --config [file]
    echo            Tells McSod to read the configuration file specified. All command
    echo            line switches after this one will be ignored.
    echo       --outputconfig [filename]
    echo            Outputs a template config file to the specified filename. This file
    echo            can be edited and used with the --config command line switch.
    goto :main
    echo Cancelling...

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


    Excellent! *Goes updates OP* :D

    May I ask why you chose to copy from the OP when you probably could have more easily called McSod with the -? option and it would have given you the same thing (granted, with a few extra things top and bottom that might be a bit unnecessary)?
  7. Offline


    Honestly, I hadn't thought about that. Haha.
  8. Offline


    This is AWESOME!
    Can you make the ability to put a path name on the -l switch?

    java -jar /home/username/bin/MCSignOnDoor.jar \
    -l '/home/username/logs/ServerDown.log' \
    Unknown command line switch "-home-username-logs-ServerDown.log". Continuing...
    I tried with and without quoted.
  9. Offline


    Huh... that's.... odd...... Hang on let me check the code real fast.....

    Heh... heheh... heh... um... oops.... XP

    So, um... the log switch can, in fact, take a path. It can also be used without an argument; it checks to see if the next argument begins with a switch character (a dash). However, I did not take into account that a) paths in windows use the forward slash, b) McSod can take arguments in the forward slash form (it's an undocumented ability that I completely forgot about and, in retrospect, is stupid anyway). McSod can take arguments in slash form by converting them to dash form, indiscriminately. When the log switch checks the next argument to see if it is a command switch, it converts it to a dash form... taking windows paths with it.... I'm just going to have to get rid of slash form arguments - it's better that way anyway.

    tl;dr: It is an oops on my part and will be fixed momentarily. :rolleyes:

    Version 1.6.1: (Download) (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.

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


    I remember WAAYYY back in the DOS 2.x and 3.x days, there were some utils I used that the switches were all
    -switch and not /switch. It drove me NUTS that somebody dared to use some non-standard thing.
    That was before I was aware of any unix variants, and now it seems just as foreign to use /switch on the cli.
    And don't sweat the double point release, it adds character, just like gray hair does. :D

    Working just fine now!
    Thanks for a great piece of software AND great turnaround!!!

    tustin2121 likes this.
  11. Offline


    Awesome program!
    Can you make it somehow, (with an additional plugin or another way) that it can be launched from bukkit?
    so I can send by example following command: "/stop Bukkit is being updated", to show users a screen "bukkit is being updated".

    *Bertware is installing onto server with .bat file described above, and is surprised about how nice this program works*
  12. Offline


    Hm...... I'm going to take an educated guess and say no..... And here's my reasoning:

    Reasoning (open)

    McSod is a separate program. It must be run entirely separately from the server itself. I'm sure it's possible to build a plugin that will indeed capture that command and could do something with it, and then shutdown the server. But after that, how do you make the next program run?

    <Computer Geekiness>
    Ways to run the next program:
    1. An encapuslating program, which will detect when the first program (the server) stops and will start the next program (McSod). <--- This is what a batch/shell script does.
    2. Forking the program, meaning that one program splits into two and the first one stops while the second one continues. The problem with this though is that a) race conditions arise (McSod attempts to grab the same port that the server is still hanging onto...) and b) Java, last I checked, does not like to be forked.
    3. A service. No. Simply no. This would raise cross-platform issues, and admin.... Just no.
    </Computer Geekiness>

    Now, there are a few plugins that do that whole encapsulating program thing (mentioned above) and, if I'm not mistaken, there are at least two that have incorporated McSod into themselves (which I am happy about). You may want to look into one of those.

    That being said, it is entirely possible to create a plugin which will edit the config file that McSod uses when it starts (via, say, a batch/shell script). But, if I made it, it wouldn't be taking over the stop function, and it couldn't start McSod directly. It would have to start via an encapsulating script.
  13. Offline

    Matt Gill

    In your FAQ it says:
    "You start McSod in the same manner you start Craftbukkit, and Craftbukkit cannot run at the same time McSod is running."

    My IP just changed and my players don't know about it yet. I posted on my forums, but not everybody reads it frequently.

    I need to use this to show players the IP has changed, but it says I can't run craftbukkit and this at the same time. So I can only have it show them the new IP when I don't have my server running?
  14. Offline


    No, in this case you can run both, and this gets into more nitty gritty (hence the generalization in the FAQs).

    The FAQ answer should read "Craftbukkit cannot run on the same port as McSod". The reason for this is because a port can only be used by one application at a time. When craftbukkit starts up, it tries to grab port 25565 (by default) to accept incoming connections with. McSod, since it acts as a server, does the same thing. If Craftbukkit is running on port 25565, and McSod tries to start up on port 25565, it will throw an error because it cannot attach to that port. In this case, McSod CAN start on, say, port 23496 (as long as another program isn't hogging that one) and both McSod and Craftbukkit can run simultaneously. Nothing in the program itself is keeping McSod from running alongside Craftbukkit, it's just a limitation of the operating system and how computers work.

    I imagine running it on another IP is probably the same thing (I am still unable to comprehend how a machine can have two IPs, but that's another matter entirely). Chances are, also, that with separate IPs comes a whole separate set of ports, so both Craftbukkit and McSod could possibly run on the same port, on different IPs. Try it out and see. The worst that could happen is the program throwing an error and closing.

    tl;dr: Change the port and/or IP before running and you'll be able to.
  15. Offline

    Matt Gill

    Never mind I thought I could use this to put a "sign" up on my old IP directing players to my new one, but it runs on my machines current IP. I was confused about it, but I got it now.
  16. Offline


    How does --outputconfig work? can't seem to figure it out :/
  17. Offline


    Hello @tustin2121, Is there the possibility we can try and integrate this into SpaceBukkit? We'd love to make this awesome tool avaible for anybody!
  18. simple but very useful :)
  19. Offline


    Will this work with remotetoolkit ?
  20. Offline


    Im not sure how to install it? When i move it into the plugins folder it comes up with errors? Help!
  21. Offline

    Don Redhorse

    this isn't a plugin... you run it instead of the craftbukkit.jar when the server is down..
  22. Offline


    Still works great.
  23. Offline


    Very handy, thanks :)
  24. Offline


    Okay I am using the wizard. I need to run this on port 25566 and I need to display a message. How do i do this using the wizard .bat file?
  25. Offline


    You are an amazing genius. Thank you :D
  26. Offline


    This application is so nice, very well done!!!

    Could you add a feature that allows white listed players to be forwarded to another port on the same ip?
    So lets say I have your application running on port 25565 (stock server port) and I have a MC server running on port 25561 could the players that are in my whitelist be pushed forward and log them into the running MC server?
  27. Offline


    I don't believe that is even possible with server port technology as it is. If it is, then you might be referring to "port forwarding", maybe, which requires both the forwarding port and the forwarded port to deal with the incoming packets. And that would take up processing time of the SignOnDoor program. (Note: I'm working on limited knowledge of port forwarding, so I may be wrong.) Regardless, it's outside the scope of the program as intended.

    The most I can say is put a special message for whitelisted players that directs them to use that server port instead. After all, why would you want them hitting the wrong port all the time anyway? :)

    Wow, it seems my setting to "email me when a message is posted" has gone arwy or something... SORRY FOR THE ABSENCE EVERYONE!! :eek:

    Be my guest. Anyone may integrate McSod into their own plugins as long as credit is given. They may modify McSod as long as it follows the Creative Commons BY-NC-SA 3.0 (which includes attribution, using it non-commercially, and sharing it with the same license.

    See here for some discussion about RTK and the plugin made by sharkiller.

    EDIT: Ok, I must have been getting too many notifications from other threads and turned off the email. I have restored the email notifications and will now, again, service people's comments here. AGAIN SORRY EVERYONE! :oops:

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


    genius, thanks for this..

    really handy when my server goes down for maintenance.
    tustin2121 likes this.
  29. Offline


    I need to use the --port and --message feature at the same time. How do I do this?
  30. Offline


    Have you even read the help or the usage examples in the first post? There's at least one example showing how to string together arguments on the command line...
Thread Status:
Not open for further replies.

Share This Page