Fire FactionsEventDisband when last player leaves faction. Fixes #642.

This commit is contained in:
Olof Larsson 2014-10-21 07:48:42 +02:00
parent 972eace5d2
commit b1c0512b46

View File

@ -17,6 +17,7 @@ import com.massivecraft.factions.Rel;
import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.factions.event.EventFactionsChunksChange;
import com.massivecraft.factions.event.EventFactionsDisband;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
@ -783,17 +784,18 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
if (myFaction.isNormal() && !permanent && myFaction.getMPlayers().isEmpty())
{
// Remove this faction
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
EventFactionsDisband eventFactionsDisband = new EventFactionsDisband(this.getSender(), myFaction);
eventFactionsDisband.run();
if ( ! eventFactionsDisband.isCancelled())
{
mplayer.msg("<i>%s<i> was disbanded.", myFaction.describeTo(mplayer, true));
// Remove this faction
this.msg("%s <i>was disbanded since you were the last player.", myFaction.describeTo(this, true));
if (MConf.get().logFactionDisband)
{
Factions.get().log("The faction "+myFaction.getName()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving.");
}
myFaction.detach();
}
if (MConf.get().logFactionDisband)
{
Factions.get().log("The faction "+myFaction.getName()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving.");
}
myFaction.detach();
}
}