Coder Social home page Coder Social logo

Comments (3)

stephan-gh avatar stephan-gh commented on June 21, 2024

If you load after SLP (with depend or soft depend) you should be able to get the SLP instance and then access the parsed configuration classes through the configuration manager. To avoid conflicts between SLP and your plugin, you could then call the function that implements /slp disable (this will also persist across reboots).

Note however that this isn't officially part of the public API (only Replacement API and Ban API is public, see API page in SLP wiki). You would be directly accessing internal classes of SLP that may change in the future. Given the maintenance-only state of SLP I doubt that any of this will change in the future, though.

I'm also just spontaneously looking at the classes and may have typos, but I think it should roughly work like this:

ServerListPlusCore slp = ServerListPlusCore.getInstance();
ServerStatusConf conf = slp.getConf(ServerStatusConf.class);
// ... parse config ...

// run /slp disable, returns true if enable state changed, or throws an exception
slp.getProfiles().setEnabled(false);

There is also PluginConf.class and (on Bukkit) BukkitConf.class for the !Plugin and !Bukkit part of the configuration, but I guess these aren't too interesting.

SLP transforms the ServerStatusConf to a PersonalizedStatusPatch, available via slp.getStatus().getPatch() and slp.getStatus().getHosts(). There the strings are already partially pre-processed (certain static placeholders applied, possibly color codes replaced, ...). I guess this is also not helpful for you, so looking at the ServerStatusConf is probably best.

from serverlistplus.

Andre601 avatar Andre601 commented on June 21, 2024

Yeah, been looking at the patches one with getDefaults, getPersonalized and getBanned so far...

from serverlistplus.

Andre601 avatar Andre601 commented on June 21, 2024

It is done

from serverlistplus.

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.