Skip to content

Commit ea95d78

Browse files
author
tonimatasdev
committed
Fix problem with Java VM
1 parent 76f735f commit ea95d78

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

common/src/main/java/dev/tonimatas/packetfixer/mixins/Varint21FrameDecoderMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.spongepowered.asm.mixin.injection.Constant;
77
import org.spongepowered.asm.mixin.injection.ModifyConstant;
88

9-
@Mixin(Varint21FrameDecoder.class)
9+
@Mixin(value = Varint21FrameDecoder.class, priority = 1001)
1010
public abstract class Varint21FrameDecoderMixin {
1111
@ModifyConstant(method = "decode", constant = @Constant(intValue = 3))
1212
private int newSize(int value) {

common/src/main/java/dev/tonimatas/packetfixer/mixins/Varint21LengthFieldPrependerMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.spongepowered.asm.mixin.injection.Constant;
77
import org.spongepowered.asm.mixin.injection.ModifyConstant;
88

9-
@Mixin(Varint21LengthFieldPrepender.class)
9+
@Mixin(value = Varint21LengthFieldPrepender.class, priority = 1001)
1010
public class Varint21LengthFieldPrependerMixin {
1111
@ModifyConstant(method = "encode(Lio/netty/channel/ChannelHandlerContext;Lio/netty/buffer/ByteBuf;Lio/netty/buffer/ByteBuf;)V", constant = @Constant(intValue = 3))
1212
private int newSize(int value) {

common/src/main/java/dev/tonimatas/packetfixer/util/Config.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ public static int getDecoderSize() {
7575

7676
public static int getVarInt21Size() {
7777
if (properties == null) runProperties();
78-
return getUnlimitedPacketSize() ? Integer.MAX_VALUE : Integer.parseInt(properties.getProperty("varInt21"));
78+
return getUnlimitedPacketSize() ? (Integer.MAX_VALUE / 2 - 1) : Integer.parseInt(properties.getProperty("varInt21"));
7979
}
8080

8181
public static int getVarIntSize() {
8282
if (properties == null) runProperties();
83-
return getUnlimitedPacketSize() ? Integer.MAX_VALUE : Integer.parseInt(properties.getProperty("varInt"));
83+
return getUnlimitedPacketSize() ? (Integer.MAX_VALUE / 2 - 1) : Integer.parseInt(properties.getProperty("varInt"));
8484
}
8585

8686
public static int getVarLong() {
8787
if (properties == null) runProperties();
88-
return getUnlimitedPacketSize() ? Integer.MAX_VALUE : Integer.parseInt(properties.getProperty("varLong"));
88+
return getUnlimitedPacketSize() ? (Integer.MAX_VALUE / 2 - 1) : Integer.parseInt(properties.getProperty("varLong"));
8989
}
9090

9191
public static int getChunkPacketData() {

0 commit comments

Comments
 (0)