Fire FactionsEventDisband when last player leaves faction. Fixes #642.
This commit is contained in:
parent
972eace5d2
commit
b1c0512b46
@ -17,6 +17,7 @@ import com.massivecraft.factions.Rel;
|
|||||||
import com.massivecraft.factions.RelationParticipator;
|
import com.massivecraft.factions.RelationParticipator;
|
||||||
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
|
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
|
||||||
import com.massivecraft.factions.event.EventFactionsChunksChange;
|
import com.massivecraft.factions.event.EventFactionsChunksChange;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsDisband;
|
||||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||||
import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis;
|
import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis;
|
||||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||||
@ -783,12 +784,12 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
if (myFaction.isNormal() && !permanent && myFaction.getMPlayers().isEmpty())
|
if (myFaction.isNormal() && !permanent && myFaction.getMPlayers().isEmpty())
|
||||||
{
|
{
|
||||||
// Remove this faction
|
EventFactionsDisband eventFactionsDisband = new EventFactionsDisband(this.getSender(), myFaction);
|
||||||
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
|
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)
|
if (MConf.get().logFactionDisband)
|
||||||
{
|
{
|
||||||
Factions.get().log("The faction "+myFaction.getName()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving.");
|
Factions.get().log("The faction "+myFaction.getName()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving.");
|
||||||
@ -796,6 +797,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
myFaction.detach();
|
myFaction.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NEW
|
// NEW
|
||||||
public boolean tryClaim(Faction newFaction, Collection<PS> pss)
|
public boolean tryClaim(Faction newFaction, Collection<PS> pss)
|
||||||
|
Loading…
Reference in New Issue
Block a user