mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-23 15:26:37 +01:00
parent
9ba6ef51ac
commit
892855415b
4 changed files with 8 additions and 13 deletions
|
@ -155,7 +155,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.GeyserMC</groupId>
|
||||
<artifactId>MCProtocolLib</artifactId>
|
||||
<version>a991afe</version>
|
||||
<version>c247b1f</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
|
|
@ -47,17 +47,16 @@ import com.nukkitx.protocol.bedrock.packet.*;
|
|||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
import org.geysermc.geyser.entity.type.Entity;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.entity.type.Entity;
|
||||
import org.geysermc.geyser.entity.type.LivingEntity;
|
||||
import org.geysermc.geyser.entity.type.living.animal.tameable.ParrotEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
import org.geysermc.geyser.scoreboard.Objective;
|
||||
import org.geysermc.geyser.scoreboard.Score;
|
||||
import org.geysermc.geyser.scoreboard.Team;
|
||||
import org.geysermc.geyser.scoreboard.UpdateType;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
|
@ -352,16 +351,12 @@ public class PlayerEntity extends LivingEntity {
|
|||
if (team != null) {
|
||||
if (team.isVisibleFor(session.getPlayerEntity().getUsername())) {
|
||||
TeamColor color = team.getColor();
|
||||
String chatColor;
|
||||
if (color == TeamColor.NONE) {
|
||||
chatColor = ChatColor.RESET;
|
||||
} else {
|
||||
chatColor = MessageTranslator.toChatColor(color);
|
||||
}
|
||||
String chatColor = MessageTranslator.toChatColor(color);;
|
||||
// We have to emulate what modern Java text already does for us and add the color to each section
|
||||
String prefix = team.getCurrentData().getPrefix();
|
||||
String suffix = team.getCurrentData().getSuffix();
|
||||
newDisplayName = chatColor + prefix + chatColor + this.username + chatColor + suffix;
|
||||
System.out.println(newDisplayName);
|
||||
} else {
|
||||
// The name is not visible to the session player; clear name
|
||||
newDisplayName = "";
|
||||
|
|
|
@ -72,7 +72,7 @@ public class JavaSetPlayerTeamTranslator extends PacketTranslator<ClientboundSet
|
|||
|
||||
if (packet.getPlayers().length != 0) {
|
||||
if ((team.getNameTagVisibility() != NameTagVisibility.ALWAYS && !team.isVisibleFor(session.getPlayerEntity().getUsername()))
|
||||
|| team.getColor() != TeamColor.NONE
|
||||
|| team.getColor() != TeamColor.RESET
|
||||
|| !team.getCurrentData().getPrefix().isEmpty()
|
||||
|| !team.getCurrentData().getSuffix().isEmpty()) {
|
||||
// Something is here that would modify entity names
|
||||
|
|
|
@ -60,7 +60,7 @@ public class MessageTranslator {
|
|||
private static final String RESET = BASE + "r";
|
||||
|
||||
static {
|
||||
TEAM_COLORS.put(TeamColor.NONE, "");
|
||||
TEAM_COLORS.put(TeamColor.RESET, RESET);
|
||||
|
||||
TEAM_COLORS.put(TeamColor.BLACK, BASE + "0");
|
||||
TEAM_COLORS.put(TeamColor.DARK_BLUE, BASE + "1");
|
||||
|
|
Loading…
Reference in a new issue