From 28269b7455d64a2dd6b712c61c4f9dc29757fa8e Mon Sep 17 00:00:00 2001 From: Brettflan Date: Tue, 13 Mar 2012 07:47:54 -0500 Subject: [PATCH] a bit of cleanup --- src/com/massivecraft/factions/cmd/CmdDisband.java | 4 ++-- src/com/massivecraft/factions/cmd/CmdJoin.java | 6 +++--- src/com/massivecraft/factions/cmd/CmdLeader.java | 11 +++++------ src/com/massivecraft/factions/cmd/CmdTag.java | 10 +++++----- .../massivecraft/factions/cmd/FRelationCommand.java | 6 +++--- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdDisband.java b/src/com/massivecraft/factions/cmd/CmdDisband.java index 1c59b722..ea2e2f58 100644 --- a/src/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdDisband.java @@ -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 diff --git a/src/com/massivecraft/factions/cmd/CmdJoin.java b/src/com/massivecraft/factions/cmd/CmdJoin.java index 63cad4b6..f87cb48b 100644 --- a/src/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdJoin.java @@ -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("%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("%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme)); + if (!samePlayer) fplayer.msg("%s moved you into the faction %s.", fme.describeTo(fplayer, true), faction.getTag(fplayer)); faction.msg("%s joined your faction.", fplayer.describeTo(faction, true)); diff --git a/src/com/massivecraft/factions/cmd/CmdLeader.java b/src/com/massivecraft/factions/cmd/CmdLeader.java index 52b1c4e2..fd1958ba 100644 --- a/src/com/massivecraft/factions/cmd/CmdLeader.java +++ b/src/com/massivecraft/factions/cmd/CmdLeader.java @@ -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) diff --git a/src/com/massivecraft/factions/cmd/CmdTag.java b/src/com/massivecraft/factions/cmd/CmdTag.java index cd3da2a8..75c2d45f 100644 --- a/src/com/massivecraft/factions/cmd/CmdTag.java +++ b/src/com/massivecraft/factions/cmd/CmdTag.java @@ -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 diff --git a/src/com/massivecraft/factions/cmd/FRelationCommand.java b/src/com/massivecraft/factions/cmd/FRelationCommand.java index 37efc8af..52d39ee9 100644 --- a/src/com/massivecraft/factions/cmd/FRelationCommand.java +++ b/src/com/massivecraft/factions/cmd/FRelationCommand.java @@ -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 is now %s.", myFaction.describeTo(them, true), targetRelation.getDescFactionOne()); myFaction.msg("%s is now %s.", them.describeTo(myFaction, true), targetRelation.getDescFactionOne());