Query Plugin - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: Query Plugin (/thread-1844.html) |
Query Plugin - Raekye - 03-24-2015 Hello all, about a month ago I implemented a query plugin when xoft added UDP protocol support (protocol) (github). This github issue includes some discussion Basic and full stat are implemented. I followed MCServer coding style/conventions to the best of my knowledge, and I believe the code is very well commented (explaining why, not what). There's a config setting to enable/disable and which port to listen on I don't think there's a way to get MCServer's version from lua - if someone knows a way, please let me know. So the only value hardcoded right now is "MCServer 1.8" for the version, because Minecraft 1.8 is the latest protocol it supports I also think this plugin could be useful implemented into core or the main code of the server, as a lot of services/server lists use this protocol to query servers (the minecraft ping protocol has changed much over the different versions) Please let me know what you guys think, thanks! RE: Query Plugin - xoft - 03-24-2015 I think the code needs some cleanup, there's clearly some leftovers from testing various approaches, some dead code etc. Then I'd really like to see you write more code How about https://github.com/mc-server/Core/issues/87 or https://github.com/mc-server/Core/issues/70 ? RE: Query Plugin - Raekye - 03-25-2015 Thanks for the feedback! I'm actually not entirely sure which parts you're referring to as leftovers (probably skipping over things in my own code), but going through I can think of these - line 17-20, Code: -- Use the InfoReg shared library to process the Info.lua file: - line 41-42, Code: LOG("Not starting query server; disabled in settings.ini.") - line 66-68, Code: OnReceivedData = function () - line 194-205, Code: function PacketReadInt(a_Data) Code: PacketRead4Bytes As for coding style, arguably extracting the session ID could be refactored higher up, but I kinda wanted to treat each packet type format as independent from each other as possible. Also, I'm not sure of any vanilla lua ways of cleanly converting between bytes and ints, hence the awkwardness with Code: PacketReadInt What did you have in mind? I'm actually quite busy ATM with school coming to a close soon - finishing projects and catching up for exams, especially since I've had pretty bad work ethics xD But I will try my hand at #70 hopefully this weekend. Thanks for your time! |