mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2025-04-22 11:03:26 -04:00
Added config option to skip VV config state packet queue
Fixes join issues on <= 1.20.1 fabric/quilt servers
This commit is contained in:
parent
fd78b24b6d
commit
45dcdfdc98
2 changed files with 62 additions and 0 deletions
src/main/java/net/raphimc/viaproxy
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
|
||||
* Copyright (C) 2021-2025 RK_01/RaphiMC and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.raphimc.viaproxy.injection.mixins;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.protocols.v1_19_3to1_19_4.packet.ServerboundPackets1_19_4;
|
||||
import com.viaversion.viaversion.protocols.v1_20to1_20_2.Protocol1_20To1_20_2;
|
||||
import com.viaversion.viaversion.protocols.v1_20to1_20_2.packet.ServerboundPackets1_20_2;
|
||||
import net.raphimc.viaproxy.ViaProxy;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(value = Protocol1_20To1_20_2.class, remap = false)
|
||||
public abstract class MixinProtocol1_20To1_20_2 {
|
||||
|
||||
@Inject(method = "lambda$queueServerboundPacket$12", at = @At("HEAD"), cancellable = true)
|
||||
private static void dontQueueConfigPackets(ServerboundPackets1_20_2 packetType, PacketWrapper wrapper, CallbackInfo ci) {
|
||||
if (ViaProxy.getConfig().shouldSkipConfigStatePacketQueue()) {
|
||||
ci.cancel();
|
||||
switch (packetType) {
|
||||
case CUSTOM_PAYLOAD -> wrapper.setPacketType(ServerboundPackets1_19_4.CUSTOM_PAYLOAD);
|
||||
case KEEP_ALIVE -> wrapper.setPacketType(ServerboundPackets1_19_4.KEEP_ALIVE);
|
||||
case PONG -> wrapper.setPacketType(ServerboundPackets1_19_4.PONG);
|
||||
default -> throw new IllegalStateException("Unexpected packet type: " + packetType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -190,6 +190,13 @@ public class ViaProxyConfig {
|
|||
})
|
||||
private boolean workAroundConfigStatePacketQueue = false;
|
||||
|
||||
@Option("skip-config-state-packet-queue")
|
||||
@Description({
|
||||
"Fixes potential join issues on <= 1.20.1 quilt/fabric servers.",
|
||||
"It's recommended to only enable this if you are experiencing issues with the config state packet queue (See above issue)."
|
||||
})
|
||||
private boolean skipConfigStatePacketQueue = false;
|
||||
|
||||
@Option("send-connection-details")
|
||||
@Description({
|
||||
"If enabled, ViaProxy will send a connection details custom payload packet to the server.",
|
||||
|
@ -501,6 +508,15 @@ public class ViaProxyConfig {
|
|||
this.save();
|
||||
}
|
||||
|
||||
public boolean shouldSkipConfigStatePacketQueue() {
|
||||
return this.skipConfigStatePacketQueue;
|
||||
}
|
||||
|
||||
public void setSkipConfigStatePacketQueue(final boolean skipConfigStatePacketQueue) {
|
||||
this.skipConfigStatePacketQueue = skipConfigStatePacketQueue;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public boolean shouldSendConnectionDetails() {
|
||||
return this.sendConnectionDetails;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue