2012-03-13 13:58:51 +01:00
|
|
|
package com.massivecraft.factions.event;
|
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.Faction;
|
2012-03-13 13:58:51 +01:00
|
|
|
import org.bukkit.event.Cancellable;
|
|
|
|
|
2014-07-09 21:00:16 +02:00
|
|
|
public class FPlayerLeaveEvent extends FactionPlayerEvent implements Cancellable {
|
|
|
|
|
2019-12-02 19:55:38 +01:00
|
|
|
/**
|
|
|
|
* @author FactionsUUID Team
|
|
|
|
*/
|
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
boolean cancelled = false;
|
|
|
|
private PlayerLeaveReason reason;
|
|
|
|
|
|
|
|
public FPlayerLeaveEvent(FPlayer p, Faction f, PlayerLeaveReason r) {
|
|
|
|
super(f, p);
|
|
|
|
reason = r;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the reason the player left the faction.
|
|
|
|
*
|
|
|
|
* @return reason player left the faction.
|
|
|
|
*/
|
|
|
|
public PlayerLeaveReason getReason() {
|
|
|
|
return reason;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isCancelled() {
|
|
|
|
return cancelled;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setCancelled(boolean c) {
|
|
|
|
// Don't let them cancel factions disbanding.
|
|
|
|
cancelled = reason != PlayerLeaveReason.DISBAND && reason != PlayerLeaveReason.RESET && c;
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum PlayerLeaveReason {
|
|
|
|
KICKED, DISBAND, RESET, JOINOTHER, LEAVE, BANNED
|
|
|
|
}
|
2012-03-13 13:58:51 +01:00
|
|
|
}
|