mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-10-31 23:59:33 +01:00
Move config load after platform creation
This commit is contained in:
parent
564286d742
commit
7a6c51331b
@ -56,8 +56,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player> {
|
||||
private static final boolean FOLIA = PaperViaInjector.hasClass("io.papermc.paper.threadedregions.RegionizedServer");
|
||||
private static ViaVersionPlugin instance;
|
||||
private final BukkitCommandHandler commandHandler;
|
||||
private final BukkitViaConfig conf;
|
||||
private final BukkitCommandHandler commandHandler = new BukkitCommandHandler();
|
||||
private final BukkitViaConfig conf = new BukkitViaConfig(getDataFolder());
|
||||
private final ViaAPI<Player> api = new BukkitViaAPI(this);
|
||||
private boolean protocolSupport;
|
||||
private boolean lateBind;
|
||||
@ -65,20 +65,14 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
|
||||
public ViaVersionPlugin() {
|
||||
instance = this;
|
||||
|
||||
// Command handler
|
||||
commandHandler = new BukkitCommandHandler();
|
||||
|
||||
// Init platform
|
||||
BukkitViaInjector injector = new BukkitViaInjector();
|
||||
Via.init(ViaManagerImpl.builder()
|
||||
.platform(this)
|
||||
.commandHandler(commandHandler)
|
||||
.injector(injector)
|
||||
.injector(new BukkitViaInjector())
|
||||
.loader(new BukkitViaLoader(this))
|
||||
.build());
|
||||
|
||||
// Config magic
|
||||
conf = new BukkitViaConfig();
|
||||
conf.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,13 +17,11 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.bukkit.platform;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.configuration.AbstractViaConfig;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class BukkitViaConfig extends AbstractViaConfig {
|
||||
private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers");
|
||||
@ -34,9 +32,8 @@ public class BukkitViaConfig extends AbstractViaConfig {
|
||||
private boolean armorToggleFix;
|
||||
private boolean registerUserConnectionOnJoin;
|
||||
|
||||
public BukkitViaConfig() {
|
||||
super(new File(((Plugin) Via.getPlatform()).getDataFolder(), "config.yml"));
|
||||
reload();
|
||||
public BukkitViaConfig(final File folder) {
|
||||
super(new File(folder, "config.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,6 +80,8 @@ public class BungeePlugin extends Plugin implements ViaServerProxyPlatform<Proxi
|
||||
.loader(new BungeeViaLoader(this))
|
||||
.commandHandler(commandHandler)
|
||||
.build());
|
||||
|
||||
config.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,9 +33,8 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
||||
private boolean bungeePingSave;
|
||||
private Map<String, Integer> bungeeServerProtocols;
|
||||
|
||||
public BungeeViaConfig(File configFile) {
|
||||
super(new File(configFile, "config.yml"));
|
||||
reload();
|
||||
public BungeeViaConfig(File folder) {
|
||||
super(new File(folder, "config.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,8 +26,8 @@ import java.util.Map;
|
||||
|
||||
public final class TestConfig extends AbstractViaConfig {
|
||||
|
||||
public TestConfig(File configFile) {
|
||||
super(configFile);
|
||||
public TestConfig(File file) {
|
||||
super(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,6 +95,7 @@ public class SpongePlugin implements ViaPlatform<Player> {
|
||||
.injector(new SpongeViaInjector())
|
||||
.loader(new SpongeViaLoader(this))
|
||||
.build());
|
||||
conf.reload();
|
||||
}
|
||||
|
||||
@Listener
|
||||
|
@ -28,9 +28,8 @@ public class SpongeViaConfig extends AbstractViaConfig {
|
||||
"bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers",
|
||||
"quick-move-action-fix", "change-1_9-hitbox", "change-1_14-hitbox", "blockconnection-method");
|
||||
|
||||
public SpongeViaConfig(File configFile) {
|
||||
super(new File(configFile, "config.yml"));
|
||||
reload();
|
||||
public SpongeViaConfig(File folder) {
|
||||
super(new File(folder, "config.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,6 +103,7 @@ public class VelocityPlugin implements ViaServerProxyPlatform<Player> {
|
||||
.commandHandler(commandHandler)
|
||||
.loader(new VelocityViaLoader())
|
||||
.injector(new VelocityViaInjector()).build());
|
||||
conf.reload();
|
||||
}
|
||||
|
||||
@Subscribe(order = PostOrder.LAST)
|
||||
|
@ -32,9 +32,8 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
||||
private boolean velocityPingSave;
|
||||
private Map<String, Integer> velocityServerProtocols;
|
||||
|
||||
public VelocityViaConfig(File configFile) {
|
||||
super(new File(configFile, "config.yml"));
|
||||
reload();
|
||||
public VelocityViaConfig(File folder) {
|
||||
super(new File(folder, "config.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user