mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-15 10:45:35 +01:00
Add debug setting to print networking errors to log files
This commit is contained in:
parent
41a2139a98
commit
d2b834a058
@ -25,10 +25,12 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
|
||||
import de.florianmichael.viafabricplus.injection.access.IMultiValueDebugSampleLogImpl;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.netty.ViaFabricPlusVLLegacyPipeline;
|
||||
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
|
||||
import io.netty.bootstrap.AbstractBootstrap;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.*;
|
||||
@ -89,6 +91,13 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
channel.pipeline().fireUserEventTriggered(CompressionReorderEvent.INSTANCE);
|
||||
}
|
||||
|
||||
@Inject(method = "exceptionCaught", at = @At("HEAD"))
|
||||
private void printNetworkingErrors(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) {
|
||||
if (DebugSettings.global().printNetworkingErrorsToLogs.getValue()) {
|
||||
ViaFabricPlus.global().getLogger().error("An exception occurred while handling a packet", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setupEncryption", at = @At("HEAD"), cancellable = true)
|
||||
private void storeDecryptionCipher(Cipher decryptionCipher, Cipher encryptionCipher, CallbackInfo ci) {
|
||||
if (this.viaFabricPlus$serverVersion != null /* This happens when opening a lan server and people are joining */ && this.viaFabricPlus$serverVersion.olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
|
||||
|
@ -32,6 +32,7 @@ public class DebugSettings extends SettingGroup {
|
||||
private static final DebugSettings INSTANCE = new DebugSettings();
|
||||
|
||||
public final BooleanSetting queueConfigPackets = new BooleanSetting(this, Text.translatable("debug_settings.viafabricplus.queue_config_packets"), true);
|
||||
public final BooleanSetting printNetworkingErrorsToLogs = new BooleanSetting(this, Text.translatable("debug_settings.viafabricplus.print_networking_errors_to_logs"), true);
|
||||
|
||||
// 1.19 -> 1.18.2
|
||||
public final VersionedBooleanSetting disableSequencing = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.disable_sequencing"), VersionRange.andOlder(ProtocolVersion.v1_18_2));
|
||||
|
@ -62,6 +62,7 @@
|
||||
"debug_settings.viafabricplus.legacy_mining_speeds": "Legacy mining speeds",
|
||||
"debug_settings.viafabricplus.prevent_entity_cramming": "Prevent entity cramming",
|
||||
"debug_settings.viafabricplus.always_tick_client_player": "Always tick client player",
|
||||
"debug_settings.viafabricplus.print_networking_errors_to_logs": "Print networking errors to logs",
|
||||
|
||||
"authentication_settings.viafabricplus.use_beta_craft_authentication": "Use BetaCraft authentication",
|
||||
"authentication_settings.viafabricplus.verify_session_for_online_mode": "Verify session for online mode servers",
|
||||
|
Loading…
Reference in New Issue
Block a user