mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-01-08 19:33:58 +01:00
Add property to show scoreboard logs (#3539)
* property to show scoreboard logs * cache system property
This commit is contained in:
parent
bad077de53
commit
3d97188db0
2 changed files with 10 additions and 2 deletions
|
@ -48,6 +48,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||||
import static org.geysermc.geyser.scoreboard.UpdateType.*;
|
import static org.geysermc.geyser.scoreboard.UpdateType.*;
|
||||||
|
|
||||||
public final class Scoreboard {
|
public final class Scoreboard {
|
||||||
|
private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
|
||||||
|
|
||||||
private final GeyserSession session;
|
private final GeyserSession session;
|
||||||
private final GeyserLogger logger;
|
private final GeyserLogger logger;
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -134,7 +136,9 @@ public final class Scoreboard {
|
||||||
public Team registerNewTeam(String teamName, String[] players) {
|
public Team registerNewTeam(String teamName, String[] players) {
|
||||||
Team team = teams.get(teamName);
|
Team team = teams.get(teamName);
|
||||||
if (team != null) {
|
if (team != null) {
|
||||||
|
if (SHOW_SCOREBOARD_LOGS) {
|
||||||
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName));
|
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName));
|
||||||
|
}
|
||||||
return team;
|
return team;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
|
|
||||||
@Translator(packet = ClientboundSetScorePacket.class)
|
@Translator(packet = ClientboundSetScorePacket.class)
|
||||||
public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScorePacket> {
|
public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScorePacket> {
|
||||||
|
private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
|
||||||
|
|
||||||
private final GeyserLogger logger;
|
private final GeyserLogger logger;
|
||||||
|
|
||||||
public JavaSetScoreTranslator() {
|
public JavaSetScoreTranslator() {
|
||||||
|
@ -58,7 +60,9 @@ public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScore
|
||||||
|
|
||||||
Objective objective = scoreboard.getObjective(packet.getObjective());
|
Objective objective = scoreboard.getObjective(packet.getObjective());
|
||||||
if (objective == null && packet.getAction() != ScoreboardAction.REMOVE) {
|
if (objective == null && packet.getAction() != ScoreboardAction.REMOVE) {
|
||||||
|
if (SHOW_SCOREBOARD_LOGS) {
|
||||||
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.score.failed_objective", packet.getObjective()));
|
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.score.failed_objective", packet.getObjective()));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue