3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +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) @Translator(packet = ServerTeamPacket.class)
public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> { public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
private final GeyserLogger LOGGER = GeyserConnector.getInstance().getLogger(); private final GeyserLogger logger = GeyserConnector.getInstance().getLogger();
@Override @Override
public void translate(GeyserSession session, ServerTeamPacket packet) { public void translate(GeyserSession session, ServerTeamPacket packet) {
if (LOGGER.isDebug()) { if (logger.isDebug()) {
LOGGER.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers())); 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) { if ((packet.getAction() == TeamAction.ADD_PLAYER || packet.getAction() == TeamAction.REMOVE_PLAYER) && packet.getPlayers().length == 0) {
@ -60,7 +60,8 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
Scoreboard scoreboard = session.getWorldCache().getScoreboard(); Scoreboard scoreboard = session.getWorldCache().getScoreboard();
Team team = scoreboard.getTeam(packet.getTeamName()); Team team = scoreboard.getTeam(packet.getTeamName());
switch (packet.getAction()) { switch (packet.getAction()) {
case CREATE -> scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers()) case CREATE ->
scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers())
.setName(MessageTranslator.convertMessage(packet.getDisplayName())) .setName(MessageTranslator.convertMessage(packet.getDisplayName()))
.setColor(packet.getColor()) .setColor(packet.getColor())
.setNameTagVisibility(packet.getNameTagVisibility()) .setNameTagVisibility(packet.getNameTagVisibility())
@ -68,7 +69,7 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
.setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())); .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale()));
case UPDATE -> { case UPDATE -> {
if (team == null) { if (team == null) {
LOGGER.debug(LanguageUtils.getLocaleStringLog( logger.debug(LanguageUtils.getLocaleStringLog(
"geyser.network.translator.team.failed_not_registered", "geyser.network.translator.team.failed_not_registered",
packet.getAction(), packet.getTeamName() packet.getAction(), packet.getTeamName()
)); ));
@ -84,7 +85,7 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
} }
case ADD_PLAYER -> { case ADD_PLAYER -> {
if (team == null) { if (team == null) {
LOGGER.debug(LanguageUtils.getLocaleStringLog( logger.debug(LanguageUtils.getLocaleStringLog(
"geyser.network.translator.team.failed_not_registered", "geyser.network.translator.team.failed_not_registered",
packet.getAction(), packet.getTeamName() packet.getAction(), packet.getTeamName()
)); ));
@ -94,7 +95,7 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
} }
case REMOVE_PLAYER -> { case REMOVE_PLAYER -> {
if (team == null) { if (team == null) {
LOGGER.debug(LanguageUtils.getLocaleStringLog( logger.debug(LanguageUtils.getLocaleStringLog(
"geyser.network.translator.team.failed_not_registered", "geyser.network.translator.team.failed_not_registered",
packet.getAction(), packet.getTeamName() packet.getAction(), packet.getTeamName()
)); ));

Datei anzeigen

@ -258,6 +258,11 @@ public final class Scoreboard {
addScores.add(score.getCachedInfo()); 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); score.setUpdateType(NOTHING);
} }