mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fixed GeyserMC/Geyser#2556
This commit is contained in:
parent
59c34fbcae
commit
0f81b28630
2 changed files with 18 additions and 12 deletions
|
@ -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,15 +60,16 @@ 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 ->
|
||||||
.setName(MessageTranslator.convertMessage(packet.getDisplayName()))
|
scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers())
|
||||||
.setColor(packet.getColor())
|
.setName(MessageTranslator.convertMessage(packet.getDisplayName()))
|
||||||
.setNameTagVisibility(packet.getNameTagVisibility())
|
.setColor(packet.getColor())
|
||||||
.setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale()))
|
.setNameTagVisibility(packet.getNameTagVisibility())
|
||||||
.setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale()));
|
.setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), 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()
|
||||||
));
|
));
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue