Get a Plug-in from server

Discussion in 'Plugin Development' started by AddventureTime, Nov 29, 2020.

  1. Offline

    AddventureTime

    How can I query whether there is a certain plugin on the server?

    for example:

    Code:
    public void onEnable() {
    
    if(Bukkit.getServer().getPluginManager().getPlugins().equals(„PingAPI“) {
    
    PingAPI.registerListener(new setPlayerSample());
    
    }else {
    
    Bukkit.getConsoleSender().sendMessage(„PingAPI can not be found! Disable PingAPI.“);
    
    }
    
    }
    I like to do it that way because if the server doesn't have the "PingAPI" plugin, there are many errors.
     
  2. Offline

    caderapee

    @AddventureTime getPlugins() will return a list of plugins.

    You might look for 'getPlugin("") != null' for check if it's on.
     
    AddventureTime likes this.
  3. Offline

    AddventureTime

    @caderapee like this?

    [​IMG]
     
  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    jonathanpecany

    I did come here to see if I could help, which I can see that timtower beat me to it but just came here about the screenshot again. Use snippet to take the screenshot, it will be a lot easier then using an external device to take a screenshot.

    Windows 10: Win + Shift + S
    Mac: CMD + Shift + 4

    @timtower - Timtower, you have to agree with me that using snippet is a lot more easier and clearer for anyone so the person is asking can receive better help. As just taking a picture of the screen (As this looks like) makes it hard to see a bit.
     
  6. Online

    timtower Administrator Administrator Moderator

    @jonathanpecany I prefer code blocks more so we can just copy paste stuff instead
     

Share This Page