Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public CmdMoneyBalance() {
super();
this.aliases.add("b");
this.aliases.add("balance");
this.aliases.add("bal");

//this.requiredArgs.add("");
this.optionalArgs.put("faction", "yours");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.massivecraft.factions.cmd.CommandContext;
import com.massivecraft.factions.cmd.CommandRequirements;
import com.massivecraft.factions.cmd.FCommand;
import com.massivecraft.factions.event.FactionStrikeAddEvent;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.TL;
import com.massivecraft.factions.util.TextUtil;
Expand Down Expand Up @@ -41,7 +42,11 @@ public void perform(CommandContext context) {
}

String trim = stringBuilder.toString().trim();
toStrike.addStrike(trim, System.currentTimeMillis());
long now = System.currentTimeMillis();
FactionStrikeAddEvent event = new FactionStrikeAddEvent(toStrike, context.fPlayer, trim, now);
Bukkit.getPluginManager().callEvent(event);
if(!event.isCancelled())
toStrike.addStrike(event.getReason(), event.getTime());

if(FactionsPlugin.getInstance().getConfigManager().getMainConfig().commands().strike().broadcastStrikes()){
for(Player player : Bukkit.getOnlinePlayers()){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.massivecraft.factions.event;

import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

/**
* Event called when a Faction gets striked
*/
public class FactionStrikeAddEvent extends FactionEvent implements Cancellable
{
private static final HandlerList handlers = new HandlerList();

private final Faction faction;
private final FPlayer playerIssued;
private String reason;
private long time;
private boolean cancelled = false;

public FactionStrikeAddEvent(Faction faction, FPlayer playerIssued, String reason, long time)
{
super(faction);
this.faction = faction;
this.playerIssued = playerIssued;
this.reason = reason;
this.time = time;
}

public FPlayer getPlayerWhoIssued()
{
return playerIssued;
}

public String getReason()
{
return reason;
}

public long getTime()
{
return time;
}

public void setTime(long time)
{
this.time = time;
}

public void setReason(String reason)
{
this.reason = reason;
}

@Override
public boolean isCancelled()
{
return cancelled;
}

@Override
public void setCancelled(boolean cancelled)
{
this.cancelled = cancelled;
}

@Override
public HandlerList getHandlers()
{
return handlers;
}

public static HandlerList getHandlerList()
{
return handlers;
}
}