Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,25 @@ public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ResourcePack)) return false;
ResourcePack that = (ResourcePack) o;
return Objects.equals(uuid, that.uuid) && Objects.equals(getServer(), that.getServer());
return Objects.equals(uuid, that.uuid)
&& Objects.equals(getServer(), that.getServer())
&& sameVersion(packVersion, that.packVersion);
}

@Override
public int hashCode() {
return Objects.hash(uuid, getServer());
return Objects.hash(uuid, getServer(), versionHash(packVersion));
}

private static boolean sameVersion(@Nullable ResourcePackVersion left, @Nullable ResourcePackVersion right) {
if (left == right) return true;
if (left == null || right == null) return false;
return Double.compare(left.min(), right.min()) == 0 && Double.compare(left.max(), right.max()) == 0;
}

private static int versionHash(@Nullable ResourcePackVersion version) {
if (version == null) return 0;
return Objects.hash(version.min(), version.max());
}

@Override
Expand Down