A simple plugin that soft-reloads other plugins. Typically this is a simple config reload.
Run /softreload
. You need to have the permission node softreload.softreload
.
repositories {
maven("https://repo.mineinabyss.com/releases")
}
dependencies {
compileOnly("com.mineinabyss:softreload-core:1.0+")
}
name: 'YourPlugin'
...
softdepend:
- SoftReload
...
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.
}
}