Ignore expired player public keys during replay

These would otherwise fail to be initialized and cause the game to disconnect
itself on the first chat message from the corresponding player.
This commit is contained in:
Jonas Herzig
2022-08-10 14:09:23 +02:00
parent 06f1e0c36c
commit cce65ec76d
3 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1 @@
// 1.19+ only

View File

@@ -10,6 +10,9 @@
"world_border.Mixin_UseReplayTime_ForMovement", "world_border.Mixin_UseReplayTime_ForMovement",
"world_border.Mixin_UseReplayTime_ForTexture", "world_border.Mixin_UseReplayTime_ForTexture",
"Mixin_FixNPCSkinCaching", "Mixin_FixNPCSkinCaching",
//#if MC>=11900
//$$ "Mixin_AllowExpiredPlayerKeys",
//#endif
//#if MC>=11800 //#if MC>=11800
//$$ "Mixin_FixEntityNotTracking", //$$ "Mixin_FixEntityNotTracking",
//#endif //#endif

View File

@@ -0,0 +1,18 @@
package com.replaymod.replay.mixin;
import com.replaymod.replay.ReplayModReplay;
import net.minecraft.network.encryption.PlayerPublicKey;
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.CallbackInfoReturnable;
@Mixin(PlayerPublicKey.PublicKeyData.class)
public abstract class Mixin_AllowExpiredPlayerKeys {
@Inject(method = "isExpired", at = @At("HEAD"), cancellable = true)
private void neverExpireWhenInReplay(CallbackInfoReturnable<Boolean> ci) {
if (ReplayModReplay.instance.getReplayHandler() != null) {
ci.setReturnValue(false);
}
}
}