Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-04 23:30:17 +01:00
Fix nameTagVisibility nullability
Dieser Commit ist enthalten in:
Ursprung
2436b2b1be
Commit
720c901535
@ -858,7 +858,6 @@ public final class EntityDefinitions {
|
||||
{
|
||||
EntityDefinition<AbstractHorseEntity> abstractHorseEntityBase = EntityDefinition.inherited(AbstractHorseEntity::new, ageableEntityBase)
|
||||
.addTranslator(MetadataType.BYTE, AbstractHorseEntity::setHorseFlags)
|
||||
.addTranslator(null) // UUID of owner
|
||||
.build();
|
||||
CAMEL = EntityDefinition.inherited(CamelEntity::new, abstractHorseEntityBase)
|
||||
.type(EntityType.CAMEL)
|
||||
|
@ -33,7 +33,9 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@ -44,7 +46,7 @@ public final class Team {
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Set<String> entities;
|
||||
@Setter private NameTagVisibility nameTagVisibility;
|
||||
@Setter @Nullable private NameTagVisibility nameTagVisibility;
|
||||
@Setter private TeamColor color;
|
||||
|
||||
private final TeamData currentData;
|
||||
@ -187,6 +189,11 @@ 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
|
||||
@ -199,6 +206,10 @@ public final class Team {
|
||||
};
|
||||
}
|
||||
|
||||
public NameTagVisibility getNameTagVisibility() {
|
||||
return Objects.requireNonNullElse(this.nameTagVisibility, NameTagVisibility.ALWAYS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.hashCode();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren