Skip to content

Instantly share code, notes, and snippets.

@brcdev
Last active January 20, 2017 23:17
Show Gist options
  • Save brcdev/f3e1dbd13c34ab3616e0bcdf54cc68ba to your computer and use it in GitHub Desktop.
Save brcdev/f3e1dbd13c34ab3616e0bcdf54cc68ba to your computer and use it in GitHub Desktop.
package net.brcdev.gangs.event;
import net.brcdev.gangs.gang.Gang;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called when a player leaves a gang
*/
public class PlayerLeaveGangEvent extends Event implements Cancellable {
public enum LeaveReason {
DISBANDED, DISBANDED_LEADER, KICKED, LEFT
}
private static final HandlerList handlers = new HandlerList();
private Player player;
private Player kickedBy;
private Gang gang;
private LeaveReason leaveReason;
private boolean cancelled;
public PlayerLeaveGangEvent(Player player, Player kickedBy, Gang gang, LeaveReason leaveReason) {
this.player = player;
this.kickedBy = kickedBy;
this.gang = gang;
this.leaveReason = leaveReason;
}
/**
* Gets the player who left a gang
*
* @return Player Player who left a gang
*/
public Player getPlayer() {
return player;
}
/**
* Gets the player who kicked or null when left
*
* @return Player Player who kicked or null when left
*/
public Player getKickedBy() {
return kickedBy;
}
/**
* Gets the gang which was left
*
* @return Gang Gang which was left
*/
public Gang getGang() {
return gang;
}
/**
* Gets the reason the gang was left
*
* @return LeaveReason Reason the gang was left
* @see LeaveReason
*/
public LeaveReason getLeaveReason() {
return leaveReason;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment