From 9503baff6e1f9312356ae3f7229a8c22f03f23f7 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 18 Sep 2014 14:37:30 +0200 Subject: [PATCH] Silence the create and disband actions. The general public need not know. It will just be spammy. --- .../factions/cmd/CmdFactionsCreate.java | 9 ++------ .../factions/cmd/CmdFactionsDisband.java | 22 +++++++++---------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsCreate.java index 15121264..05ed79f6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsCreate.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsCreate.java @@ -6,11 +6,9 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.req.ReqHasntFaction; -import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.MConf; -import com.massivecraft.factions.entity.MPlayerColl; import com.massivecraft.factions.event.EventFactionsCreate; import com.massivecraft.factions.event.EventFactionsMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason; @@ -80,13 +78,10 @@ public class CmdFactionsCreate extends FactionsCommand // NOTE: join event cannot be cancelled or you'll have an empty faction // Inform - for (MPlayer follower : MPlayerColl.get().getAllOnline()) - { - follower.msg("%s created a new faction %s", msender.describeTo(follower, true), faction.getName(follower)); - } - + msg("You created the faction %s", faction.getName(msender)); msg("You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate()); + // Log if (MConf.get().logFactionCreate) { Factions.get().log(msender.getName()+" created a new faction: "+newName); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDisband.java index 753b4743..a21b24f7 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDisband.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDisband.java @@ -5,7 +5,6 @@ import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; -import com.massivecraft.factions.entity.MPlayerColl; import com.massivecraft.factions.event.EventFactionsDisband; import com.massivecraft.factions.event.EventFactionsMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason; @@ -70,25 +69,24 @@ public class CmdFactionsDisband extends FactionsCommand membershipChangeEvent.run(); } - // Inform all players - for (MPlayer mplayer : MPlayerColl.get().getAllOnline()) + // Inform + for (MPlayer mplayer : faction.getMPlayersWhereOnline(true)) { - String who = msender.describeTo(mplayer); - if (mplayer.getFaction() == faction) - { - mplayer.msg("%s disbanded your faction.", who); - } - else - { - mplayer.msg("%s disbanded the faction %s.", who, faction.getName(mplayer)); - } + mplayer.msg("%s disbanded your faction.", msender.describeTo(mplayer)); } + if (msenderFaction != faction) + { + msender.msg("You disbanded %s." , faction.describeTo(msender)); + } + + // Log if (MConf.get().logFactionDisband) { Factions.get().log(Txt.parse("The faction %s (%s) was disbanded by %s.", faction.getName(), faction.getId(), msender.getDisplayName(IdUtil.getConsole()))); } + // Apply faction.detach(); }