diff options
author | Keuin <[email protected]> | 2022-08-14 16:01:27 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-08-14 16:01:27 +0800 |
commit | 2cfdf9021cfd3f9fce29a3db2f30ab0cb77ba3b5 (patch) | |
tree | fe87d66c2a09406cfab1d17b28ab24e052b9d534 /src/main | |
parent | f5d66421dd43527c1f889edf41661c8c810851f2 (diff) |
Bugfix: wrong initialization sequence crashes velocity server startup.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/keuin/crosslink/plugin/velocity/VelocityEventBus.java | 3 | ||||
-rw-r--r-- | src/main/java/com/keuin/crosslink/plugin/velocity/VelocityMainWrapper.java | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/com/keuin/crosslink/plugin/velocity/VelocityEventBus.java b/src/main/java/com/keuin/crosslink/plugin/velocity/VelocityEventBus.java index 2b6ddf8..4a2afdd 100644 --- a/src/main/java/com/keuin/crosslink/plugin/velocity/VelocityEventBus.java +++ b/src/main/java/com/keuin/crosslink/plugin/velocity/VelocityEventBus.java @@ -1,7 +1,6 @@ package com.keuin.crosslink.plugin.velocity; import com.google.inject.Inject; -import com.keuin.crosslink.plugin.bungee.BungeeEventBus; import com.keuin.crosslink.plugin.common.IEventBus; import com.keuin.crosslink.plugin.common.event.EventHandler; import com.keuin.crosslink.plugin.common.event.PlayerConnectEvent; @@ -22,7 +21,7 @@ import java.util.logging.Logger; public class VelocityEventBus implements IEventBus { private final Object plugin; private final ProxyServer velocity; - private final Logger logger = Logger.getLogger(BungeeEventBus.class.getName()); + private final Logger logger = Logger.getLogger(VelocityEventBus.class.getName()); private final Set<UUID> connectedPlayers = Collections.newSetFromMap(new ConcurrentHashMap<>()); // all players connected to the proxy private final Map<UUID, ServerInfo> serverPlayerLastJoined = new HashMap<>(); // the server players last connected to diff --git a/src/main/java/com/keuin/crosslink/plugin/velocity/VelocityMainWrapper.java b/src/main/java/com/keuin/crosslink/plugin/velocity/VelocityMainWrapper.java index b1f5881..dbebfc9 100644 --- a/src/main/java/com/keuin/crosslink/plugin/velocity/VelocityMainWrapper.java +++ b/src/main/java/com/keuin/crosslink/plugin/velocity/VelocityMainWrapper.java @@ -32,6 +32,7 @@ import java.nio.file.Path; public final class VelocityMainWrapper { private final ProxyServer proxy; private final PluginMain plugin; + private final VelocityEventBus eventBus; @Subscribe public void onProxyInitialization(ProxyInitializeEvent event) { @@ -41,13 +42,15 @@ public final class VelocityMainWrapper { // shutdown event proxy.getEventManager().register( this, ProxyShutdownEvent.class, (ev) -> plugin.disable()); + // register event bus + proxy.getEventManager().register(this, eventBus); + // main initialization plugin.enable(); } @Inject public VelocityMainWrapper(ProxyServer proxy, Logger logger, @DataDirectory Path pluginDataPath) { - var eventBus = new VelocityEventBus(this, proxy); - proxy.getEventManager().register(this, eventBus); + this.eventBus = new VelocityEventBus(this, proxy); this.proxy = proxy; var injector = Guice.createInjector( new VelocityAccessorModule(this), |