Faction create event is no longer cancellable, and is called AFTER the faction is made. This allows people to hook into the event and manipulating the Faction without having a delay. And if the event was ever cancelled before, it was silent.

This commit is contained in:
Trent Hensler
2018-03-09 22:08:17 -08:00
parent 819cb542cd
commit 2291554e1e
2 changed files with 17 additions and 22 deletions

View File

@@ -55,13 +55,6 @@ public class CmdCreate extends FCommand {
return;
}
// trigger the faction creation event (cancellable)
FactionCreateEvent createEvent = new FactionCreateEvent(me, tag);
Bukkit.getServer().getPluginManager().callEvent(createEvent);
if (createEvent.isCancelled()) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) {
return;
@@ -87,6 +80,10 @@ public class CmdCreate extends FCommand {
fme.setRole(Role.ADMIN);
fme.setFaction(faction);
// trigger the faction creation event
FactionCreateEvent createEvent = new FactionCreateEvent(me, tag, faction);
Bukkit.getServer().getPluginManager().callEvent(createEvent);
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));
}