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:
Ursprung
d46eb8719a
Commit
e27930b1d7
@ -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
|
||||||
|
@ -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")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren