Skip to content

Commit

Permalink
fix: Move configuration loading back to proxy initialization listener
Browse files Browse the repository at this point in the history
  • Loading branch information
MemencioPerez committed May 13, 2024
1 parent eac5a45 commit 708ebd2
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,28 @@ public final class UnSignedVelocity {
private final Path dataDirectory;
private final Metrics.Factory factory;
private final ComponentLogger logger;
private final Configuration configuration;
private Configuration configuration;

@Inject
public UnSignedVelocity(ProxyServer server, Injector injector, @DataDirectory Path dataDirectory, Metrics.Factory factory, ComponentLogger logger) throws IOException {
public UnSignedVelocity(ProxyServer server, Injector injector, @DataDirectory Path dataDirectory, Metrics.Factory factory, ComponentLogger logger) {
this.server = server;
this.injector = injector;
this.dataDirectory = dataDirectory;
this.factory = factory;
this.logger = logger;
this.configuration = Configuration.loadConfig(dataDirectory);
}

@Subscribe
public void onProxyInitialize(ProxyInitializeEvent event) {
factory.make(this, 17514);

try {
configuration = Configuration.loadConfig(dataDirectory);
} catch (IOException e) {
logger.error("Cannot load configuration", e);
return;
}

PluginContainer pluginContainer = server.getPluginManager().ensurePluginContainer(this);
PacketEvents.setAPI(VelocityPacketEventsBuilder.build(server, pluginContainer, logger, dataDirectory));
PacketEvents.getAPI().getSettings().checkForUpdates(false)
Expand Down

0 comments on commit 708ebd2

Please sign in to comment.