Skip to content

Commit

Permalink
Support null uuids? Fixes #1640
Browse files Browse the repository at this point in the history
  • Loading branch information
SamB440 committed Aug 17, 2024
1 parent 2cc3212 commit 39605b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public class PacketEntity extends TypedPacketEntity {

public final TrackedPosition trackedServerPosition;

// TODO in what cases is UUID null in 1.9+?
@Getter
private final UUID uuid; // NULL ON VERSIONS BELOW 1.9
private final UUID uuid; // NULL ON VERSIONS BELOW 1.9 (or for some entities, apparently??)
public PacketEntity riding;
public List<PacketEntity> passengers = new ArrayList<>(0);
public boolean isDead = false;
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/ac/grim/grimac/utils/team/TeamHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.util.Map;
import java.util.Optional;
import java.util.UUID;

public class TeamHandler extends Check implements PacketCheck {

Expand All @@ -34,7 +35,9 @@ public Optional<EntityTeam> getPlayersTeam() {
}

public Optional<EntityTeam> getEntityTeam(PacketEntity entity) {
return Optional.ofNullable(entityToTeam.get(entity.getUuid().toString()));
// TODO in what cases is UUID null in 1.9+?
final UUID uuid = entity.getUuid();
return uuid == null ? Optional.empty() : Optional.ofNullable(entityToTeam.get(uuid.toString()));
}

@Override
Expand Down

0 comments on commit 39605b7

Please sign in to comment.