From 710f8ec5bdc954e93b754c252638ba2d81467062 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 28 Jul 2019 17:34:46 +0300 Subject: [PATCH] Registered ViaVersion extension --- .../ExtensionServiceImplementation.java | 3 +++ .../com/djrapitops/plan/system/PlanSystem.java | 2 +- Plan/extensions/build.gradle | 1 + .../implementation/ExtensionRegister.java | 16 ++++++++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java index e1e5389c7..6a0da2372 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/ExtensionServiceImplementation.java @@ -27,6 +27,7 @@ import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.settings.config.PlanConfig; +import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.error.ErrorHandler; @@ -82,6 +83,8 @@ public class ExtensionServiceImplementation implements ExtensionService { public void register() { extensionRegister.registerBuiltInExtensions(); + if (Check.isBukkitAvailable()) extensionRegister.registerBukkitExtensions(); + if (Check.isBungeeAvailable()) extensionRegister.registerBungeeExtensions(); } @Override diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/PlanSystem.java b/Plan/common/src/main/java/com/djrapitops/plan/system/PlanSystem.java index 00ec4b634..4af6b6369 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/PlanSystem.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/PlanSystem.java @@ -144,8 +144,8 @@ public class PlanSystem implements SubSystem { taskSystem, hookHandler ); - extensionService.register(); queryService.register(); + extensionService.register(); enabled = true; } diff --git a/Plan/extensions/build.gradle b/Plan/extensions/build.gradle index 04b896dac..ae5e036c3 100644 --- a/Plan/extensions/build.gradle +++ b/Plan/extensions/build.gradle @@ -17,6 +17,7 @@ dependencies { compile "com.djrapitops:Extension-Sponge-Economy:7.1.0-R0.3" compile "com.djrapitops:Extension-SuperbVote:0.5.4-R0.1" compile "com.djrapitops:Extension-Vault:1.7-R0.2" + compile "com.djrapitops:Extension-ViaVersion:2.1.3-R0.3" } shadowJar { diff --git a/Plan/extensions/src/main/java/com/djrapitops/plan/extension/implementation/ExtensionRegister.java b/Plan/extensions/src/main/java/com/djrapitops/plan/extension/implementation/ExtensionRegister.java index 1e6da1e77..e256d5864 100644 --- a/Plan/extensions/src/main/java/com/djrapitops/plan/extension/implementation/ExtensionRegister.java +++ b/Plan/extensions/src/main/java/com/djrapitops/plan/extension/implementation/ExtensionRegister.java @@ -60,6 +60,22 @@ public class ExtensionRegister { new VaultExtensionFactory().createExtension().ifPresent(extensionService::register); } + public void registerBukkitExtensions() { + // No need to catch exceptions here, + // registerBuiltInExtensions method will not be called unless Plan has enabled properly + ExtensionService extensionService = ExtensionService.getInstance(); + + new ViaVersionBukkitExtensionFactory().createExtension().ifPresent(extensionService::register); + } + + public void registerBungeeExtensions() { + // No need to catch exceptions here, + // registerBuiltInExtensions method will not be called unless Plan has enabled properly + ExtensionService extensionService = ExtensionService.getInstance(); + + new ViaVersionBungeeExtensionFactory().createExtension().ifPresent(extensionService::register); + } + private void registerEssentialsExtension(ExtensionService extensionService) { EssentialsExtensionFactory essentials = new EssentialsExtensionFactory(); essentials.createExtension()