3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 15:50:14 +01:00

A DisplayScoreboard packet should also cause the scoreboard to update

Dieser Commit ist enthalten in:
Tim203 2021-10-20 21:08:25 +02:00
Ursprung 582da8b88a
Commit 6cbbf8a8dd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 064EE9F5BF7C3EE8
4 geänderte Dateien mit 17 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -27,15 +27,27 @@ package org.geysermc.connector.network.translators.java.scoreboard;
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.session.cache.WorldCache;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator;
import org.geysermc.connector.scoreboard.Scoreboard;
import org.geysermc.connector.scoreboard.ScoreboardUpdater;
@Translator(packet = ServerDisplayScoreboardPacket.class)
public class JavaDisplayScoreboardTranslator extends PacketTranslator<ServerDisplayScoreboardPacket> {
@Override
public void translate(GeyserSession session, ServerDisplayScoreboardPacket packet) {
session.getWorldCache().getScoreboard()
.displayObjective(packet.getName(), packet.getPosition());
WorldCache worldCache = session.getWorldCache();
Scoreboard scoreboard = worldCache.getScoreboard();
int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond();
scoreboard.displayObjective(packet.getName(), packet.getPosition());
// ScoreboardUpdater will handle it for us if the packets per second
// (for score and team packets) is higher than the first threshold
if (pps < ScoreboardUpdater.FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) {
scoreboard.onUpdate();
}
}
}

Datei anzeigen

@ -84,7 +84,7 @@ public class JavaScoreboardObjectiveTranslator extends PacketTranslator<ServerSc
}
// ScoreboardUpdater will handle it for us if the packets per second
// (for score and team packets) is higher then the first threshold
// (for score and team packets) is higher than the first threshold
if (pps < ScoreboardUpdater.FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) {
scoreboard.onUpdate();
}

Datei anzeigen

@ -138,7 +138,7 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
}
// ScoreboardUpdater will handle it for us if the packets per second
// (for score and team packets) is higher then the first threshold
// (for score and team packets) is higher than the first threshold
if (pps < ScoreboardUpdater.FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) {
scoreboard.onUpdate();
}

Datei anzeigen

@ -99,7 +99,7 @@ public class JavaUpdateScoreTranslator extends PacketTranslator<ServerUpdateScor
}
// ScoreboardUpdater will handle it for us if the packets per second
// (for score and team packets) is higher then the first threshold
// (for score and team packets) is higher than the first threshold
if (pps < ScoreboardUpdater.FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) {
scoreboard.onUpdate();
}