6329fd0eaf
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
63 lines
1.2 KiB
Java
63 lines
1.2 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.FPlayers;
|
|
import com.massivecraft.factions.Factions;
|
|
|
|
public class FactionCreateEvent extends Event implements Cancellable
|
|
{
|
|
private static final HandlerList handlers = new HandlerList();
|
|
|
|
private String factionTag;
|
|
private Player sender;
|
|
private boolean cancelled;
|
|
|
|
public FactionCreateEvent(Player sender, String tag)
|
|
{
|
|
this.factionTag = tag;
|
|
this.sender = sender;
|
|
this.cancelled = false;
|
|
}
|
|
|
|
public FPlayer getFPlayer()
|
|
{
|
|
return FPlayers.i.get(sender);
|
|
}
|
|
|
|
public String getFactionId()
|
|
{
|
|
return Factions.i.getNextId();
|
|
}
|
|
|
|
public String getFactionTag()
|
|
{
|
|
return factionTag;
|
|
}
|
|
|
|
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;
|
|
}
|
|
} |