Factions/src/com/massivecraft/factions/event/FactionCreateEvent.java

58 lines
1.6 KiB
Java
Raw Normal View History

2012-03-02 02:16:45 +01:00
package com.massivecraft.factions.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
2013-04-09 13:22:23 +02:00
import com.massivecraft.factions.FPlayerColl;
2013-04-09 12:58:39 +02:00
import com.massivecraft.factions.FactionColl;
2012-03-02 02:16:45 +01:00
public class FactionCreateEvent extends Event implements Cancellable
{
2013-04-10 09:34:14 +02:00
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
2012-03-02 02:16:45 +01:00
private static final HandlerList handlers = new HandlerList();
2013-04-10 09:34:14 +02:00
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
2012-03-02 02:16:45 +01:00
2013-04-10 09:34:14 +02:00
private boolean cancelled;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
// TODO: Could the fields be reorganized to achieve symmetry?
2012-03-02 02:16:45 +01:00
private String factionTag;
2013-04-10 09:34:14 +02:00
public String getFactionTag() { return this.factionTag; }
2012-03-02 02:16:45 +01:00
private Player sender;
public FPlayer getFPlayer()
{
2013-04-09 13:22:23 +02:00
return FPlayerColl.i.get(sender);
}
public String getFactionId()
{
2013-04-09 12:58:39 +02:00
return FactionColl.i.getNextId();
}
2013-04-10 09:34:14 +02:00
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionCreateEvent(Player sender, String tag)
{
2013-04-10 09:34:14 +02:00
this.cancelled = false;
this.factionTag = tag;
this.sender = sender;
}
2012-03-02 02:16:45 +01:00
}