From 0923ac71bbca7b7489a2a52769ecc9bf38115112 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Mon, 22 Jul 2024 18:36:41 +0200 Subject: [PATCH] Update VV API usage --- .../main/java/net/raphimc/viaaprilfools/BukkitPlugin.java | 4 ++-- .../java/net/raphimc/viaaprilfools/ViaFabricAddon.java | 7 ++++--- .../java/net/raphimc/viaaprilfools/VelocityPlugin.java | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bukkit/src/main/java/net/raphimc/viaaprilfools/BukkitPlugin.java b/bukkit/src/main/java/net/raphimc/viaaprilfools/BukkitPlugin.java index 5bd5311..2996a46 100644 --- a/bukkit/src/main/java/net/raphimc/viaaprilfools/BukkitPlugin.java +++ b/bukkit/src/main/java/net/raphimc/viaaprilfools/BukkitPlugin.java @@ -32,10 +32,10 @@ public class BukkitPlugin extends JavaPlugin implements ViaAprilFoolsPlatform { final ViaManager manager = Via.getManager(); manager.addEnableListener(() -> { + this.init(new File(getDataFolder(), "config.yml")); + final VersionProvider delegate = manager.getProviders().get(VersionProvider.class); manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate)); - - this.init(new File(getDataFolder(), "config.yml")); }); } diff --git a/fabric/src/main/java/net/raphimc/viaaprilfools/ViaFabricAddon.java b/fabric/src/main/java/net/raphimc/viaaprilfools/ViaFabricAddon.java index 0d2d1fc..a72689d 100644 --- a/fabric/src/main/java/net/raphimc/viaaprilfools/ViaFabricAddon.java +++ b/fabric/src/main/java/net/raphimc/viaaprilfools/ViaFabricAddon.java @@ -42,9 +42,10 @@ public class ViaFabricAddon implements ViaAprilFoolsPlatform, Runnable { this.init(new File(getDataFolder(), "config.yml")); final ViaManager manager = Via.getManager(); - - final VersionProvider delegate = manager.getProviders().get(VersionProvider.class); - manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate)); + manager.addPostEnableListener(() -> { + final VersionProvider delegate = manager.getProviders().get(VersionProvider.class); + manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate)); + }); } @Override diff --git a/velocity/src/main/java/net/raphimc/viaaprilfools/VelocityPlugin.java b/velocity/src/main/java/net/raphimc/viaaprilfools/VelocityPlugin.java index a63f0f5..3933029 100644 --- a/velocity/src/main/java/net/raphimc/viaaprilfools/VelocityPlugin.java +++ b/velocity/src/main/java/net/raphimc/viaaprilfools/VelocityPlugin.java @@ -63,10 +63,10 @@ public class VelocityPlugin implements ViaAprilFoolsPlatform { this.logger = new LoggerWrapper(loggerSlf4j); final ViaManager manager = Via.getManager(); - manager.addEnableListener(() -> { - this.init(new File(getDataFolder(), "config.yml")); - - manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(new VelocityVersionProvider())); + manager.addEnableListener(() -> this.init(new File(getDataFolder(), "config.yml"))); + manager.addPostEnableListener(() -> { + final VersionProvider delegate = manager.getProviders().get(VersionProvider.class); + manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate)); }); }