RealmsNews .java

com.mojang.realmsclient.dto.RealmsNews (record): members: newsLink, parse, LOGGER. strings: "Could not parse RealmsNews", "newsLink". imports: JsonUtils.

com.mojang.realmsclient.dtorecord30 linescommon839 B

API Surface (2)

record RealmsNews(@Nullable URI newsLink)
RealmsNews parse(final String json)

Fields & Constants (1)

LOGGER

String literals (2)

"newsLink"
"Could not parse RealmsNews"

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

RealmsNews.java30 lines · Minecraft 26.3 · verbatim
1
package com.mojang.realmsclient.dto;
2
3
import com.google.gson.JsonObject;
4
import com.mojang.logging.LogUtils;
5
import com.mojang.realmsclient.util.JsonUtils;
6
import java.net.URI;
7
import net.fabricmc.api.EnvType;
8
import net.fabricmc.api.Environment;
9
import net.minecraft.util.LenientJsonParser;
10
import org.jspecify.annotations.Nullable;
11
import org.slf4j.Logger;
12
13
@Environment(EnvType.CLIENT)
14
public record RealmsNews(@Nullable URI newsLink) {
15
	private static final Logger LOGGER = LogUtils.getLogger();
16
17
	public static RealmsNews parse(final String json) {
18
		URI newsLink = null;
19
20
		try {
21
			JsonObject object = LenientJsonParser.parse(json).getAsJsonObject();
22
			newsLink = JsonUtils.getUriNullable("newsLink", object);
23
		} catch (Exception e) {
24
			LOGGER.error("Could not parse RealmsNews", e);
25
		}
26
27
		return new RealmsNews(newsLink);
28
	}
29
}
30

Decompiled Minecraft 26.3 source of RealmsNews (com/mojang/realmsclient/dto/RealmsNews.java) with Mojang official mappings, stored verbatim on the site.