Skip to content

How to Get Safe Server Status

Aizistral edited this page Oct 28, 2022 · 5 revisions

This article is for mod and plugin developers. If you are looking for existing methods server admins can use, click here.

As you may or may not know, installed on client side No Chat Reports provides a variety of visual indications that inform the player how "safe" any given server is, in terms of how much it does to protect the players from vanilla's chat reporting system. This includes server safety status displayed in chat screen, as well as "Safe Server" icon for servers that prevent chat reporting.

If you develop your own mod, plugin or other server software that does a noble job of fighting chat reports, you might want servers that use your software to be recognized as safe by No Chat Reports. It is possible to achieve that as of release 1.19.2-v1.11.0.

Add query data

To get the "Safe Server" icon for server in multiplayer menu and "Secure" status in chat screen, you have to add additional property to data that server sends to client as part of ping response. NCR itself does this through the mixin into ServerStatus.Serializer (here and further all names are from official Mojang mappings):

@Mixin(ServerStatus.Serializer.class)
public class MixinServerStatusSerializer {

	@Inject(method = "serialize(Lnet/minecraft/network/protocol/status/ServerStatus;" +
			"Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;",
			at = @At("RETURN"))
	private void onSerialize(ServerStatus serverStatus, Type type, JsonSerializationContext context,
			CallbackInfoReturnable<JsonElement> info) {
		((JsonObject) info.getReturnValue()).addProperty("preventsChatReports", true);
	}

}

You would need to inject the same boolean property with value set true. Whether or not you can do it through the use of Mixin depends on what kind of software you're making. I am no plugin developer myself, so beyond Mixin I cannot recommend a specific approach.

Suppress enforce-secure-profile

As of 1.19, Mojang have added special property to server.properties that forces clients to send only signed messages to the server. In 1.19.1 this property is set to true by default, leading to many unaware server owners leaving it the way it is, even if they go that extra step to install special software to prevent chat reports. As developers of such software it then falls upon us to make sure that option will not be getting in the way of functionality we provide.

No Chat Reports ensures that option will always be false through the mixin into DedicatedServer:

@Mixin(DedicatedServer.class)
public class MixinDedicatedServer {

	@Inject(method = "enforceSecureProfile", at = @At("RETURN"), cancellable = true)
	private void onEnforceSecureProfile(CallbackInfoReturnable<Boolean> cir) {
		cir.setReturnValue(false);
	}

}

Once again, you're looking to achieve something similar, through whatever means available to you. Without this option set to false all clients joining the server will have to send signed messages. Even if the server removes the signatures on its side before relaying chat messages - the player still has to trust that the server is operated in good faith, all the while this requirement of trust can be easily removed. No Chat Reports will always mark servers that demand signed messages as "Unsafe".

Current supporters

Following plugins are known to support safe server status:

Reference implementations

There is an example of implementation for BungeeCord, although it would not be compatible if implemented by multiple plugins: https://github.com/Aizistral-Studios/No-Chat-Reports/discussions/206