From faf663d3cd235d129dadf86bdab2e18ec2acedb2 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Thu, 31 Oct 2024 09:30:01 +0100 Subject: [PATCH] Check if objective is null and made scoreboard errors player-specific --- .../org/geysermc/geyser/scoreboard/Scoreboard.java | 2 +- .../java/scoreboard/JavaResetScorePacket.java | 14 ++++++++++++++ .../java/scoreboard/JavaSetScoreTranslator.java | 11 ++++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java index 6e0867ddc..3d3bfb48d 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java @@ -178,7 +178,7 @@ public final class Scoreboard { Team team = teams.get(teamName); if (team != null) { if (SHOW_SCOREBOARD_LOGS) { - logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName)); + logger.info("Ignoring team %s for %s. It overrides without removing old team.".formatted(teamName, session.javaUsername())); } return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaResetScorePacket.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaResetScorePacket.java index cf688bbfd..72dcd4062 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaResetScorePacket.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaResetScorePacket.java @@ -25,6 +25,8 @@ package org.geysermc.geyser.translator.protocol.java.scoreboard; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.scoreboard.Objective; import org.geysermc.geyser.scoreboard.Scoreboard; import org.geysermc.geyser.scoreboard.ScoreboardUpdater; @@ -36,6 +38,10 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.scoreboard. @Translator(packet = ClientboundResetScorePacket.class) public class JavaResetScorePacket extends PacketTranslator { + private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true")); + + private final GeyserLogger logger = GeyserImpl.getInstance().getLogger(); + @Override public void translate(GeyserSession session, ClientboundResetScorePacket packet) { WorldCache worldCache = session.getWorldCache(); @@ -47,6 +53,14 @@ public class JavaResetScorePacket extends PacketTranslator { private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true")); - private final GeyserLogger logger; - - public JavaSetScoreTranslator() { - logger = GeyserImpl.getInstance().getLogger(); - } + private final GeyserLogger logger = GeyserImpl.getInstance().getLogger(); @Override public void translate(GeyserSession session, ClientboundSetScorePacket packet) { @@ -56,7 +51,9 @@ public class JavaSetScoreTranslator extends PacketTranslator