3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00

Allow platform implementation to define config path (#603)

Dieser Commit ist enthalten in:
EnZaXD 2023-10-08 09:20:01 +02:00 committet von GitHub
Ursprung d46eb8719a
Commit e27930b1d7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
6 geänderte Dateien mit 11 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -27,10 +27,12 @@ import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform { public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
public BukkitPlugin() { public BukkitPlugin() {
Via.getManager().addEnableListener(() -> init(getDataFolder())); Via.getManager().addEnableListener(() -> init(new File(getDataFolder(), "config.yml")));
} }
@Override @Override

Datei anzeigen

@ -20,14 +20,15 @@ package com.viaversion.viabackwards;
import com.viaversion.viabackwards.api.ViaBackwardsPlatform; import com.viaversion.viabackwards.api.ViaBackwardsPlatform;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.MappingDataLoader;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
import java.io.File;
public class BungeePlugin extends Plugin implements ViaBackwardsPlatform { public class BungeePlugin extends Plugin implements ViaBackwardsPlatform {
@Override @Override
public void onLoad() { public void onLoad() {
Via.getManager().addEnableListener(() -> this.init(getDataFolder())); Via.getManager().addEnableListener(() -> this.init(new File(getDataFolder(), "config.yml")));
} }

Datei anzeigen

@ -72,8 +72,8 @@ public interface ViaBackwardsPlatform {
/** /**
* Initialize ViaBackwards. * Initialize ViaBackwards.
*/ */
default void init(File dataFolder) { default void init(final File configFile) {
ViaBackwardsConfig config = new ViaBackwardsConfig(new File(dataFolder, "config.yml")); ViaBackwardsConfig config = new ViaBackwardsConfig(configFile);
config.reload(); config.reload();
Via.getManager().getConfigurationProvider().register(config); Via.getManager().getConfigurationProvider().register(config);

Datei anzeigen

@ -34,7 +34,7 @@ public class ViaFabricAddon implements ViaBackwardsPlatform, Runnable {
public void run() { public void run() {
Path configDirPath = FabricLoader.getInstance().getConfigDir().resolve("ViaBackwards"); Path configDirPath = FabricLoader.getInstance().getConfigDir().resolve("ViaBackwards");
configDir = configDirPath.toFile(); configDir = configDirPath.toFile();
this.init(getDataFolder()); this.init(new File(getDataFolder(), "config.yml"));
} }
@Override @Override

Datei anzeigen

@ -47,7 +47,7 @@ public class SpongePlugin implements ViaBackwardsPlatform {
@Listener @Listener
public void constructPlugin(ConstructPluginEvent event) { public void constructPlugin(ConstructPluginEvent event) {
Via.getManager().addEnableListener(() -> this.init(getDataFolder())); Via.getManager().addEnableListener(() -> this.init(new File(getDataFolder(), "config.yml")));
} }
@Override @Override

Datei anzeigen

@ -52,7 +52,7 @@ public class VelocityPlugin implements ViaBackwardsPlatform {
@Subscribe(order = PostOrder.LATE) @Subscribe(order = PostOrder.LATE)
public void onProxyStart(ProxyInitializeEvent event) { public void onProxyStart(ProxyInitializeEvent event) {
this.logger = new LoggerWrapper(loggerSlf4j); this.logger = new LoggerWrapper(loggerSlf4j);
Via.getManager().addEnableListener(() -> this.init(getDataFolder())); Via.getManager().addEnableListener(() -> this.init(new File(getDataFolder(), "config.yml")));
} }
@Override @Override