
Patrick's Custom Event System Changes: ---------------------------------------- * FPlayerLeaveEvent now fires for all faction players in cmdDisband() * FPlayerLeaveEvent removed from cmdJoin() * FPlayerJoinEvent now only fires when the faction is different in cmdLeade * Added FactionRenameEvent, firing on cmdTag() * Added FactionRelationEvent, firing on FRelationCommand extensions * Fixed FPlayerJoinEvent to fire after tag is set in cmdCreate() * Added getFactionId() to FactionCreateEvent TODO: ------- * cmdLeader() might need a FPlayerLeaveEvent for the same reason it needs a FPlayerJoinEvent? On branch CustomFactionEvents modified: src/com/massivecraft/factions/cmd/CmdCreate.java modified: src/com/massivecraft/factions/cmd/CmdDisband.java modified: src/com/massivecraft/factions/cmd/CmdJoin.java modified: src/com/massivecraft/factions/cmd/CmdKick.java modified: src/com/massivecraft/factions/cmd/CmdLeader.java modified: src/com/massivecraft/factions/cmd/CmdTag.java modified: src/com/massivecraft/factions/cmd/FRelationCommand.java modified: src/com/massivecraft/factions/event/FPlayerLeaveEvent.java modified: src/com/massivecraft/factions/event/FactionCreateEvent.java new file: src/com/massivecraft/factions/event/FactionRelationEvent.java new file: src/com/massivecraft/factions/event/FactionRenameEvent.java modified: src/com/massivecraft/factions/event/LandClaimEvent.java
74 lines
1.3 KiB
Java
74 lines
1.3 KiB
Java
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 {
|
|
private static final HandlerList handlers = new HandlerList();
|
|
|
|
private boolean cancelled;
|
|
private FPlayer fplayer;
|
|
private Faction faction;
|
|
private String tag;
|
|
|
|
public FactionRenameEvent(FPlayer sender, String newTag)
|
|
{
|
|
fplayer = sender;
|
|
faction = sender.getFaction();
|
|
tag = newTag;
|
|
this.cancelled = false;
|
|
}
|
|
|
|
public Faction getFaction()
|
|
{
|
|
return(faction);
|
|
}
|
|
|
|
public FPlayer getFPlayer()
|
|
{
|
|
return(fplayer);
|
|
}
|
|
|
|
public Player getPlayer()
|
|
{
|
|
return(fplayer.getPlayer());
|
|
}
|
|
|
|
public String getOldFactionTag()
|
|
{
|
|
return(faction.getTag());
|
|
}
|
|
|
|
public String getFactionTag()
|
|
{
|
|
return(tag);
|
|
}
|
|
|
|
public HandlerList getHandlers()
|
|
{
|
|
return handlers;
|
|
}
|
|
|
|
public static HandlerList getHandlerList()
|
|
{
|
|
return handlers;
|
|
}
|
|
|
|
@Override
|
|
public boolean isCancelled()
|
|
{
|
|
return cancelled;
|
|
}
|
|
|
|
@Override
|
|
public void setCancelled(boolean c)
|
|
{
|
|
this.cancelled = c;
|
|
}
|
|
}
|