Skip to content

Commit

Permalink
Update some javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aizistral committed Oct 28, 2024
1 parent f47c08b commit d3dd41d
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,32 @@
import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket;
import net.minecraft.network.protocol.status.ServerStatus;


/**
* This one ensures "preventsChatReports" property is transferred from {@link ServerStatus} to
* {@link ServerData} when handling status response.
* @author fxmorin (original implementation)
* @author Aizistral (current version)
* @author pietro-lopes (fixed https://github.com/Aizistral-Studios/No-Chat-Reports/issues/481)
*/

@Mixin(targets = "net/minecraft/client/multiplayer/ServerStatusPinger$1")
public abstract class MixinServerStatusPinger$1 implements ServerPingerExtension {

/**
* @reason Ensure "preventsChatReports" property is transferred from {@link ServerStatus} to
* {@link ServerData} when handling status response.
* @author fxmorin (original implementation)
* @author Aizistral (current version)
*/

@Unique
private ServerDataExtension nochatreports$serverData;

@Inject(method = "<init>", at = @At("RETURN"))
private void captureServerData(ServerStatusPinger serverStatusPinger, Connection connection, ServerData serverData, Runnable runnable, Runnable runnable2, InetSocketAddress inetSocketAddress, ServerAddress serverAddress, CallbackInfo ci){
nochatreports$serverData = (ServerDataExtension) serverData;
this.nochatreports$serverData = (ServerDataExtension) serverData;
}

@Inject(method = "handleStatusResponse(Lnet/minecraft/network/protocol/status/ClientboundStatusResponsePacket;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/status/ServerStatus;"
+ "description()Lnet/minecraft/network/chat/Component;"))
private void getNoChatReports(ClientboundStatusResponsePacket packet, CallbackInfo info) {
boolean preventsReports = ((ServerDataExtension) (Object) packet.status()).preventsChatReports();
nochatreports$serverData.setPreventsChatReports(preventsReports);
this.nochatreports$serverData.setPreventsChatReports(preventsReports);

if (NCRConfig.getCommon().enableDebugLog()) {
NCRCore.LOGGER.info("Received status response packet from server, preventsChatReports: {}",
Expand Down

0 comments on commit d3dd41d

Please sign in to comment.