Server Translation API

Server Translation API

11.4k Downloads

Disconnection reason show translation key

NikitaCartes opened this issue ยท 0 comments

commented

example

I made small mod that reproduces this bug: https://github.com/NikitaCartes-forks/TranslationBugExample

Basically it's just:

@Mixin(PlayerManager.class)
public abstract class PlayerManagerMixin {

    @Inject(method = "checkCanJoin(Ljava/net/SocketAddress;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/text/Text;", at = @At("HEAD"), cancellable = true)
    private void checkCanJoin(SocketAddress socketAddress, GameProfile profile, CallbackInfoReturnable<Text> cir) {
        Text returnText = translatable("text.bugexample.bugexample");
        cir.setReturnValue(returnText);
    }
}

In logs, however, it works fine:

[01:59:42] [Server thread/INFO] (Minecraft) Disconnecting NikitaCartes (/127.0.0.1:63735): Example text
[01:59:42] [Server thread/INFO] (Minecraft) NikitaCartes (/127.0.0.1:63735) lost connection: Example text

Original issue:
#20