From 1db8ff2118d4933bff670fd7123076c52d02dfec Mon Sep 17 00:00:00 2001 From: brenoepic <59066707+brenoepics@users.noreply.github.com> Date: Fri, 29 Apr 2022 18:30:27 -0300 Subject: [PATCH] Fix GuildMember Comparable --- .../habbo/habbohotel/guilds/GuildMember.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMember.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMember.java index 173bed2f..95e0ea80 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMember.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMember.java @@ -3,9 +3,9 @@ package com.eu.habbo.habbohotel.guilds; import java.sql.ResultSet; import java.sql.SQLException; -public class GuildMember implements Comparable { - private int userId; - private String username; +public class GuildMember implements Comparable { + private final int userId; + private final String username; private String look; private int joinDate; private GuildRank rank; @@ -59,10 +59,20 @@ public class GuildMember implements Comparable { } @Override - public int compareTo(Object o) { - return 0; + public int compareTo(GuildMember o) { + return this.userId - o.userId; } + @Override + public boolean equals(Object o) { + if (o instanceof GuildMember) { + return ((GuildMember) o).userId == this.userId && ((GuildMember) o).joinDate == this.joinDate && ((GuildMember) o).rank == this.rank; + } + + return false; + } + + public GuildMembershipStatus getMembershipStatus() { if (this.rank == GuildRank.DELETED) return GuildMembershipStatus.NOT_MEMBER; if (this.rank == GuildRank.OWNER || this.rank == GuildRank.ADMIN || this.rank == GuildRank.MEMBER) return GuildMembershipStatus.MEMBER;