[REQ] SIMPLE! Write 1 in a txt when server is on, 0 when off.

Discussion in 'Archived: Plugin Requests' started by powback, Jul 27, 2011.

  1. Offline


    I need a plugin that tells if the server is online.
    write 1 in a .txt when activated
    write 0 in the same .txt when disabling

    Can anyone do this for me?
  2. Offline


    Well it can't write 0 if the plugin isn't enabled! (the server is off). You can achieve this through a variety of methods. What are you trying to achieve?
  3. Offline


    online/offline stats on my webpage.
    It can be achieved by writing 0 when typing /stop.
    I just cant figure out how to make them plugins. its driving me insane x]
  4. Offline


    Try the HUGE Plugin Tutorial at http://wiki.bukkit.org/HUGE_Plugin_Tutorial. It was very helpful for me.
    As for detecting server shutdown, you can write the 0 in the onDisable handler of the plugin, or even add a VM shutdown handler.

    I'm going to try and make the plugin right now.

    Here you go!
    The plugin writes to a file called isserveron.txt in the folder where the server is located. It writes a 1 when it is enabled, and a 0 when it is disabled.
    I think Elusive92's version is better because it can also track if the server gets killed.

    Attached Files:

    Last edited by a moderator: May 18, 2016
  5. Offline


    I modified a personal version of this to suit your requirements. The file is called server_status.txt and is even updated when the process is killed.

    edit: @zhuowei whoops, you beat me to it!

    @Astusvis You cannot ping ports. You could try to establish a connection to the IP/port using a terminal client or something like that, but that would require more work than this. Besides that, the server could still refuse connections, which would result in false negatives.

    @Astusvis They might have implemented the basic protocol to connect to those servers using a simple socket. Doing so would require quite some time. It is way easier to use a simple plugin like this. And it is VERY simple. I coded and tested my version in about 10 minutes.

    Attached Files:

    Last edited by a moderator: May 18, 2016
  6. Offline


  7. Offline


    @powback Does everything work as expected?
  8. Offline


    Everything works great! Thank you so much! You made my day :D
  9. Offline


Share This Page