[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

    gabessdsp

    I looked in the examples spoiler and the FAQ and did not see anything like that.
     
  2. Offline

    tustin2121

    (Note: this appears at the bottom of the help print out, called up by passing the argument -? to McSod. It is copied to the original post right before the example section.)

    Also, stringing together arguments on the command line is a very common thing to do. You do it when you start up craftbukkit - just look in the .BAT or .SH file you probably use when you start it up. You have to tell java to use more memory than usual, and passing command line arguments is how you do it.
     
  3. Offline

    sleepysonic

    Could you add the option of being able to automatically kill MCsignonDoor after sending a message back to the player and then the ability to execute an application (boot up craftbukkit for example). Please? :)

    I want my craftbukkit to only be running when people are on it. So I want it to kill itself after 1hr with no players and then launch mcsignondoor in it's place. And then I would like my players to get a "booting up server, reconnect soon!" message and then launch craftbukkit back up and kill itself to open up the port again.

    I hope that made sense. It doesn't sound like it would be too hard to do. It would be great for people who don't have many people on their server a lot of the time.
     
  4. Offline

    tustin2121


    Hm... So, I covered why I couldn't run a program from McSod back on page 4. However, I don't see why McSod couldn't run in a "sentry mode", where it kills itself upon receiving a connection. If it does this, a batch or shell file running the program will move on to the next line in the script, which could be booting up the server. In that case, you could even put a loop around the two lines in the script, and it would just loop like that indefinitely.

    Sentry mode isn't a bad idea. I may have to implement it shortly...
     
  5. Offline

    fredghostkyle1

    this is cool! but what if the computer goes off line........ then what?!??!!??!?!!
     
  6. Offline

    tustin2121

    Then you're screwed. Have a nice day. :)
     
  7. Offline

    Miningdude

    This looks, and was, cool / useful. I tested it locally (Not where my server is). It is awesome, and I might use this on my server sometime. :D


    I really like the idea of Auto-Starting / Quitting (thenbooting up CBukkit)!
     
  8. Offline

    Lyndon321

    Any idea on how we could make this run indefeintly? I run a server on a dedi that i bought right, I tried doing an SH script so that it would run all the time but that doesn't seem to work, it only will display the message when I have terminal open after i run the command.
     
  9. Offline

    tustin2121

    When I ran my server, I used a command called "screen". Take the command you're using right now and put "screen -S mcsod" before it (assuming the screen command is installed). Now the command will run in its own "screen", which you can detach from using the key sequence "Ctrl-A Ctrl-D". The command will still run in the background. When you want to reattach to the command, use "screen -r" (or "screen -r mcsod" if you have more than one screen running) and the shell session will pick up the command where it is now. At that point, you can do whatever you need. I used this for both mcsod and the bukkit server itself. As far as the running program knows, you're still looking at it on screen.

    Alternately, since McSod doesn't require constant input (like the bukkit server does), I think you can use "Ctrl-Z" to "background" the program and it will continue merrily along. And use "fg" to bring it back to the foreground. (Use of the "bg" command may be needed as well to background it, idk.)

    I'm starting development again on Minecraft-related items, so this should be here soon.
     
  10. Offline

    Miningdude

    Awesome! May I test it please? :D #TestingIsAwesome
     
  11. Offline

    Lyndon321

    Sweet the screen seems to be working perfectly.
     
    tustin2121 likes this.
  12. Offline

    admalledd

    Using MCSoD while I take down my server for testing 1.3.1, seems that I am getting a error when clients try to "join"

    Code:
    Exception in thread "Thread-35" java.lang.IndexOutOfBoundsException
            at java.io.BufferedInputStream.read(Unknown Source)
            at org.digiplex.mcsod.MCSignOnDoor$ResponderThread.run(MCSignOnDoor.java:617)
    
    my command line is: java -jar MCSignOnDoor.jar --motd "testing minecraft 1.3.1" -m "testing craftbukkit 1.3.1"
    chances of an update?
     
  13. Offline

    tustin2121

    Chances of an update are great, now that I found a very handy "minecraft protocol" page.

    Turns out this update seems to have added a "protocol version" to the spot where McSod was expecting the length of a string. Coincidentally, the allocated array for reading input is quite a bit shorter than 92568 entries.

    Also, they have since added to the login packet the name and port of the server the client thinks it's connecting to. That means new functionality can be had! Now if only I knew what I could do with that. Any ideas?

    Also, since I'm fixing this, I'm gonna add on the sentry mode thing we've been discussing. (I have been working on Commander Advanced Scripting.)

    HOLY SH*T!! There's NEWLINE support on the sign on door! *rushes off to add fun stuff!*

    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). (If anyone who hasn't updated their client yet wants to test this out, please report back and confirm that the old way still works.)
    - 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) connecting to the server. This is for scripts with a loop, so servers can start back up automatically. (See below)
    - 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.

    Here are some example scripts as to how one might go about using the return code from McSod. Note that these examples are quickly thrown together and are untested.

    Windows Batch Script File: runloop.bat
    Code:
    @echo off
    :RunBukkit
    java -Xms1024M -Xmx1024M -Djava.awt.headless=true -jar "craftbukkit-1.2.5-R5.0.jar"
    ::Now run McSod
    java -jar MCSignOnDoor.jar --sentrymode -m "Gone Fishin' Back in Five Minutes!"
    set exitcode=%ERRORLEVEL%
    ::Check the exit code. If it is 12, then McSod exited due to sentry detection
    IF %ERRORLEVEL%==12 GOTO RunBukkit
    Mac/Unix Bash Script File: runloop.sh
    Code:
    #!/bin/bash
    while true
    do
        java -Xms1024M -Xmx1024M -Djava.awt.headless=true -jar "craftbukkit-1.2.5-R5.0.jar"
     
        #Now run McSod
        java -jar MCSignOnDoor.jar --sentrymode -m "Gone Fishin' Back in Five Minutes!"
        #Check the error code: break the loop if the exit code is not 12
        if [ "$?" -ne "12" ]; then
            break
        fi
     
    done
    EDIT: forgot to set --sentrymode on the command line in the script examples. ^_^;

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

    admalledd

    I can report that MCSoD does work for both 1.3.1 and 1.2.5. thank you very much! huzza for \n in the message, now i can have useful details and such easily.

    like the sentry option, I will look at how to add that to my server restart script (maybe have my server shut down after so long without players, then put up MCSoD? saves resources...)

    oh, and I tried to do "java -jar MCSignOnDoor.jar --help" and it returned nothing (no help) even though your post says it should, did something break?
     
  15. Offline

    tustin2121

    What you speak of is indeed the line of thought, discussed above, that went into making Sentry mode. Now all you need is a plugin that will shut down the server if no one is on. I cannot help you there, but if you have a few plugin suggestions, feel free to post them here.

    And thanks for the confirmation of backwards compatibility! I will add a note to the front post. :)

    As for the help switch, it worked when I tested it before. I will look into it today or tomorrow when I get the chance.
     
  16. Whoo McSignOnDoor.
    So awesome, thanks for all you work!

    EDIT: Dat typo :confused:
     
    tustin2121 likes this.
  17. Offline

    tustin2121

    You're welcome. :)

    Also, saw your signature and I had to look to see what SpaceBukkit was and, when I saw what it was, I had to look to see if it has McSod support. I came across a forum thread where someone said they contacted me, but I don't recall getting contacted, and I can't find a post here or a PM (the two primary means of contacting me about this) about it. I love other programs using it (and actually, it'd be nice having a list of programs that use it on the main post), as long as they give credit somewhere. :)

    Sorry, don't know if you're actually associated with them, just thought I'd mention this.
     
  18. I believe that was me (IRC maybe?)
    I personally want to add McSod support and got the green light from the rest of the team to add it in the next version.
     
  19. Offline

    tustin2121

    I don't have or use IRC (except maybe once for five minutes sometime last year) so you might have been talking to someone who had a similar username, perhaps? Idk.

    As for incorporation: yes! Please! Again, credit somewhere, but I'm glad to have people use it! In fact, right now I'm compiling a list on the front post of third party software that is using McSod in their features. When you incorporate it (this goes for anyone) tell me and I'll add the product's name and link to the list! :D
     
  20. Credit is no problem :)
    I'll be sure to look at it as we get closer to a new release. And who knows who I talked to, somebody :p
     
    tustin2121 likes this.
  21. Offline

    tustin2121

    Oh, btw, this bug has been confirmed. There seems to be an Exception slipping through the cracks when it tries to print the help, but it doesn't do it when I try running it straight from Eclipse (you gotta love those kind of bugs). I will pinpoint what exactly is wrong and have a double-point release shortly, tomorrow at the latest.

    Version 1.7.1 will be out shortly, fixing the help print out not appearing.

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

    tustin2121

    Version 1.7.1 is out, finally:
    - I don't know why, but suddenly the method I have been using to load and print the helpfile just decided to stop working. I didn't do anything to it, it just stopped. So I had to switch to a "more proper" method, and add a constructor to the TemplateFormatter to make it work.
     
  23. Offline

    Vincs

    Hello !
    I'm wishing to use this plugin to :
    -Shutdown the server when nobody is connected after an hour.
    -Woke up the server when someone is trying to connect.

    To do you have any ideas on how to do ?

    I'm running it under a synology.
     
  24. Offline

    tustin2121

    Oh, wow, deja vu here. This functionality (the wake up functionality, called Sentry mode by McSod) has been added in version 1.7. See this post for batch file examples for starting up the server.

    Also, this is not a plugin, it is a standalone program. You will have to use something else, an actual plugin, to shut down the server after an hour of inactivity.
     
  25. Offline

    Vincs

    Thanks for the batch file to start the server.

    Sorry for the confusion, between plugin and program. ;-)

    I will try your program this evening.

    I'm looking for something to shut down the server but don't find anything. (Else than shuting down at specified time.)
     
  26. Offline

    tustin2121

    You are right. *Runs off to write ServerSleeper, the Server Inactivity Shutdown Plugin*
     
  27. Offline

    Vincs

    Haha you're amazing.
    When I try to log on the page, it says :
    "This project is awaiting approval.
    This means that this project may not meet this site's standards and may only be available for a short time.
    Be forewarned before downloading anything from this project."
    Keep use in contact. :)

    I've installed MCSignOnDoor, it works just perfectly !

    Thanks a lot for your help.
     
  28. Offline

    tustin2121

    Yes, I know. I only created the project minutes before posting the link, and there's nothing to download yet, so I don't expect that to change anytime soon.

    Glad it works for you! :p
     
  29. Offline

    Vincs

    Ok ! Maybe I will try to do it my self, I'm a dev. Never made any minecraft plugins, but this one shouldn't be tricky so it maybe a good start. If I've got some times off, I will try this week - end. (Please, let me try it before doing it, otherwise I won't be motivated to do it. ;-))

    I will keep you updated.

    Ok !
    I've done it.
    This a very basic plugin, but I think it does the job.
    http://dev.bukkit.org/server-mods/emptyserverstopper/
     
  30. Offline

    tustin2121

    I have also uploaded mine, and the project is now approved. Now make yours better than mine. ';j

    (Failed emote at end is supposed to be a raised eyebrow and friendly smirk face...)
     
Thread Status:
Not open for further replies.

Share This Page