Added Event System
This commit is contained in:
@@ -2,12 +2,16 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||
import com.massivecraft.factions.event.FactionCreateEvent;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
|
||||
@@ -54,6 +58,11 @@ public class CmdCreate extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
FactionCreateEvent createEvent = new FactionCreateEvent(tag, me);
|
||||
Bukkit.getServer().getPluginManager().callEvent(createEvent);
|
||||
|
||||
if(createEvent.isCancelled()) return;
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if ( ! payForCommand(Conf.econCostCreate, "to create a new faction", "for creating a new faction")) return;
|
||||
|
||||
@@ -66,6 +75,9 @@ public class CmdCreate extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.i.get(me),faction,FPlayerJoinEvent.PlayerJoinReason.CREATE);
|
||||
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
||||
|
||||
faction.setTag(tag);
|
||||
fme.setRole(Rel.LEADER);
|
||||
fme.setFaction(faction);
|
||||
|
||||
Reference in New Issue
Block a user