Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-17 05:20:10 +01:00
Allow platform implementation to define config path (#603)
Dieser Commit ist enthalten in:
Ursprung
d46eb8719a
Commit
e27930b1d7
@ -27,10 +27,12 @@ import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
|
||||
|
||||
public BukkitPlugin() {
|
||||
Via.getManager().addEnableListener(() -> init(getDataFolder()));
|
||||
Via.getManager().addEnableListener(() -> init(new File(getDataFolder(), "config.yml")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,14 +20,15 @@ package com.viaversion.viabackwards;
|
||||
|
||||
import com.viaversion.viabackwards.api.ViaBackwardsPlatform;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class BungeePlugin extends Plugin implements ViaBackwardsPlatform {
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
Via.getManager().addEnableListener(() -> this.init(getDataFolder()));
|
||||
Via.getManager().addEnableListener(() -> this.init(new File(getDataFolder(), "config.yml")));
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,8 +72,8 @@ public interface ViaBackwardsPlatform {
|
||||
/**
|
||||
* Initialize ViaBackwards.
|
||||
*/
|
||||
default void init(File dataFolder) {
|
||||
ViaBackwardsConfig config = new ViaBackwardsConfig(new File(dataFolder, "config.yml"));
|
||||
default void init(final File configFile) {
|
||||
ViaBackwardsConfig config = new ViaBackwardsConfig(configFile);
|
||||
config.reload();
|
||||
Via.getManager().getConfigurationProvider().register(config);
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class ViaFabricAddon implements ViaBackwardsPlatform, Runnable {
|
||||
public void run() {
|
||||
Path configDirPath = FabricLoader.getInstance().getConfigDir().resolve("ViaBackwards");
|
||||
configDir = configDirPath.toFile();
|
||||
this.init(getDataFolder());
|
||||
this.init(new File(getDataFolder(), "config.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +47,7 @@ public class SpongePlugin implements ViaBackwardsPlatform {
|
||||
|
||||
@Listener
|
||||
public void constructPlugin(ConstructPluginEvent event) {
|
||||
Via.getManager().addEnableListener(() -> this.init(getDataFolder()));
|
||||
Via.getManager().addEnableListener(() -> this.init(new File(getDataFolder(), "config.yml")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,7 +52,7 @@ public class VelocityPlugin implements ViaBackwardsPlatform {
|
||||
@Subscribe(order = PostOrder.LATE)
|
||||
public void onProxyStart(ProxyInitializeEvent event) {
|
||||
this.logger = new LoggerWrapper(loggerSlf4j);
|
||||
Via.getManager().addEnableListener(() -> this.init(getDataFolder()));
|
||||
Via.getManager().addEnableListener(() -> this.init(new File(getDataFolder(), "config.yml")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren