Giter Club home page Giter Club logo

Comments (3)

kevinkjt2000 avatar kevinkjt2000 commented on August 14, 2024 2

This one-liner should help:

>>> plugins
['GrieferGamesBan 1.0', 'WorldEdit 6.1.2,b3fbe8b', 'Prefix 2.1.3', 'VoteKick 2.0', 'RankSigns 0.7.2', 'PermissionsEx 1.23.4', 'GrieferGames 3.0', 'PlugMan 2.1.5', 'SetSpawn 3.1', 'MOTD 2.3.2', 'ViaVersion 2.0.1', 'Tablist 1.3.2.9', 'Vault 1.5.5-b47', 'ProtocolLib 4.4.0', 'WorldGuard 6.1', 'NoCheatPlus 3.16.0-RC-sMD5NET-b1134', 'Essentials 2.0.1-b171', 'AntiTab 2.3', 'JoinMessagePlus 3.1', 'PlotSquared 3.5.0-SNAPSHOT-2b561f2', 'Multiverse-Core 2.5-b717', 'AuthMe 5.6.0-beta1-b2226', 'HolographicDisplays 2.1.11']
>>> ", ".join([plugin.split(" ")[0] for plugin in plugins])
'GrieferGamesBan, WorldEdit, Prefix, VoteKick, RankSigns, PermissionsEx, GrieferGames, PlugMan, SetSpawn, MOTD, ViaVersion, Tablist, Vault, ProtocolLib, WorldGuard, NoCheatPlus, Essentials, AntiTab, JoinMessagePlus, PlotSquared, Multiverse-Core, AuthMe, HolographicDisplays'

from mcstatus.

kevinkjt2000 avatar kevinkjt2000 commented on August 14, 2024 1

It would appear that each plugin name and version is separated by a space. Will you try using name, version = plugin.split(" ") on each plugin?

>>> name, version = "Foo 1.0".split(" ")
>>> name
'Foo'
>>> version
'1.0'

from mcstatus.

Iphex avatar Iphex commented on August 14, 2024

It would appear that each plugin name and version are separated by a space. Will you try using name, version = plugin.split(" ")

Does not work in Python as the query brings back plugin as a list. For Example:
['CoreProtect 2.16.3', 'EditableSign 5.5.2', 'VeinMiner 1.14.0', 'ChestSort 5.0.2']
We can just iterate over it tho with for example

           plugins = ""
           plugins_versions = query.software.plugins # ex. Veinminer 2.5
           for i in plugins_versions:
                plug = i.split(" ")
                plugins = plug[0] + ", " + plugins
           plugins = plugins[:-2] #cut the last , and space

This gives us plugins as a String that we can directly use

CoreProtect, EditableSign, VeinMiner, ChestSort

I am pretty sure that there is a prettier solution for this, but I am quite the noob in python so I apologize.

from mcstatus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.