mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix nameTagVisibility nullability
This commit is contained in:
parent
2436b2b1be
commit
720c901535
2 changed files with 12 additions and 2 deletions
|
@ -858,7 +858,6 @@ public final class EntityDefinitions {
|
||||||
{
|
{
|
||||||
EntityDefinition<AbstractHorseEntity> abstractHorseEntityBase = EntityDefinition.inherited(AbstractHorseEntity::new, ageableEntityBase)
|
EntityDefinition<AbstractHorseEntity> abstractHorseEntityBase = EntityDefinition.inherited(AbstractHorseEntity::new, ageableEntityBase)
|
||||||
.addTranslator(MetadataType.BYTE, AbstractHorseEntity::setHorseFlags)
|
.addTranslator(MetadataType.BYTE, AbstractHorseEntity::setHorseFlags)
|
||||||
.addTranslator(null) // UUID of owner
|
|
||||||
.build();
|
.build();
|
||||||
CAMEL = EntityDefinition.inherited(CamelEntity::new, abstractHorseEntityBase)
|
CAMEL = EntityDefinition.inherited(CamelEntity::new, abstractHorseEntityBase)
|
||||||
.type(EntityType.CAMEL)
|
.type(EntityType.CAMEL)
|
||||||
|
|
|
@ -33,7 +33,9 @@ import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -44,7 +46,7 @@ public final class Team {
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private final Set<String> entities;
|
private final Set<String> entities;
|
||||||
@Setter private NameTagVisibility nameTagVisibility;
|
@Setter @Nullable private NameTagVisibility nameTagVisibility;
|
||||||
@Setter private TeamColor color;
|
@Setter private TeamColor color;
|
||||||
|
|
||||||
private final TeamData currentData;
|
private final TeamData currentData;
|
||||||
|
@ -187,6 +189,11 @@ public final class Team {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisibleFor(String entity) {
|
public boolean isVisibleFor(String entity) {
|
||||||
|
if (nameTagVisibility == null) {
|
||||||
|
// Null - normal behavior
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return switch (nameTagVisibility) {
|
return switch (nameTagVisibility) {
|
||||||
case HIDE_FOR_OTHER_TEAMS -> {
|
case HIDE_FOR_OTHER_TEAMS -> {
|
||||||
// Player must be in a team in order for HIDE_FOR_OTHER_TEAMS to be triggered
|
// 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
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id.hashCode();
|
return id.hashCode();
|
||||||
|
|
Loading…
Reference in a new issue