2012-03-02 02:16:45 +01:00
|
|
|
package com.massivecraft.factions.event;
|
|
|
|
|
2013-04-19 12:27:39 +02:00
|
|
|
import org.bukkit.command.CommandSender;
|
2012-03-02 02:16:45 +01:00
|
|
|
import org.bukkit.event.HandlerList;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.Faction;
|
|
|
|
|
2013-04-19 12:27:39 +02:00
|
|
|
public class FactionsEventLeave extends FactionsEventAbstractSender
|
2012-03-02 02:16:45 +01:00
|
|
|
{
|
2013-04-10 09:34:14 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// REQUIRED EVENT CODE
|
|
|
|
// -------------------------------------------- //
|
2012-03-02 02:16:45 +01:00
|
|
|
|
2013-04-10 09:34:14 +02:00
|
|
|
private static final HandlerList handlers = new HandlerList();
|
|
|
|
@Override public HandlerList getHandlers() { return handlers; }
|
|
|
|
public static HandlerList getHandlerList() { return handlers; }
|
2012-03-02 02:16:45 +01:00
|
|
|
|
2013-04-10 09:34:14 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// FIELDS
|
|
|
|
// -------------------------------------------- //
|
2012-03-02 02:16:45 +01:00
|
|
|
|
|
|
|
@Override
|
2013-04-19 12:27:39 +02:00
|
|
|
public void setCancelled(boolean cancelled)
|
2012-03-02 02:16:45 +01:00
|
|
|
{
|
2013-04-19 12:27:39 +02:00
|
|
|
if (this.reason == PlayerLeaveReason.DISBAND || this.reason == PlayerLeaveReason.RESET)
|
2012-03-02 02:16:45 +01:00
|
|
|
{
|
|
|
|
cancelled = false;
|
|
|
|
}
|
2013-04-19 12:27:39 +02:00
|
|
|
super.setCancelled(cancelled);
|
2012-03-02 02:16:45 +01:00
|
|
|
}
|
2013-04-10 09:34:14 +02:00
|
|
|
|
|
|
|
private final FPlayer fplayer;
|
|
|
|
public FPlayer getFPlayer() { return this.fplayer; }
|
|
|
|
|
|
|
|
private final Faction faction;
|
|
|
|
public Faction getFaction() { return this.faction; }
|
2013-04-19 12:27:39 +02:00
|
|
|
|
|
|
|
private final PlayerLeaveReason reason;
|
|
|
|
public PlayerLeaveReason getReason() { return this.reason; }
|
2013-04-10 09:34:14 +02:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-19 12:27:39 +02:00
|
|
|
public FactionsEventLeave(CommandSender sender, FPlayer fplayer, Faction faction, PlayerLeaveReason reason)
|
2013-04-10 09:34:14 +02:00
|
|
|
{
|
2013-04-19 12:27:39 +02:00
|
|
|
super(sender);
|
2013-04-10 09:34:14 +02:00
|
|
|
this.fplayer = fplayer;
|
|
|
|
this.faction = faction;
|
|
|
|
this.reason = reason;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// INTERNAL ENUM
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
public enum PlayerLeaveReason
|
|
|
|
{
|
|
|
|
KICKED, DISBAND, RESET, JOINOTHER, LEAVE
|
|
|
|
}
|
|
|
|
|
2012-03-02 02:16:45 +01:00
|
|
|
}
|