Saber-Factions/src/main/java/com/massivecraft/factions/event/FPlayerLeaveEvent.java

44 lines
1.1 KiB
Java
Raw Normal View History

package com.massivecraft.factions.event;
2014-04-04 20:55:21 +02:00
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import org.bukkit.event.Cancellable;
public class FPlayerLeaveEvent extends FactionPlayerEvent implements Cancellable {
2019-12-02 19:55:38 +01:00
/**
* @author FactionsUUID Team
*/
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
}
}