Fix bug with leaving and joining clans: online player list wouldnt update

This commit is contained in:
Shaun Bennett 2015-06-23 23:00:07 -05:00
parent fa612c9c86
commit 2735c81205
2 changed files with 17 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
@ -492,12 +493,24 @@ public class ClanInfo
return players; return players;
} }
protected void playerOnline(Player player) public void playerOnline(Player player)
{ {
_onlinePlayers.add(player.getUniqueId()); _onlinePlayers.add(player.getUniqueId());
} }
protected void playerOffline(Player player) public void playerOnline(String player)
{
Player p = UtilPlayer.searchExact(player);
if (p != null) playerOnline(p);
}
public void playerOffline(String player)
{
Player p = UtilPlayer.searchExact(player);
if (p != null) playerOffline(p);
}
public void playerOffline(Player player)
{ {
_onlinePlayers.remove(player.getUniqueId()); _onlinePlayers.remove(player.getUniqueId());
} }

View File

@ -83,6 +83,7 @@ public class ClansDataAccessLayer
_manager.getClanMemberMap().put(player, clan); _manager.getClanMemberMap().put(player, clan);
clan.getInviteeMap().remove(player); clan.getInviteeMap().remove(player);
clan.getInviterMap().remove(player); clan.getInviterMap().remove(player);
clan.playerOnline(player);
//Save //Save
_repository.addMember(clan.getId(), player, role.toString()); _repository.addMember(clan.getId(), player, role.toString());
@ -99,6 +100,7 @@ public class ClansDataAccessLayer
//Update Clan //Update Clan
clan.getMembers().remove(player); clan.getMembers().remove(player);
_manager.getClanMemberMap().remove(player); _manager.getClanMemberMap().remove(player);
clan.playerOffline(player);
//Save //Save
_repository.removeMember(clan.getId(), player); _repository.removeMember(clan.getId(), player);