3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00
Dieser Commit ist enthalten in:
Tim203 2021-09-30 22:16:15 +02:00
Ursprung 59c34fbcae
Commit 0f81b28630
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 064EE9F5BF7C3EE8
2 geänderte Dateien mit 18 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -43,12 +43,12 @@ import java.util.Arrays;
@Translator(packet = ServerTeamPacket.class)
public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
private final GeyserLogger LOGGER = GeyserConnector.getInstance().getLogger();
private final GeyserLogger logger = GeyserConnector.getInstance().getLogger();
@Override
public void translate(GeyserSession session, ServerTeamPacket packet) {
if (LOGGER.isDebug()) {
LOGGER.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers()));
if (logger.isDebug()) {
logger.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers()));
}
if ((packet.getAction() == TeamAction.ADD_PLAYER || packet.getAction() == TeamAction.REMOVE_PLAYER) && packet.getPlayers().length == 0) {
@ -60,15 +60,16 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
Scoreboard scoreboard = session.getWorldCache().getScoreboard();
Team team = scoreboard.getTeam(packet.getTeamName());
switch (packet.getAction()) {
case CREATE -> scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers())
.setName(MessageTranslator.convertMessage(packet.getDisplayName()))
.setColor(packet.getColor())
.setNameTagVisibility(packet.getNameTagVisibility())
.setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale()))
.setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale()));
case CREATE ->
scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers())
.setName(MessageTranslator.convertMessage(packet.getDisplayName()))
.setColor(packet.getColor())
.setNameTagVisibility(packet.getNameTagVisibility())
.setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale()))
.setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale()));
case UPDATE -> {
if (team == null) {
LOGGER.debug(LanguageUtils.getLocaleStringLog(
logger.debug(LanguageUtils.getLocaleStringLog(
"geyser.network.translator.team.failed_not_registered",
packet.getAction(), packet.getTeamName()
));
@ -84,7 +85,7 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
}
case ADD_PLAYER -> {
if (team == null) {
LOGGER.debug(LanguageUtils.getLocaleStringLog(
logger.debug(LanguageUtils.getLocaleStringLog(
"geyser.network.translator.team.failed_not_registered",
packet.getAction(), packet.getTeamName()
));
@ -94,7 +95,7 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
}
case REMOVE_PLAYER -> {
if (team == null) {
LOGGER.debug(LanguageUtils.getLocaleStringLog(
logger.debug(LanguageUtils.getLocaleStringLog(
"geyser.network.translator.team.failed_not_registered",
packet.getAction(), packet.getTeamName()
));

Datei anzeigen

@ -258,6 +258,11 @@ public final class Scoreboard {
addScores.add(score.getCachedInfo());
}
// we need this as long as MCPE-143063 hasn't been fixed
if (add && score.getUpdateType() != ADD && !objectiveUpdate) {
removeScores.add(score.getCachedInfo());
}
score.setUpdateType(NOTHING);
}