From dc4ab73f6f4925ca15a69c698aada740841457be Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 24 Dec 2020 21:59:23 +0800 Subject: keep up with main stream (1.1.3-beta) --- src/main/java/com/keuin/blame/data/entry/LogEntry.java | 2 +- src/main/java/com/keuin/blame/util/MinecraftUtil.java | 5 ++++- src/main/java/com/keuin/blame/util/PrintUtil.java | 18 ++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src/main/java/com/keuin/blame') diff --git a/src/main/java/com/keuin/blame/data/entry/LogEntry.java b/src/main/java/com/keuin/blame/data/entry/LogEntry.java index 0ffaf94..04f52ca 100644 --- a/src/main/java/com/keuin/blame/data/entry/LogEntry.java +++ b/src/main/java/com/keuin/blame/data/entry/LogEntry.java @@ -44,7 +44,7 @@ public class LogEntry { public int version = 1; @BsonProperty(GAME_VERSION) - public String gameVersion = MinecraftVersion.field_25319.getName(); + public String gameVersion = (new MinecraftVersion()).getName(); @BsonProperty(TIMESTAMP_MILLIS) public long timeMillis = 0; diff --git a/src/main/java/com/keuin/blame/util/MinecraftUtil.java b/src/main/java/com/keuin/blame/util/MinecraftUtil.java index ce8707e..4cb7e2b 100644 --- a/src/main/java/com/keuin/blame/util/MinecraftUtil.java +++ b/src/main/java/com/keuin/blame/util/MinecraftUtil.java @@ -1,11 +1,14 @@ package com.keuin.blame.util; import net.minecraft.world.World; +import net.minecraft.world.dimension.DimensionType; + +import java.util.Objects; public class MinecraftUtil { public static String worldToString(World world) { - return world.getRegistryKey().getValue().toString(); + return Objects.requireNonNull(DimensionType.getId(world.dimension.getType())).toString(); } } diff --git a/src/main/java/com/keuin/blame/util/PrintUtil.java b/src/main/java/com/keuin/blame/util/PrintUtil.java index 75b73d4..07985f9 100644 --- a/src/main/java/com/keuin/blame/util/PrintUtil.java +++ b/src/main/java/com/keuin/blame/util/PrintUtil.java @@ -2,7 +2,6 @@ package com.keuin.blame.util; import com.mojang.brigadier.context.CommandContext; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.minecraft.network.MessageType; import net.minecraft.server.MinecraftServer; import net.minecraft.server.PlayerManager; import net.minecraft.server.command.ServerCommandSource; @@ -12,19 +11,19 @@ import net.minecraft.util.Formatting; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import static com.keuin.blame.util.UuidUtils.UUID_NULL; - public final class PrintUtil implements ServerLifecycleEvents.ServerStarted { + // version: 1.2 (for 1.15.2) + private static final Object syncMessage = new Object(); private static final Object syncBroadcast = new Object(); - private static final Style broadcastStyle = Style.EMPTY.withColor(Formatting.AQUA); - private static final Style infoStyle = Style.EMPTY.withColor(Formatting.WHITE); - private static final Style stressStyle = Style.EMPTY.withColor(Formatting.AQUA); - private static final Style warnStyle = Style.EMPTY.withColor(Formatting.YELLOW); - private static final Style errorStyle = Style.EMPTY.withColor(Formatting.DARK_RED); + private static final Style broadcastStyle = new Style().setColor(Formatting.AQUA); + private static final Style infoStyle = new Style().setColor(Formatting.WHITE); + private static final Style stressStyle = new Style().setColor(Formatting.AQUA); + private static final Style warnStyle = new Style().setColor(Formatting.YELLOW); + private static final Style errorStyle = new Style().setColor(Formatting.DARK_RED); private static final Logger LOGGER = LogManager.getLogger(); private static final String LOG_HEADING = "[Blame]"; @@ -52,8 +51,7 @@ public final class PrintUtil implements ServerLifecycleEvents.ServerStarted { if (playerManager != null) playerManager.broadcastChatMessage( new LiteralText(message).setStyle(broadcastStyle), - MessageType.SYSTEM, - UUID_NULL + false ); } } -- cgit v1.2.3