Skip to content

Commit

Permalink
Fix NPE on Sponge from null sender unique id (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucko committed Feb 23, 2025
1 parent 509aa7a commit d885e27
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,11 @@ public boolean hasPermission(String permission) {
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SpongeCommandSender that = (SpongeCommandSender) o;
return this.getUniqueId().equals(that.getUniqueId());
}

@Override
public int hashCode() {
return getUniqueId().hashCode();
protected Object getObjectForComparison() {
UUID uniqueId = getUniqueId();
if (uniqueId != null) {
return uniqueId;
}
return getName();
}
}

0 comments on commit d885e27

Please sign in to comment.