Major messaround with the internal events and payForCommand logic. Not done just yet though.

This commit is contained in:
Olof Larsson
2013-04-19 12:27:39 +02:00
parent d3488311de
commit 61baf70ed1
46 changed files with 638 additions and 626 deletions

View File

@ -1,68 +0,0 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FactionColl;
public class FactionDisbandEvent extends Event implements Cancellable
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
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?
private String id;
private CommandSender sender;
public Faction getFaction()
{
return FactionColl.get().get(id);
}
public FPlayer getFPlayer()
{
return FPlayer.get(sender);
}
public CommandSender getPlayer()
{
return this.sender;
}
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionDisbandEvent(CommandSender sender, String factionId)
{
this.cancelled = false;
this.sender = sender;
this.id = factionId;
}
// -------------------------------------------- //
// ASSORTED
// -------------------------------------------- //
}

View File

@ -1,60 +0,0 @@
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;
import com.massivecraft.factions.Faction;
public class FactionRenameEvent extends Event implements Cancellable
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private boolean cancelled;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
private final FPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
private String tag;
// TODO: fix these
public Player getPlayer() { return this.fplayer.getPlayer(); }
public String getOldFactionTag() { return this.faction.getTag(); }
public String getFactionTag() { return this.tag; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionRenameEvent(FPlayer sender, String newTag)
{
this.cancelled = false;
this.fplayer = sender;
this.faction = sender.getFaction(); // TODO: Players can only rename their own faction? A field and constructor rewrite is probably pending for this class...
this.tag = newTag;
}
}

View File

@ -0,0 +1,8 @@
package com.massivecraft.factions.event;
import com.massivecraft.mcore.event.MCoreEvent;
public abstract class FactionsEventAbstract extends MCoreEvent
{
}

View File

@ -0,0 +1,26 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.mcore.event.MCoreEvent;
public abstract class FactionsEventAbstractSender extends MCoreEvent
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final CommandSender sender;
public CommandSender getSender() { return this.sender; }
public FPlayer getFSender() { return FPlayer.get(this.sender); }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsEventAbstractSender(CommandSender sender)
{
this.sender = sender;
}
}

View File

@ -1,11 +1,9 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class FactionCreateEvent extends Event implements Cancellable
public class FactionsEventCreate extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
@ -18,13 +16,6 @@ public class FactionCreateEvent extends Event implements Cancellable
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private boolean cancelled = false;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
private final CommandSender sender;
public CommandSender getSender() { return this.sender; }
// TODO: How do we know what universe? Should we perhaps actually create the faction?
@ -38,9 +29,9 @@ public class FactionCreateEvent extends Event implements Cancellable
// CONSTRUCT
// -------------------------------------------- //
public FactionCreateEvent(CommandSender sender, String factionTag, String factionId)
public FactionsEventCreate(CommandSender sender, String factionTag, String factionId)
{
this.sender = sender;
super(sender);
this.factionTag = factionTag;
this.factionId = factionId;
}

View File

@ -0,0 +1,40 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
public class FactionsEventDescriptionChange extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
private String newDescription;
public String getNewDescription() { return this.newDescription; }
public void setNewDescription(String newDescription) { this.newDescription = newDescription; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsEventDescriptionChange(CommandSender sender, Faction faction, String newDescription)
{
super(sender);
this.faction = faction;
this.newDescription = newDescription;
}
}

View File

@ -0,0 +1,46 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
public class FactionsEventDisband extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final String factionId;
public String getFactionId() { return this.factionId; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsEventDisband(CommandSender sender, Faction faction)
{
super(sender);
this.faction = faction;
this.factionId = faction.getId();
}
// -------------------------------------------- //
// ASSORTED
// -------------------------------------------- //
}

View File

