Added optimized default values for Via configs

This commit is contained in:
RaphiMC 2023-01-04 22:17:53 +01:00
parent b91b3f3b2b
commit db17ba1bd2
7 changed files with 91 additions and 4 deletions

View file

@ -1,14 +1,13 @@
package net.raphimc.viaproxy.protocolhack;
import net.raphimc.viaprotocolhack.ViaProtocolHack;
import net.raphimc.viaprotocolhack.impl.platform.*;
import net.raphimc.viaproxy.protocolhack.impl.ViaProxyVPLoader;
import net.raphimc.viaproxy.protocolhack.impl.ViaProxyViaVersionPlatformImpl;
import net.raphimc.viaprotocolhack.impl.platform.ViaLegacyPlatformImpl;
import net.raphimc.viaproxy.protocolhack.impl.*;
public class ProtocolHack {
public static void init() {
ViaProtocolHack.init(new ViaProxyViaVersionPlatformImpl(), new ViaProxyVPLoader(), null, null, ViaBackwardsPlatformImpl::new, ViaRewindPlatformImpl::new, ViaLegacyPlatformImpl::new);
ViaProtocolHack.init(new ViaProxyViaVersionPlatformImpl(), new ViaProxyVPLoader(), null, null, ViaProxyViaBackwardsPlatformImpl::new, ViaProxyViaRewindPlatformImpl::new, ViaLegacyPlatformImpl::new);
}
}

View file

@ -0,0 +1,23 @@
package net.raphimc.viaproxy.protocolhack.impl;
import com.viaversion.viabackwards.ViaBackwardsConfig;
import net.raphimc.viaprotocolhack.impl.platform.ViaBackwardsPlatformImpl;
import java.io.File;
import java.net.URL;
public class ViaProxyViaBackwardsPlatformImpl extends ViaBackwardsPlatformImpl {
@Override
public void init(File dataFolder) {
new ViaBackwardsConfig(new File(dataFolder, "config.yml")) {
@Override
public URL getDefaultConfigURL() {
return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viabackwards.yml");
}
}.reloadConfig();
super.init(dataFolder);
}
}

View file

@ -0,0 +1,35 @@
package net.raphimc.viaproxy.protocolhack.impl;
import com.viaversion.viaversion.api.Via;
import de.gerrygames.viarewind.api.ViaRewindConfigImpl;
import de.gerrygames.viarewind.api.ViaRewindPlatform;
import net.raphimc.viaprotocolhack.util.JLoggerToSLF4J;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.net.URL;
import java.util.logging.Logger;
public class ViaProxyViaRewindPlatformImpl implements ViaRewindPlatform {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaRewind"));
public ViaProxyViaRewindPlatformImpl() {
new ViaRewindConfigImpl(new File(Via.getPlatform().getDataFolder(), "viarewind.yml")) {
@Override
public URL getDefaultConfigURL() {
return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viarewind.yml");
}
}.reloadConfig();
final ViaRewindConfigImpl config = new ViaRewindConfigImpl(new File(Via.getPlatform().getDataFolder(), "viarewind.yml"));
config.reloadConfig();
this.init(config);
}
@Override
public Logger getLogger() {
return LOGGER;
}
}

View file

@ -1,8 +1,12 @@
package net.raphimc.viaproxy.protocolhack.impl;
import com.viaversion.viaversion.configuration.AbstractViaConfig;
import net.raphimc.viaprotocolhack.impl.platform.ViaVersionPlatformImpl;
import net.raphimc.viaprotocolhack.impl.viaversion.VPViaConfig;
import net.raphimc.viaproxy.cli.ConsoleFormatter;
import java.io.File;
import java.net.URL;
import java.util.UUID;
public class ViaProxyViaVersionPlatformImpl extends ViaVersionPlatformImpl {
@ -16,4 +20,16 @@ public class ViaProxyViaVersionPlatformImpl extends ViaVersionPlatformImpl {
super.sendMessage(uuid, ConsoleFormatter.convert(msg));
}
@Override
protected AbstractViaConfig createConfig() {
new VPViaConfig(new File(this.getDataFolder(), "viaversion.yml")) {
@Override
public URL getDefaultConfigURL() {
return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viaversion.yml");
}
}.reloadConfig();
return super.createConfig();
}
}

View file

@ -0,0 +1,4 @@
#Overwrite default value
fix-1_13-face-player: true
#Overwrite default value
handle-pings-as-inv-acknowledgements: true

View file

@ -0,0 +1,4 @@
#Overwrite default value
replace-adventure: true
#Overwrite default value
replace-particles: true

View file

@ -0,0 +1,6 @@
#Overwrite default value
1_13-tab-complete-delay: 5
#Overwrite default value
no-delay-shield-blocking: true
#Overwrite default value
chunk-border-fix: true