a bit of cleanup

This commit is contained in:
Brettflan 2012-03-13 07:47:54 -05:00
parent a53a556594
commit 28269b7455
5 changed files with 18 additions and 19 deletions

View File

@ -55,8 +55,8 @@ public class CmdDisband extends FCommand
// Send FPlayerLeaveEvent for each player in the faction
for ( FPlayer fplayer : faction.getFPlayers() )
{
Bukkit.getServer().getPluginManager().callEvent(new FPlayerLeaveEvent(fplayer, faction, FPlayerLeaveEvent.PlayerLeaveReason.DISBAND));
{
Bukkit.getServer().getPluginManager().callEvent(new FPlayerLeaveEvent(fplayer, faction, FPlayerLeaveEvent.PlayerLeaveReason.DISBAND));
}
// Inform all players

View File

@ -79,13 +79,13 @@ public class CmdJoin extends FCommand
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (samePlayer && ! payForCommand(Conf.econCostJoin, "to join a faction", "for joining a faction")) return;
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme));
// trigger the join event (cancellable)
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.i.get(me),faction,FPlayerJoinEvent.PlayerJoinReason.COMMAND);
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
if (joinEvent.isCancelled()) return;
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme));
if (!samePlayer)
fplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(fplayer, true), faction.getTag(fplayer));
faction.msg("<i>%s joined your faction.", fplayer.describeTo(faction, true));

View File

@ -68,13 +68,12 @@ public class CmdLeader extends FCommand
}
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
// (only possibly triggered by console)
if (newLeader.getFaction() != targetFaction)
{
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.i.get(me),targetFaction,FPlayerJoinEvent.PlayerJoinReason.LEADER);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return;
}
{
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.i.get(me),targetFaction,FPlayerJoinEvent.PlayerJoinReason.LEADER);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return;
}
// if target player is currently leader, demote and replace him
if (targetFactionCurrentLeader == newLeader)

View File

@ -51,15 +51,15 @@ public class CmdTag extends FCommand
return;
}
// trigger the faction rename event (cancellable)
FactionRenameEvent renameEvent = new FactionRenameEvent(fme, tag);
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
if(renameEvent.isCancelled()) return;
// trigger the faction rename event (cancellable)
FactionRenameEvent renameEvent = new FactionRenameEvent(fme, tag);
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
if(renameEvent.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.econCostTag, "to change the faction tag", "for changing the faction tag")) return;
String oldtag = myFaction.getTag();
String oldtag = myFaction.getTag();
myFaction.setTag(tag);
// Inform

View File

@ -58,9 +58,9 @@ public abstract class FRelationCommand extends FCommand
// if the relation change was successful
if (targetRelation == currentRelation)
{
// trigger the faction relation event
FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation);
Bukkit.getServer().getPluginManager().callEvent(relationEvent);
// trigger the faction relation event
FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation);
Bukkit.getServer().getPluginManager().callEvent(relationEvent);
them.msg("%s<i> is now %s.", myFaction.describeTo(them, true), targetRelation.getDescFactionOne());
myFaction.msg("%s<i> is now %s.", them.describeTo(myFaction, true), targetRelation.getDescFactionOne());