@ -4,19 +4,10 @@ import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.mcore.event.MCoreCancellableEvent;
import com.massivecraft.mcore.ps.PS;
public class FactionsHomeChangeEvent extends MCoreCancellableEvent
{
// -------------------------------------------- //
// CONSTANTS
// -------------------------------------------- //
public final static String REASON_COMMAND_SETHOME = "FACTIONS_COMMAND_SETHOME";
public final static String REASON_VERIFY_FAILED = "FACTIONS_VERIFY_FAILED";
public final static String REASON_UNDEFINED = "FACTIONS_UNDEFINED";
public class FactionsEventHomeChange extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
@ -29,12 +20,6 @@ public class FactionsHomeChangeEvent extends MCoreCancellableEvent
// FIELDS
// -------------------------------------------- //
private final CommandSender sender;
public CommandSender getSender() { return this.sender; }
private final String reason;
public String getReason() { return this.reason; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
@ -46,10 +31,9 @@ public class FactionsHomeChangeEvent extends MCoreCancellableEvent
// CONSTRUCT
// -------------------------------------------- //
public FactionsHomeChangeEvent(CommandSender sender, String reason, Faction faction, PS newHome)
public FactionsEventHomeChange(CommandSender sender, Faction faction, PS newHome)
{
this.sender = sender;
this.reason = reason;
super(sender);
this.faction = faction;
this.newHome = newHome;
}

View File

@ -1,14 +1,13 @@
package com.massivecraft.factions.event;
import org.bukkit.event.Event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import org.bukkit.entity.Player;
import com.massivecraft.factions.Faction;
public class LandUnclaimAllEvent extends Event
{
public class FactionsEventInvitedChange extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
@ -16,30 +15,31 @@ public class LandUnclaimAllEvent extends Event
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final FPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; }
// TODO: These methods seem redundant? Why were they added? Can I remove them?
public String getFactionId() { return this.faction.getId(); }
public String getFactionTag() { return this.faction.getTag(); }
public Player getPlayer() { return this.fplayer.getPlayer(); }
private final Faction faction;
public Faction getFaction() { return this.faction; }
private boolean newInvited;
public boolean isNewInvited() { return this.newInvited; }
public void setNewInvited(boolean newInvited) { this.newInvited = newInvited; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public LandUnclaimAllEvent(Faction faction, FPlayer fplayer)
public FactionsEventInvitedChange(CommandSender sender, FPlayer fplayer, Faction faction, boolean newInvited)
{
this.faction = faction;
super(sender);
this.fplayer = fplayer;
this.faction = faction;
this.newInvited = newInvited;
}
}
}

View File

@ -1,13 +1,12 @@
package com.massivecraft.factions.event;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
public class FPlayerJoinEvent extends Event implements Cancellable
public class FactionsEventJoin extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
@ -21,37 +20,26 @@ public class FPlayerJoinEvent extends Event implements Cancellable
// FIELDS
// -------------------------------------------- //
private FPlayer fplayer;
private Faction faction;
private PlayerJoinReason reason;
private final FPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; }
private boolean cancelled = false;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final PlayerJoinReason reason;
public PlayerJoinReason getReason() { return reason; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FPlayerJoinEvent(FPlayer fplayer, Faction faction, PlayerJoinReason reason)
public FactionsEventJoin(CommandSender sender, FPlayer fplayer, Faction faction, PlayerJoinReason reason)
{
super(sender);
this.fplayer = fplayer;
this.faction = faction;
this.reason = reason;
}
public FPlayer getFPlayer()
{
return fplayer;
}
public Faction getFaction()
{
return faction;
}
public PlayerJoinReason getReason()
{
return reason;
}
// -------------------------------------------- //
// INTERNAL ENUM
@ -59,7 +47,7 @@ public class FPlayerJoinEvent extends Event implements Cancellable
public enum PlayerJoinReason
{
CREATE, LEADER, COMMAND
CREATE, LEADER, JOIN
}
}

View File

@ -1,16 +1,12 @@
package com.massivecraft.factions.event;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.mcore.ps.PS;
import org.bukkit.entity.Player;
public class LandUnclaimEvent extends Event implements Cancellable
public class FactionsEventLandClaim extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
@ -19,39 +15,26 @@ public class LandUnclaimEvent extends Event implements Cancellable
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private boolean cancelled;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
private final PS chunk;
public PS getChunk() { return this.chunk; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final FPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; }
// TODO: These methods seem redundant? Why were they added? Can I remove them?
public String getFactionId() { return this.faction.getId(); }
public String getFactionTag() { return this.faction.getTag(); }
public Player getPlayer() { return this.fplayer.getPlayer(); }
private final PS chunk;
public PS getChunk() { return this.chunk; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public LandUnclaimEvent(PS chunk, Faction faction, FPlayer fplayer)
public FactionsEventLandClaim(CommandSender sender, Faction faction, PS chunk)
{
this.cancelled = false;
this.chunk = chunk.getChunk(true);
super(sender);
this.faction = faction;
this.fplayer = fplayer;
this.chunk = chunk.getChunk(true);
}
}

View File

@ -1,16 +1,12 @@
package com.massivecraft.factions.event;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.mcore.ps.PS;
import org.bukkit.entity.Player;
public class LandClaimEvent extends Event implements Cancellable
public class FactionsEventLandUnclaim extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
@ -19,39 +15,26 @@ public class LandClaimEvent extends Event implements Cancellable
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private boolean cancelled = false;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final PS chunk;
public PS getChunk() { return this.chunk; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final FPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; }
// TODO: These methods seem redundant? Why were they added? Can I remove them?
public String getFactionId() { return faction.getId(); }
public String getFactionTag() { return this.faction.getTag(); }
public Player getPlayer() { return this.fplayer.getPlayer(); }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public LandClaimEvent(PS chunk, Faction faction, FPlayer fplayer)
public FactionsEventLandUnclaim(CommandSender sender, Faction faction, PS chunk)
{
this.cancelled = false;
super(sender);
this.chunk = chunk.getChunk(true);
this.faction = faction;
this.fplayer = fplayer;
}
}

View File

@ -0,0 +1,35 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
public class FactionsEventLandUnclaimAll extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsEventLandUnclaimAll(CommandSender sender, Faction faction)
{
super(sender);
this.faction = faction;
}
}

View File

