Skip to content

A plugin that can bulk reload other plugins configuration

License

Notifications You must be signed in to change notification settings

MineInAbyss/softreload

Repository files navigation

Java CI with Gradle Maven

SoftReload

A simple plugin that soft-reloads other plugins. Typically this is a simple config reload.

How to use

Run /softreload. You need to have the permission node softreload.softreload.

How to integrate a plugin

Add dependency on SoftReload

repositories {
    maven("https://repo.mineinabyss.com/releases")
}

dependencies {
    compileOnly("com.mineinabyss:softreload-core:1.0+")
}

Add soft dependency in plugin.yml

name: 'YourPlugin'
...
softdepend:
  - SoftReload
...

Implement SoftReloadable

class YourPlugin extends JavaPlugin {
  //...

  @Override
  public boolean onEnable() {
    //...
    registerSoftReload();
  }

  void registerSoftReload() {
    try {
      RegisteredServiceProvider<SoftReloadService> softReloadService = getServer().getServicesManager()
          .getRegistration(SoftReloadService.class);
      if (softReloadService != null) {
        softReloadService.getProvider().register(this, this::softReload);
      }
    } catch (NoClassDefFoundError ignored) {
    }
  }

  boolean softReload() {
    //... reload configs, etc.
    return true; // false if reload failed.
  }
}

About

A plugin that can bulk reload other plugins configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published