Update VV API usage

This commit is contained in:
FlorianMichael 2024-07-22 18:36:41 +02:00
parent 5eb1f5730c
commit 0923ac71bb
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 10 additions and 9 deletions

View File

@ -32,10 +32,10 @@ public class BukkitPlugin extends JavaPlugin implements ViaAprilFoolsPlatform {
final ViaManager manager = Via.getManager(); final ViaManager manager = Via.getManager();
manager.addEnableListener(() -> { manager.addEnableListener(() -> {
this.init(new File(getDataFolder(), "config.yml"));
final VersionProvider delegate = manager.getProviders().get(VersionProvider.class); final VersionProvider delegate = manager.getProviders().get(VersionProvider.class);
manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate)); manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate));
this.init(new File(getDataFolder(), "config.yml"));
}); });
} }

View File

@ -42,9 +42,10 @@ public class ViaFabricAddon implements ViaAprilFoolsPlatform, Runnable {
this.init(new File(getDataFolder(), "config.yml")); this.init(new File(getDataFolder(), "config.yml"));
final ViaManager manager = Via.getManager(); final ViaManager manager = Via.getManager();
manager.addPostEnableListener(() -> {
final VersionProvider delegate = manager.getProviders().get(VersionProvider.class); final VersionProvider delegate = manager.getProviders().get(VersionProvider.class);
manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate)); manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate));
});
} }
@Override @Override

View File

@ -63,10 +63,10 @@ public class VelocityPlugin implements ViaAprilFoolsPlatform {
this.logger = new LoggerWrapper(loggerSlf4j); this.logger = new LoggerWrapper(loggerSlf4j);
final ViaManager manager = Via.getManager(); final ViaManager manager = Via.getManager();
manager.addEnableListener(() -> { manager.addEnableListener(() -> this.init(new File(getDataFolder(), "config.yml")));
this.init(new File(getDataFolder(), "config.yml")); manager.addPostEnableListener(() -> {
final VersionProvider delegate = manager.getProviders().get(VersionProvider.class);
manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(new VelocityVersionProvider())); manager.getProviders().use(VersionProvider.class, new VAFServerVersionProvider(delegate));
}); });
} }