Fix invite removal

This commit is contained in:
Magnus Ulf Jørgensen 2017-05-28 17:56:37 +02:00
parent 60c9d7fcac
commit f1150d21e3
2 changed files with 9 additions and 2 deletions

View File

@ -10,12 +10,14 @@ import com.massivecraft.factions.entity.Invitation;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.MPlayerColl; import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.store.EntityInternalMap; import com.massivecraft.massivecore.store.EntityInternalMap;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
public class CmdFactionsClean extends FactionsCommand public class CmdFactionsClean extends FactionsCommand
{ {
@ -75,7 +77,12 @@ public class CmdFactionsClean extends FactionsCommand
if (invitations.isEmpty()) continue; if (invitations.isEmpty()) continue;
ret += invitations.size(); ret += invitations.size();
invitations.clear(); Set<String> invitationIds = new MassiveSet<>(invitations.keySet());
for (String inviteId : invitationIds)
{
invitations.detachIdFixed(inviteId);
}
faction.changed(); faction.changed();
} }

View File

@ -459,7 +459,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public boolean uninvite(String playerId) public boolean uninvite(String playerId)
{ {
return this.getInvitations().remove(playerId) != null; return this.getInvitations().detachIdFixed(playerId) != null;
} }
public boolean uninvite(MPlayer mplayer) public boolean uninvite(MPlayer mplayer)