@ -1,13 +1,12 @@
package com.massivecraft.factions.event;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
public class FPlayerLeaveEvent extends Event implements Cancellable
public class FactionsEventLeave extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
@ -21,35 +20,32 @@ public class FPlayerLeaveEvent extends Event implements Cancellable
// FIELDS
// -------------------------------------------- //
private boolean cancelled;
@Override public boolean isCancelled() { return this.cancelled; }
@Override
public void setCancelled(boolean c)
public void setCancelled(boolean cancelled)
{
if (reason == PlayerLeaveReason.DISBAND || reason == PlayerLeaveReason.RESET)
if (this.reason == PlayerLeaveReason.DISBAND || this.reason == PlayerLeaveReason.RESET)
{
cancelled = false;
return;
}
cancelled = c;
super.setCancelled(cancelled);
}
private final PlayerLeaveReason reason;
public PlayerLeaveReason getReason() { return this.reason; }
private final FPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final PlayerLeaveReason reason;
public PlayerLeaveReason getReason() { return this.reason; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FPlayerLeaveEvent(FPlayer fplayer, Faction faction, PlayerLeaveReason reason)
public FactionsEventLeave(CommandSender sender, FPlayer fplayer, Faction faction, PlayerLeaveReason reason)
{
this.cancelled = false;
super(sender);
this.fplayer = fplayer;
this.faction = faction;
this.reason = reason;

View File

@ -0,0 +1,40 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
public class FactionsEventOpenChange extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
private boolean newOpen;
public boolean isNewOpen() { return this.newOpen; }
public void setNewOpen(boolean newOpen) { this.newOpen = newOpen; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsEventOpenChange(CommandSender sender, Faction faction, boolean newOpen)
{
super(sender);
this.faction = faction;
this.newOpen = newOpen;
}
}

View File

@ -0,0 +1,27 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
public class FactionsEventPowerLoss extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
// TODO: Replace this event with a power change event?
public FactionsEventPowerLoss(CommandSender sender)
{
super(sender);
}
}

View File

@ -1,13 +1,13 @@
package com.massivecraft.factions.event;
import org.bukkit.event.Event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Rel;
public class FactionRelationEvent extends Event
public class FactionsEventRelationChange extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
@ -21,32 +21,26 @@ public class FactionRelationEvent extends Event
// FIELDS
// -------------------------------------------- //
// TODO: Should this one be informative only?
// TODO: How about making it Cancellable?
// TODO: How about making the target relation non-final?
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final Faction targetFaction;
public Faction getTargetFaction() { return this.targetFaction; }
private final Faction otherFaction;
public Faction getOtherFaction() { return this.otherFaction; }
private final Rel oldRel;
public Rel getOldRel() { return this.oldRel; }
private final Rel newRel;
public Rel getNewRel() { return this.newRel; }
private Rel newRelation;
public Rel getNewRelation() { return this.newRelation; }
public void setNewRelation(Rel newRelation) { this.newRelation = newRelation; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionRelationEvent(Faction faction, Faction targetFaction, Rel oldRel, Rel newRel)
public FactionsEventRelationChange(CommandSender sender, Faction faction, Faction otherFaction, Rel newRelation)
{
super(sender);
this.faction = faction;
this.targetFaction = targetFaction;
this.oldRel = oldRel;
this.newRel = newRel;
this.otherFaction = otherFaction;
this.newRelation = newRelation;
}
}
}

View File

@ -0,0 +1,40 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
public class FactionsEventTagChange extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
private String newTag;
public String getNewTag() { return this.newTag; }
public void setNewTag(String newTag) { this.newTag = newTag; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsEventTagChange(CommandSender sender, Faction faction, String newTag)
{
super(sender);
this.faction = faction;
this.newTag = newTag;
}
}

View File

@ -0,0 +1,40 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
public class FactionsEventTitleChange extends FactionsEventAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final FPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; }
private String newTitle;
public String getNewTitle() { return this.newTitle; }
public void setNewTitle(String newTitle) { this.newTitle = newTitle; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsEventTitleChange(CommandSender sender, FPlayer fplayer, String newTitle)
{
super(sender);
this.fplayer = fplayer;
this.newTitle = newTitle;
}
}

View File

@ -1,58 +0,0 @@
package com.massivecraft.factions.event;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import org.bukkit.entity.Player;
public class PowerLossEvent extends Event implements Cancellable
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private boolean cancelled;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
private final Faction faction;
public Faction getFaction() { return this.faction; }
private final FPlayer fplayer;
public FPlayer getFPlayer() { return this.fplayer; }
// TODO: Should message really be set here? Or should it be sent by the plugin that cancells directly?
private String message;
public String getMessage() { return this.message; }
public void setMessage(String message) { this.message = message; }
// TODO: These methods seem redundant? Why were they added? Can I remove them?
public String getFactionId() { return this.faction.getId(); }
public String getFactionTag() { return this.faction.getTag(); }
public Player getPlayer() { return this.fplayer.getPlayer(); }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public PowerLossEvent(Faction faction, FPlayer fplayer)
{
this.cancelled = false;
this.faction = faction;
this.fplayer = fplayer;
}
}