[1.8] On first load

Discussion in 'Spigot Plugin Development' started by Renamed, Jul 30, 2018.

  1. How can I tell if my plugin has loaded before, or if it hasn't loaded before.
    Thank you.

    (Please provide glimpses of code for me to look at, or a link to documentation on this)
  2. Can you explain to me how this works?
    If a plugin depends on another plugin to load before it loads, how can a plugin depend on an unloaded plugin to load?
    And how can I check if it's loaded?
  3. Bukkit takes care of loading plugins in the correct order to satisfy all of the depend statements in all plugins. There's nothing you need to do other than specifying the plugins you need to depend on in the plugin.yml. Examples are given in the link I sent earlier.
  4. TheJavaHacker


    If you're asking whether the plugin has done its first run on a server, you could check to see if the config exists.
  5. Oh yes, thank you very much.

    It won't work. You cannot depend you own plugin from that plugin. This creates a dependency loop and Bukkit will stop all of those plugins (or in this case one plugin) from enabling...
  6. Yeah I think I misunderstood your question. The answer of @TheJavaHacker is fine, although it does assumes the plugin has a configuration. If the plugin doesn't, it's pretty much impossible.
  7. or creating a random file somewhere, that when it is deleted it makes the plugin act as though it hasn’t been run before.
  8. That's actually quite smart. One could make a plugin which should load before all other plugins, possibly, and keep a file (could be a simple TXT file or a yml file with a list) of plugins that has been enabled once using the plugin load events (or looping over the plugins that are enabled). That could work.