3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 07:40:10 +01:00

Fix player nametags always appearing

Dieser Commit ist enthalten in:
Camotoy 2023-03-17 13:41:13 -04:00
Ursprung acb25b0c99
Commit 147618d5bc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 9 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -33,9 +33,9 @@ import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@Getter
@ -46,7 +46,7 @@ public final class Team {
@Getter(AccessLevel.PACKAGE)
private final Set<String> entities;
@Setter @Nullable private NameTagVisibility nameTagVisibility;
@Nonnull private NameTagVisibility nameTagVisibility = NameTagVisibility.ALWAYS;
@Setter private TeamColor color;
private final TeamData currentData;
@ -189,11 +189,6 @@ public final class Team {
}
public boolean isVisibleFor(String entity) {
if (nameTagVisibility == null) {
// Null - normal behavior
return true;
}
return switch (nameTagVisibility) {
case HIDE_FOR_OTHER_TEAMS -> {
// Player must be in a team in order for HIDE_FOR_OTHER_TEAMS to be triggered
@ -206,8 +201,12 @@ public final class Team {
};
}
public NameTagVisibility getNameTagVisibility() {
return Objects.requireNonNullElse(this.nameTagVisibility, NameTagVisibility.ALWAYS);
public Team setNameTagVisibility(@Nullable NameTagVisibility nameTagVisibility) {
if (nameTagVisibility != null) {
// Null check like this (and this.nameTagVisibility defaults to ALWAYS) as of Java 1.19.4
this.nameTagVisibility = nameTagVisibility;
}
return this;
}
@Override

Datei anzeigen

@ -11,7 +11,7 @@ websocket = "1.5.1"
protocol = "2.9.17-20230217.002312-1"
raknet = "1.6.28-20220125.214016-6"
mcauthlib = "d9d773e"
mcprotocollib = "1.19.4-20230315.153350-3"
mcprotocollib = "1.19.4-20230317.173631-4"
adventure = "4.12.0-20220629.025215-9"
adventure-platform = "4.1.2"
junit = "5.9.2"