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

59 lines
1.4 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;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
2014-04-04 20:55:21 +02:00
public class FPlayerLeaveEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private PlayerLeaveReason reason;
FPlayer FPlayer;
Faction Faction;
boolean cancelled = false;
public enum PlayerLeaveReason {
KICKED, DISBAND, RESET, JOINOTHER, LEAVE
}
public FPlayerLeaveEvent(FPlayer p, Faction f, PlayerLeaveReason r) {
2014-07-01 22:10:18 +02:00
FPlayer = p;
Faction = f;
reason = r;
2014-04-04 20:55:21 +02:00
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public PlayerLeaveReason getReason() {
return reason;
}
public FPlayer getFPlayer() {
return FPlayer;
}
public Faction getFaction() {
return Faction;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean c) {
if (reason == PlayerLeaveReason.DISBAND || reason == PlayerLeaveReason.RESET) {
2014-07-01 22:10:18 +02:00
cancelled = false;
return;
}
cancelled = c;
2014-04-04 20:55:21 +02:00
}
}