Registered NucleusExtension

This commit is contained in:
Rsl1122 2019-04-19 16:03:37 +03:00
parent f172c88321
commit 64e26aa84d
2 changed files with 17 additions and 12 deletions

View File

@ -12,6 +12,7 @@ dependencies {
compile "com.djrapitops:Extension-GriefPreventionPlus:13.3-R0.1"
compile "com.djrapitops:Extension-McMMO:2.1.44-R0.1"
compile 'com.djrapitops:Extension-MinigamesLib:1.14.17-R0.1'
compile 'com.djrapitops:Extension-Nucleus:1.9.2-R0.1'
compile "com.djrapitops:Extension-Sponge-Economy:7.1.0-R0.2"
}

View File

@ -22,7 +22,6 @@ import com.djrapitops.plan.extension.ExtensionService;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.function.Function;
/**
* In charge of registering built in {@link com.djrapitops.plan.extension.DataExtension} implementations.
@ -48,22 +47,27 @@ public class ExtensionRegister {
new BanManagerExtensionFactory().createExtension().ifPresent(extensionService::register);
new CoreProtectExtensionFactory().createExtension().ifPresent(extensionService::register);
new DiscordSRVExtensionFactory().createExtension().ifPresent(extensionService::register);
EssentialsExtensionFactory essentials = new EssentialsExtensionFactory();
essentials.createExtension()
.map(extensionService::register).flatMap(Function.identity()) // If the extension was registered this is present.
.ifPresent(essentials::registerUpdateListeners);
registerEssentialsExtension(extensionService);
new GriefPreventionExtensionFactory().createExtension().ifPresent(extensionService::register);
new GriefPreventionSpongeExtensionFactory().createExtension().ifPresent(extensionService::register);
new GriefPreventionPlusExtensionFactory().createExtension().ifPresent(extensionService::register);
new McMMOExtensionFactory().createExtension().ifPresent(extensionService::register);
for (DataExtension minigame : new MinigameLibExtensionFactory().createExtensions()) {
extensionService.register(minigame);
}
registerMinigameLibExtensions(extensionService);
new NucleusExtensionFactory().createExtension().ifPresent(extensionService::register);
new SpongeEconomyExtensionFactory().createExtension().ifPresent(extensionService::register);
}
private void registerEssentialsExtension(ExtensionService extensionService) {
EssentialsExtensionFactory essentials = new EssentialsExtensionFactory();
essentials.createExtension()
.flatMap(extensionService::register) // If the extension was registered this is present.
.ifPresent(essentials::registerUpdateListeners);
}
private void registerMinigameLibExtensions(ExtensionService extensionService) {
for (DataExtension minigame : new MinigameLibExtensionFactory().createExtensions()) {
extensionService.register(minigame);
}
}
}