From 08713947b77e00502aaed11b936ccd41d315d574 Mon Sep 17 00:00:00 2001 From: Matsv Date: Sun, 25 Sep 2016 21:42:22 +0200 Subject: [PATCH] Add BukkitViaLoader to the builder and limit the builder methods --- .../main/java/us/myles/ViaVersion/ViaVersionPlugin.java | 6 ++---- common/src/main/java/us/myles/ViaVersion/ViaManager.java | 9 ++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java b/bukkit/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java index ae25d90aa..2b0b7c2ea 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java @@ -15,10 +15,7 @@ import us.myles.ViaVersion.api.command.ViaCommandSender; import us.myles.ViaVersion.api.configuration.ConfigurationProvider; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.platform.ViaPlatform; -import us.myles.ViaVersion.bukkit.BukkitCommandHandler; -import us.myles.ViaVersion.bukkit.BukkitCommandSender; -import us.myles.ViaVersion.bukkit.BukkitViaAPI; -import us.myles.ViaVersion.bukkit.BukkitViaInjector; +import us.myles.ViaVersion.bukkit.*; import us.myles.ViaVersion.classgenerator.ClassGenerator; import us.myles.ViaVersion.dump.PluginInfo; import us.myles.ViaVersion.util.ReflectionUtil; @@ -52,6 +49,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform { .platform(this) .commandHandler(commandHandler) .injector(new BukkitViaInjector()) + .loader(new BukkitViaLoader(this)) .build()); // For compatibility ViaVersion.setInstance(this); diff --git a/common/src/main/java/us/myles/ViaVersion/ViaManager.java b/common/src/main/java/us/myles/ViaVersion/ViaManager.java index 5f4846332..951490e06 100644 --- a/common/src/main/java/us/myles/ViaVersion/ViaManager.java +++ b/common/src/main/java/us/myles/ViaVersion/ViaManager.java @@ -19,7 +19,6 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @Getter -@Builder public class ViaManager { private final Map portedPlayers = new ConcurrentHashMap<>(); private ViaPlatform platform; @@ -31,6 +30,14 @@ public class ViaManager { private ViaCommandHandler commandHandler; private ViaPlatformLoader loader; + @Builder + public ViaManager(ViaPlatform platform, ViaInjector injector, ViaCommandHandler commandHandler, ViaPlatformLoader loader) { + this.platform = platform; + this.injector = injector; + this.commandHandler = commandHandler; + this.loader = loader; + } + public void init() { if (System.getProperty("ViaVersion") != null) { // Reload?