Dinnerbone / mcstatus

A Python class for checking the status of an enabled Minecraft server
http://dinnerbone.com/minecraft/tools/status/
1.11k stars 146 forks source link

How can I list plugins? #100

Closed ElFrod0 closed 3 years ago

ElFrod0 commented 3 years ago

Hello,

is there any possible way to have only server plugins in the output? In issue #46 he gets plugins list and their versions. How can I replicate that?

Cheers, Michal

Iapetus-11 commented 3 years ago

I believe the query protocol supports this. However, you won't just get server plugins in the output, you'll get other information such as online players. You can find example usage here: https://github.com/Dinnerbone/mcstatus#usage

Note: Not all servers have query enabled or even support it.

Edit: Seems I've misunderstood the question, my bad

ElFrod0 commented 3 years ago

It supports it. But I just dont know how to use it properly. As you can see in Issue #46 it has to be something with query.software.plugins

kevinkjt2000 commented 3 years ago

After retrieving a status or query object, try using dir() on them (e.g. dir(query), dir(query.software))

Edit: https://docs.python.org/3/library/functions.html#dir

kevinkjt2000 commented 3 years ago

I reread the question; seems like you are asking about mcstatus as a command line tool? Not as a python library? There is very limited configuration for the command line output if any. You'll have to write your own python script that uses mcstatus as an imported library to control what is output.

ElFrod0 commented 3 years ago

Thanks for fast response. Yeah.. Im asking about mcstatus as a command-line tool :/ I have literally zero experience with Python.. Looks like I won't be able to get plugins list of other servers then. Unluckily dinnerbone's website is broken. There used to be "Full Status" feature which was able to show everything about the server.

Iapetus-11 commented 3 years ago

Here's some simple code that will list out the plugins:

from mcstatus import MinecraftServer

server = MinecraftServer.lookup('address:port')

query_data = server.query()

print('\n'.join(query_data.software.plugins))

Simply replace address:port with the server you want to get the plugins from.

Iapetus-11 commented 3 years ago

And if you want a website to do this, https://mcsrvstat.us/ is pretty good!

kevinkjt2000 commented 3 years ago

With that sample code provided, please let us know if the issue is addressed.

kevinkjt2000 commented 3 years ago

Closing due to lack of response