From f1150d21e346c7ab5ba630f0aed92c5dcbbf8ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Ulf=20J=C3=B8rgensen?= Date: Sun, 28 May 2017 17:56:37 +0200 Subject: [PATCH] Fix invite removal --- src/com/massivecraft/factions/cmd/CmdFactionsClean.java | 9 ++++++++- src/com/massivecraft/factions/entity/Faction.java | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsClean.java b/src/com/massivecraft/factions/cmd/CmdFactionsClean.java index e06544ba..087ce8aa 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsClean.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsClean.java @@ -10,12 +10,14 @@ import com.massivecraft.factions.entity.Invitation; import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayerColl; import com.massivecraft.massivecore.MassiveException; +import com.massivecraft.massivecore.collections.MassiveSet; import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.store.EntityInternalMap; import com.massivecraft.massivecore.util.Txt; import java.util.Iterator; import java.util.Map.Entry; +import java.util.Set; public class CmdFactionsClean extends FactionsCommand { @@ -75,7 +77,12 @@ public class CmdFactionsClean extends FactionsCommand if (invitations.isEmpty()) continue; ret += invitations.size(); - invitations.clear(); + Set invitationIds = new MassiveSet<>(invitations.keySet()); + for (String inviteId : invitationIds) + { + invitations.detachIdFixed(inviteId); + } + faction.changed(); } diff --git a/src/com/massivecraft/factions/entity/Faction.java b/src/com/massivecraft/factions/entity/Faction.java index 17b0ed59..dbd11975 100644 --- a/src/com/massivecraft/factions/entity/Faction.java +++ b/src/com/massivecraft/factions/entity/Faction.java @@ -459,7 +459,7 @@ public class Faction extends Entity implements FactionsParticipator public boolean uninvite(String playerId) { - return this.getInvitations().remove(playerId) != null; + return this.getInvitations().detachIdFixed(playerId) != null; } public boolean uninvite(MPlayer mplayer)