[DEV] NightQuery v.1.6NC - A Minequery fork [1000]

Discussion in 'Inactive/Unsupported Plugins' started by Ambedrake, Jun 14, 2011.

  1. Offline

    Ambedrake

    NightQuery - A Minequery fork
    Current Version : 1.6NC

    NightQuery is a plugin that was forked from the commonly used Minequery plugin. It was created to expand the information given off by the server to PHP scripts for website uses and administration remote monitoring. By using a query you can gather a various amount of information about the server to be used on your website or even used to update a database pertaining to the server!

    Notice : This fork was not and will not be intended for use with server lists, it was made for those who needed more information to be output to a website via PHP. Support for server lists will not be provided in this thread in any way shape or form by me.

    Information sent from the server on query:
    Server Bukkit Version
    Required Client Version
    Server Port
    Number of players online
    Max number of players the server can hold
    Latency
    Player list
    What maps players are on
    Active plugins
    Plugin versions

    Installation:
    1. Copy NightQuery.jar to your plugins folder
    2. Add "minequery-port=25566" to your server properties. (You can chose to change the port)
    3. Copy minequery.class.php somewhere on your web server for use in PHP scripts.

    Query in PHP script:
    Minequery::query("host","port")

    Download : NightQuery.Zip (Broken Link Working on Fixing)
    Plugin Source : Here
    PHP Class Source : Here

    Credits:
    Original MineQuery code written by blakeman8192 & Kramer.
    Fork PHP & Java by myself & Acidraven (now he is registered!)
    WordPress Implimentation - werelord

    Wordpress Implimentation (Thank you werelord)
    Using the source code provided below werelord made it possible to add a minestatus link to WordPress. Thank you very much for your contribution!

    http://pastebin.com/vz36fK2q

    to use this:

    1. Download the "minequery.class.php" file from Ambedrake's link above.. Drop it in the same folder as the Minequery plugin in your Wordpress plugin directory (normally, this is wp-content/plugins/minestatus/)
    2. Backup the "minestatus.php" file (just in case)
    3. either edit the "minestatus.php" file, replacing all the code within with the code in the Pastebin link above, or save the pastebin code in a new file, copy it over the "minestatus.php" (you can also edit the minestatus.php file from the Wordpress Admin page as well I believe
    4. Go to the Widget config in Wordpress's admin, choose your options and save..
    5. You're done!!


    Extra About The Authors :
    We gladly take jobs to make plugins or other web scripts, as two university students in the computer science department it is always nice to be able to add things to our portfolios for later showing potential employers.



    Changelog :
    Version 1.6NC
    • Forked MineQuery 1.5
    • Added Server Version to Query
    • Added Client Required Version to Query
    • Added Player Location to Query
    • Added Plugin Names to Query
    • Added Plugin Version to Query
     
  2. Offline

    Misa

    i was using minequery but i'll try this ;)
     
  3. Offline

    Ambedrake

    ^_^ Let me know how it goes, there is a skeleton on our site atm at Our site which is under construction of the info that we pull to show, the versions of plugins are not shown on that one because we use that only in the admin control panel for admins to do updates when needed.

    We are working on other interesting things to add to this but thus far those features only in experimental phases and we only like to publish the final codes (pride thing) =P
     
  4. This is awesome, is it possible to get player IPs as well? I've been wanting to have my playerlist show flags depending on which country the users are from.

    And, is it possible to replace minequery with this if we still want minestatus to work correctly, cause I see a lot of similarities. :)
     
  5. Offline

    Ambedrake

    The similarities to minequery are because this is a fork from it. As for IP's of the players that should be fairly simple I will look into the code needed. I am having some RL financial issues at the moment so our code may take a few days. As for minestatus I have not tried it, but theoretically so long as I keep the same variables in the array that it uses it should work. Give it a try and let me know if it does. Worst it can do is say its not working at which time I make a minestatus like site for everyone! (just with more features) ^_^.

    As well as your current questions, I think I will look into making some code to go along with this that will make minestatus necessary as all they are doing is using the same query and puting the code into a web format.

    Ok so did some testing, it does not like minestatus. It will work for the uptime information but for the players online it does not pull the correct variable (its trying to use the server information lol). I will contact them and see if they want to impliment support for nightquery and if not I will make an open source version of their happy little gizmo for y'all!

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

    Epoc

    Hi Ambedrake,

    Thank you for your plugin, he's very useful, however I've an issue with it : I didn't get all informations described in your first message, here's - in red - the informations that I didn't get :


    All the rest works fine.
    I've triple-checked the Nightquery installation, it's all good (no plugin conflict, configuration, etc...), I really don't know where's the problem.

    I've previously used Minequery 1.5 to do this job, but I've see that Nightquery can give more informations about the server but it didn't work, so it's a pitty :( For information, when looking over the Minequery source code, it seems that in version 2.0, it will get the same data that Nightquery can give - plus some others.

    Can you please help me ? :oops:
     
  7. Offline

    Ambedrake

    Hi Epoc,

    Are you using a direct PHP query to get the information or a premade script?
    Did you include once the PHP portion of this plugin?
    if so can you please post your code used in PHP so that I may take a look at where the issue may lie?

    I will help the best I can mate ^_^
     
  8. Offline

    Epoc

    Thanks for this fast response,

    I'm using a portion of your PHP script wich I've modified to be more optimized. Here is :
    PHP:
    function minequery($address$port 25566$timeout 30) {
        
    // Ouverture de la connexion
        
    $socket = @fsockopen($address$port$errno$errstr$timeout);

        
    // La connexion est non-bloquante
        
    @stream_set_blocking($socketFALSE);

        if (!
    $socket) {
            return 
    FALSE// Erreur survenue
        
    }

        
    // Envoi d'une requête à Minequery
        
    fwrite($socket"QUERY_JSON\n");

        
    $response "";

        
    // Lecture de la réponse
        
    while(!feof($socket)) {
            
    $response .= fgets($socket1024);
        }

        
    // Fermeture de la connexion
        
    fclose($socket);

        
    // Retour de la réponse sous forme d'un objet décodé à partir d'une chaîne Json
        
    return json_decode($response);
    }
    For example, this :
    PHP:
    print_r(minequery('77.111.254.68'28566))
    Returns :
    There are missing informations :/
     
  9. Offline

    Ambedrake

    ok there's the problem we haven't gotten around to fixing the JSON part of the query, try just parsing the array itself from the Minequery::query("host","port") command and tell me what you get returned.

    If you want to update the plugin's JSON output that'd be awesome too (I have had some RL issues slowing me down atm) the source is published on GitHub and I am personally hosting the compiled jar =P
     
  10. Offline

    Epoc

    You were right, the plugin is not updated to output the extra informations in Json. I will use the normal output query :)

    I would like to update the plugin but I technically don't know how (I've never developped with Bukkit)
     
  11. Offline

    Ambedrake

    ok I will talk to Acid about getting JSON updated, I am not as familiar with it as he is. We are looking into new functionality as well but we like to thoroughly test everything before releasing it. As for not knowing how to dev with bukkit, JSON output is not that difficult if you look in the code and see how it was done with the other bits =P
     
  12. Offline

    Epoc

    For sure :)

    Yes but I'm coding with Java only for four months, I've no ideas how Bukkit works, how to correctly compile a Bukkit plugin, etc.

    Anyway, the current version of Nightquery provides the informations I need :)
     
  13. Offline

    Ambedrake

    kk all good mate ^_^
     
  14. Offline

    Andrey

    Hey,I love your plugin, it's awesome to display server informations on the forums. I was just wondering If you take suggestions, because I thought about things you could add to the Query:

    • Memory Usage
    • CPU Usage
    • Uptime

    Thanks again for the time you spend on this plugin, it works great. (Also, I was wondering why some of the Query Results are written in capslock? It's not a problem, I was just curious)
     
  15. Offline

    Ambedrake

    Memory usage and CPU usage are pretty on the fly so the viability of those additions may be difficult we will look into it. As for uptime should be simple however it will require use of a DB or flatfile (I am very against flat files >.<) so long as you are ok with that we can look into adding it.

    Please feel free to add suggestions, the only stupid idea is the idea not said!
     
  16. Offline

    Andrey

    Well, I think you should use a sqlite file to log small stuff, flatfiles are horrible, I hate them too. ;)
     
  17. It's fully possible to show ram useage, the way I have done this untill I can find a better way is to use AJAX to load an script from another folder which queries the server for memory useage.
    http://i.imgur.com/vwTDm.png

    This of course assuming you already have a minequery fork that has this functionality.
     
  18. Offline

    Ambedrake

    I didn't think of using the AJAX setup good idea. Hmm ty for the idea m8!
     
  19. Offline

    Ambedrake

    explain a bit bro, all this does is return an array (or as soon as acid sends it to me the JSON will be fixed as well)
     
  20. Offline

    Epoc

    The proposed PHP script works very fine and fast (wich I've optimized a little bit), you can't do better (in my opinion). If it did not work on your server check if the PHP plugin "sockets" is enabled. If yes, check if the ports you defined are corrects (reminder, in the PHP script you have to define the query port, not the play port).
    Be also sure you have defined a different query port than the play port in your plugin configuration.
     
    Ambedrake likes this.
  21. Offline

    Epoc

    The plugin isn't fully compatible with the latest build of Bukkit (rev 1000) :rolleyes:
     
  22. Offline

    Ambedrake

    Please explain we personally haven't had issues on the test server so a console output would be nice too.
     
  23. Offline

    Epoc

    False alarm, the plugin is working correctly :)
     
  24. Offline

    Ambedrake

  25. Offline

    Nathan C

    Is it possible to somehow have html code to query the players online? -- So that I could put i on my website.
     
  26. Offline

    Ambedrake

    PHP code integrates into HTML code if your server supports it (most do now a days) There are lots of tutorials online on how to do this all you would have to do is integrate the query through and "echo" in your HTML.
     
  27. Offline

    werelord

    I've modified Minestatus widget for Nightquery.. You can find the source for this here:

    http://pastebin.com/vz36fK2q

    to use this:
    1. Download the "minequery.class.php" file from Ambedrake's link above.. Drop it in the same folder as the Minequery plugin in your Wordpress plugin directory (normally, this is wp-content/plugins/minestatus/)
    2. Backup the "minestatus.php" file (just in case)
    3. either edit the "minestatus.php" file, replacing all the code within with the code in the Pastebin link above, or save the pastebin code in a new file, copy it over the "minestatus.php" (you can also edit the minestatus.php file from the Wordpress Admin page as well I believe
    4. Go to the Widget config in Wordpress's admin, choose your options and save..
    5. You're done!!
    Ambedrake, feel free to include this file in your plugin release if you want.. Same license, GPLv2

    I'll check back on this thread if there's any questions/problems..
     
  28. Offline

    Ambedrake

    Thread updated to include this information, if you wish to be added to the github at all just let me know I do like your initiative a lot!
     
  29. I just looked over your source again, the reason this is not compatible with Minestatus is because you are tampering with the respond string. If you change it to the original
    And then applying your own "items", it will be compatible with minestatus. What minestatus does is that it takes certain elements from the ARRAY you return, hence if you return it in a tampered way (i.e. including your own additions BEFORE finishing the ORIGINAL features) it will not work.
     

Share This Page