From 46f5849f9feedf36cbbf65f8b9e8ff0a07ed43e8 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 21 Oct 2011 19:20:33 +0200 Subject: [PATCH] Moving over to the use of describeTo. --- src/com/massivecraft/factions/Conf.java | 5 ++++ src/com/massivecraft/factions/FPlayer.java | 16 +++++++----- src/com/massivecraft/factions/FPlayers.java | 26 ------------------- src/com/massivecraft/factions/Factions.java | 10 +++---- .../massivecraft/factions/cmd/CmdAdmin.java | 11 ++------ .../massivecraft/factions/cmd/CmdCreate.java | 3 ++- .../factions/cmd/CmdDeinvite.java | 5 ++-- .../factions/cmd/CmdDescription.java | 2 +- .../massivecraft/factions/cmd/CmdDisband.java | 2 +- .../massivecraft/factions/cmd/CmdInvite.java | 4 +-- .../massivecraft/factions/cmd/CmdJoin.java | 4 +-- .../massivecraft/factions/cmd/CmdKick.java | 8 +++--- src/com/massivecraft/factions/cmd/CmdMod.java | 6 ++--- .../massivecraft/factions/cmd/CmdOpen.java | 2 +- .../factions/cmd/CmdPeaceful.java | 4 +-- .../factions/cmd/CmdPermanent.java | 4 +-- .../massivecraft/factions/cmd/CmdPower.java | 2 +- .../massivecraft/factions/cmd/CmdSethome.java | 2 +- src/com/massivecraft/factions/cmd/CmdTag.java | 2 +- .../massivecraft/factions/cmd/CmdTitle.java | 2 +- .../massivecraft/factions/cmd/CmdUnclaim.java | 4 +-- .../factions/cmd/CmdUnclaimall.java | 2 +- .../massivecraft/factions/cmd/FCommand.java | 2 +- .../listeners/FactionsChatEarlyListener.java | 2 +- .../listeners/FactionsEntityListener.java | 6 ++--- .../factions/util/RelationUtil.java | 3 +-- 26 files changed, 55 insertions(+), 84 deletions(-) diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index 45bedbc9..7c8c39e7 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -16,6 +16,11 @@ public class Conf public static ChatColor colorNeutral = ChatColor.WHITE; public static ChatColor colorEnemy = ChatColor.RED; + // TODO: We need to change the relation color system. + // I would like peaceful factions to have the relation color gold. + // For this to be possible some refactoring needs to be done. + public static ChatColor colorPeaceful = ChatColor.GOLD; + // Power public static double powerPlayerMax = 10.0; public static double powerPlayerMin = -10.0; diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index d80080e2..4b4ef21e 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -319,16 +319,18 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator return this.getRelationColor(fplayer)+this.getNameAndTitle(); } - public String getNameAndTag(Faction faction) + /*public String getNameAndTag(Faction faction) { return this.getRelationColor(faction)+this.getNameAndTag(); } public String getNameAndTag(FPlayer fplayer) { return this.getRelationColor(fplayer)+this.getNameAndTag(); - } + }*/ - public String getNameAndRelevant(Faction faction) + // TODO: REmovded for refactoring. + + /*public String getNameAndRelevant(Faction faction) { // Which relation? Relation rel = this.getRelationTo(faction); @@ -344,7 +346,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator public String getNameAndRelevant(FPlayer fplayer) { return getNameAndRelevant(fplayer.getFaction()); - } + }*/ // Chat Tag: // These are injected into the format of global chat messages. @@ -773,12 +775,12 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator { // ASDF claimed some of your land 450 blocks NNW of you. // ASDf claimed some land from FACTION NAME - otherFaction.sendMessage(P.p.txt.parse(this.getNameAndRelevant(otherFaction)+" stole some of your land :O")); - myFaction.sendMessage(P.p.txt.parse(this.getNameAndRelevant(myFaction)+" claimed some land from "+otherFaction.getTag(myFaction))); + otherFaction.msg("%s stole some of your land :O", this.describeTo(otherFaction, true)); + myFaction.msg("%s claimed some land from %s.", this.describeTo(myFaction, true), otherFaction.describeTo(myFaction)); } else { - myFaction.sendMessage(P.p.txt.parse(this.getNameAndRelevant(myFaction)+" claimed some new land :D")); + myFaction.msg("%s claimed some new land :D", this.describeTo(myFaction)); } Board.setFactionAt(myFaction, flocation); diff --git a/src/com/massivecraft/factions/FPlayers.java b/src/com/massivecraft/factions/FPlayers.java index ec3a023d..74429bf1 100644 --- a/src/com/massivecraft/factions/FPlayers.java +++ b/src/com/massivecraft/factions/FPlayers.java @@ -81,30 +81,4 @@ public class FPlayers extends PlayerEntityCollection } return null; } - - /*public Set findAllOnlineInfected() - { - Set vplayers = new HashSet(); - for (VPlayer vplayer : this.getOnline()) - { - if (vplayer.isInfected()) - { - vplayers.add(vplayer); - } - } - return vplayers; - } - - public Set findAllOnlineVampires() - { - Set vplayers = new HashSet(); - for (VPlayer vplayer : this.getOnline()) - { - if (vplayer.isVampire()) - { - vplayers.add(vplayer); - } - } - return vplayers; - }*/ } diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java index 399fc4a2..12500024 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/Factions.java @@ -103,10 +103,6 @@ public class Factions extends EntityCollection } - - - - //----------------------------------------------// // Faction tag //----------------------------------------------// @@ -117,19 +113,19 @@ public class Factions extends EntityCollection if(MiscUtil.getComparisonString(str).length() < Conf.factionTagLengthMin) { - errors.add(P.p.txt.parse("The faction tag can't be shorter than "+Conf.factionTagLengthMin+ " chars.")); + errors.add(P.p.txt.parse("The faction tag can't be shorter than %s chars.", Conf.factionTagLengthMin)); } if(str.length() > Conf.factionTagLengthMax) { - errors.add(P.p.txt.parse("The faction tag can't be longer than "+Conf.factionTagLengthMax+ " chars.")); + errors.add(P.p.txt.parse("The faction tag can't be longer than %s chars.", Conf.factionTagLengthMax)); } for (char c : str.toCharArray()) { if ( ! MiscUtil.substanceChars.contains(String.valueOf(c))) { - errors.add(P.p.txt.parse("Faction tag must be alphanumeric. \""+c+"\" is not allowed.")); + errors.add(P.p.txt.parse("Faction tag must be alphanumeric. \"%s\" is not allowed.", c)); } } diff --git a/src/com/massivecraft/factions/cmd/CmdAdmin.java b/src/com/massivecraft/factions/cmd/CmdAdmin.java index b9910bd2..2431ef35 100644 --- a/src/com/massivecraft/factions/cmd/CmdAdmin.java +++ b/src/com/massivecraft/factions/cmd/CmdAdmin.java @@ -32,7 +32,7 @@ public class CmdAdmin extends FCommand if (fyou.getFaction() != myFaction) { - msg("%s is not a member in your faction.", fyou.getNameAndRelevant(fme)); + msg("%s is not a member in your faction.", fyou.describeTo(fme, true)); return; } @@ -48,14 +48,7 @@ public class CmdAdmin extends FCommand // Inform all players for (FPlayer fplayer : FPlayers.i.getOnline()) { - if (fplayer.getFaction() == myFaction) - { - fplayer.msg("%s gave %s the leadership of your faction.", fme.getNameAndRelevant(fme), fyou.getNameAndRelevant(fme)); - } - else - { - fplayer.msg("%s gave %s the leadership of %s", fme.getNameAndRelevant(fplayer), fyou.getNameAndRelevant(fplayer), myFaction.getTag(fplayer)); - } + fplayer.msg("%s gave %s the leadership of %s", fme.describeTo(fplayer, true), fyou.describeTo(fplayer), myFaction.describeTo(fplayer)); } } diff --git a/src/com/massivecraft/factions/cmd/CmdCreate.java b/src/com/massivecraft/factions/cmd/CmdCreate.java index 6f362a3a..67fa0ec9 100644 --- a/src/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdCreate.java @@ -59,6 +59,7 @@ public class CmdCreate extends FCommand Faction faction = Factions.i.create(); + // TODO: Why would this even happen??? if (faction == null) { msg("There was an internal error while trying to create your faction. Please try again."); @@ -71,7 +72,7 @@ public class CmdCreate extends FCommand for (FPlayer follower : FPlayers.i.getOnline()) { - follower.msg("%s created a new faction %s", fme.getNameAndRelevant(follower), faction.getTag(follower)); + follower.msg("%s created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower)); } msg("You should now: %s", p.cmdBase.cmdDescription.getUseageTemplate()); diff --git a/src/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/com/massivecraft/factions/cmd/CmdDeinvite.java index c92ce4ca..1f41f088 100644 --- a/src/com/massivecraft/factions/cmd/CmdDeinvite.java +++ b/src/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -39,8 +39,9 @@ public class CmdDeinvite extends FCommand myFaction.deinvite(you); - you.msg("%s revoked your invitation to %s", fme.getNameAndRelevant(you), myFaction.getTag(you)); - myFaction.msg("%s revoked %s's invitation.", fme.getNameAndRelevant(fme), you.getNameAndRelevant(fme)); + you.msg("%s revoked your invitation to %s.", fme.describeTo(you), myFaction.describeTo(you)); + + myFaction.msg("%s revoked %s's invitation.", fme.describeTo(myFaction), you.describeTo(myFaction)); } } diff --git a/src/com/massivecraft/factions/cmd/CmdDescription.java b/src/com/massivecraft/factions/cmd/CmdDescription.java index 311dd125..404b503e 100644 --- a/src/com/massivecraft/factions/cmd/CmdDescription.java +++ b/src/com/massivecraft/factions/cmd/CmdDescription.java @@ -37,7 +37,7 @@ public class CmdDescription extends FCommand // Broadcast the description to everyone for (FPlayer fplayer : FPlayers.i.getOnline()) { - fplayer.msg("The faction "+fplayer.getRelationColor(fme)+myFaction.getTag()+" changed their description to:"); + fplayer.msg("The faction %s changed their description to:", myFaction.describeTo(fplayer)); fplayer.msg(""+myFaction.getDescription()); } } diff --git a/src/com/massivecraft/factions/cmd/CmdDisband.java b/src/com/massivecraft/factions/cmd/CmdDisband.java index b6c18a94..b3cc410b 100644 --- a/src/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdDisband.java @@ -59,7 +59,7 @@ public class CmdDisband extends FCommand // Inform all players for (FPlayer fplayer : FPlayers.i.getOnline()) { - String who = senderIsConsole ? "A server admin" : fme.getNameAndRelevant(fplayer); + String who = senderIsConsole ? "A server admin" : fme.describeTo(fplayer); if (fplayer.getFaction() == faction) { fplayer.msg("%s disbanded your faction.", who); diff --git a/src/com/massivecraft/factions/cmd/CmdInvite.java b/src/com/massivecraft/factions/cmd/CmdInvite.java index db0480e3..9a1f187c 100644 --- a/src/com/massivecraft/factions/cmd/CmdInvite.java +++ b/src/com/massivecraft/factions/cmd/CmdInvite.java @@ -42,8 +42,8 @@ public class CmdInvite extends FCommand myFaction.invite(you); - you.msg("%s invited you to %s", fme.getNameAndRelevant(you), myFaction.getTag(you)); - myFaction.msg("%s invited %s to your faction.", fme.getNameAndRelevant(fme), you.getNameAndRelevant(fme)); + you.msg("%s invited you to %s", fme.describeTo(you, true), myFaction.describeTo(you)); + myFaction.msg("%s invited %s to your faction.", fme.describeTo(myFaction, true), you.describeTo(myFaction)); } } diff --git a/src/com/massivecraft/factions/cmd/CmdJoin.java b/src/com/massivecraft/factions/cmd/CmdJoin.java index 347d894d..bfe80358 100644 --- a/src/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdJoin.java @@ -56,7 +56,7 @@ public class CmdJoin extends FCommand if( ! (faction.getOpen() || faction.isInvited(fme) || fme.isAdminBypassing())) { msg("This faction requires invitation."); - faction.msg("%s tried to join your faction.", fme.getNameAndRelevant(faction)); + faction.msg("%s tried to join your faction.", fme.describeTo(faction, true)); return; } @@ -64,7 +64,7 @@ public class CmdJoin extends FCommand if ( ! payForCommand(Conf.econCostJoin, "to join a faction", "for joining a faction")) return; fme.msg("You successfully joined %s", faction.getTag(fme)); - faction.msg("%s joined your faction.", fme.getNameAndRelevant(faction)); + faction.msg("%s joined your faction.", fme.describeTo(faction, true)); fme.resetFactionData(); fme.setFaction(faction); diff --git a/src/com/massivecraft/factions/cmd/CmdKick.java b/src/com/massivecraft/factions/cmd/CmdKick.java index 7880314e..8dbbca99 100644 --- a/src/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/com/massivecraft/factions/cmd/CmdKick.java @@ -46,7 +46,7 @@ public class CmdKick extends FCommand { if (yourFaction != myFaction) { - msg("%s is not a member of %s", you.getNameAndRelevant(fme), myFaction.getTag(fme)); + msg("%s is not a member of %s", you.describeTo(fme, true), myFaction.describeTo(fme)); return; } @@ -67,11 +67,11 @@ public class CmdKick extends FCommand // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay if ( ! payForCommand(Conf.econCostKick, "to kick someone from the faction", "for kicking someone from the faction")) return; - yourFaction.msg("%s kicked %s from the faction! :O", fme.getNameAndRelevant(yourFaction), you.getNameAndRelevant(yourFaction)); - you.msg("%s kicked you from %s! :O", fme.getNameAndRelevant(you), yourFaction.getTag(you)); + yourFaction.msg("%s kicked %s from the faction! :O", fme.describeTo(yourFaction, true), you.describeTo(yourFaction, true)); + you.msg("%s kicked you from %s! :O", fme.describeTo(you, true), yourFaction.describeTo(you)); if (yourFaction != myFaction) { - fme.msg("You kicked %s from the faction %s!", you.getNameAndRelevant(myFaction), yourFaction.getTag(fme)); + fme.msg("You kicked %s from the faction %s!", you.describeTo(fme), yourFaction.describeTo(fme)); } yourFaction.deinvite(you); diff --git a/src/com/massivecraft/factions/cmd/CmdMod.java b/src/com/massivecraft/factions/cmd/CmdMod.java index 49e376d7..77d1dba0 100644 --- a/src/com/massivecraft/factions/cmd/CmdMod.java +++ b/src/com/massivecraft/factions/cmd/CmdMod.java @@ -32,7 +32,7 @@ public class CmdMod extends FCommand if (you.getFaction() != myFaction) { - msg("%s is not a member in your faction.", you.getNameAndRelevant(fme)); + msg("%s is not a member in your faction.", you.describeTo(fme, true)); return; } @@ -46,13 +46,13 @@ public class CmdMod extends FCommand { // Revoke you.setRole(Role.NORMAL); - myFaction.msg("%s is no longer moderator in your faction.", you.getNameAndRelevant(myFaction)); + myFaction.msg("%s is no longer moderator in your faction.", you.describeTo(myFaction, true)); } else { // Give you.setRole(Role.MODERATOR); - myFaction.msg("%s was promoted to moderator in your faction.", you.getNameAndRelevant(myFaction)); + myFaction.msg("%s was promoted to moderator in your faction.", you.describeTo(myFaction, true)); } } diff --git a/src/com/massivecraft/factions/cmd/CmdOpen.java b/src/com/massivecraft/factions/cmd/CmdOpen.java index 4b0bbb02..fac92821 100644 --- a/src/com/massivecraft/factions/cmd/CmdOpen.java +++ b/src/com/massivecraft/factions/cmd/CmdOpen.java @@ -35,7 +35,7 @@ public class CmdOpen extends FCommand String open = myFaction.getOpen() ? "open" : "closed"; // Inform - myFaction.msg("%s changed the faction to %s.", fme.getNameAndRelevant(myFaction), open); + myFaction.msg("%s changed the faction to %s.", fme.describeTo(myFaction, true), open); for (Faction faction : Factions.i.get()) { if (faction == myFaction) diff --git a/src/com/massivecraft/factions/cmd/CmdPeaceful.java b/src/com/massivecraft/factions/cmd/CmdPeaceful.java index 6d37b357..103cfda8 100644 --- a/src/com/massivecraft/factions/cmd/CmdPeaceful.java +++ b/src/com/massivecraft/factions/cmd/CmdPeaceful.java @@ -49,11 +49,11 @@ public class CmdPeaceful extends FCommand { if (fplayer.getFaction() == faction) { - fplayer.msg((fme == null ? "A server admin" : fme.getNameAndRelevant(fplayer))+" has "+change+" your faction."); + fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+" has "+change+" your faction."); } else { - fplayer.msg((fme == null ? "A server admin" : fme.getNameAndRelevant(fplayer))+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\"."); + fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\"."); } } diff --git a/src/com/massivecraft/factions/cmd/CmdPermanent.java b/src/com/massivecraft/factions/cmd/CmdPermanent.java index f705785b..3061253d 100644 --- a/src/com/massivecraft/factions/cmd/CmdPermanent.java +++ b/src/com/massivecraft/factions/cmd/CmdPermanent.java @@ -48,11 +48,11 @@ public class CmdPermanent extends FCommand { if (fplayer.getFaction() == faction) { - fplayer.msg((fme == null ? "A server admin" : fme.getNameAndRelevant(fplayer))+" has "+change+" your faction."); + fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+" has "+change+" your faction."); } else { - fplayer.msg((fme == null ? "A server admin" : fme.getNameAndRelevant(fplayer))+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\"."); + fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\"."); } } } diff --git a/src/com/massivecraft/factions/cmd/CmdPower.java b/src/com/massivecraft/factions/cmd/CmdPower.java index 6e7d0c7d..3085dfe1 100644 --- a/src/com/massivecraft/factions/cmd/CmdPower.java +++ b/src/com/massivecraft/factions/cmd/CmdPower.java @@ -36,7 +36,7 @@ public class CmdPower extends FCommand // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay if ( ! payForCommand(Conf.econCostPower, "to show player power info", "for showing player power info")) return; - msg("%s - Power / Maxpower: %d / %d", target.getNameAndRelevant(fme), target.getPowerRounded(), target.getPowerMaxRounded()); + msg("%s - Power / Maxpower: %d / %d", target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded()); } } diff --git a/src/com/massivecraft/factions/cmd/CmdSethome.java b/src/com/massivecraft/factions/cmd/CmdSethome.java index f00f655a..b6536b68 100644 --- a/src/com/massivecraft/factions/cmd/CmdSethome.java +++ b/src/com/massivecraft/factions/cmd/CmdSethome.java @@ -66,7 +66,7 @@ public class CmdSethome extends FCommand faction.setHome(me.getLocation()); - faction.msg("%s set the home for your faction. You can now use:", fme.getNameAndRelevant(myFaction)); + faction.msg("%s set the home for your faction. You can now use:", fme.describeTo(myFaction, true)); faction.sendMessage(p.cmdBase.cmdHome.getUseageTemplate()); if (faction != myFaction) { diff --git a/src/com/massivecraft/factions/cmd/CmdTag.java b/src/com/massivecraft/factions/cmd/CmdTag.java index 95d03a6c..ab199bcc 100644 --- a/src/com/massivecraft/factions/cmd/CmdTag.java +++ b/src/com/massivecraft/factions/cmd/CmdTag.java @@ -55,7 +55,7 @@ public class CmdTag extends FCommand myFaction.setTag(tag); // Inform - myFaction.msg("%s changed your faction tag to %s", fme.getNameAndRelevant(myFaction), myFaction.getTag(myFaction)); + myFaction.msg("%s changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction)); for (Faction faction : Factions.i.get()) { if (faction == myFaction) diff --git a/src/com/massivecraft/factions/cmd/CmdTitle.java b/src/com/massivecraft/factions/cmd/CmdTitle.java index 3a237300..5cbade02 100644 --- a/src/com/massivecraft/factions/cmd/CmdTitle.java +++ b/src/com/massivecraft/factions/cmd/CmdTitle.java @@ -41,7 +41,7 @@ public class CmdTitle extends FCommand you.setTitle(title); // Inform - myFaction.msg("%s changed a title: %s", fme.getNameAndRelevant(myFaction), you.getNameAndRelevant(myFaction)); + myFaction.msg("%s changed a title: %s", fme.describeTo(myFaction, true), you.describeTo(myFaction, true)); if (Conf.spoutFactionTitlesOverNames) { diff --git a/src/com/massivecraft/factions/cmd/CmdUnclaim.java b/src/com/massivecraft/factions/cmd/CmdUnclaim.java index 29701a7f..22a2478d 100644 --- a/src/com/massivecraft/factions/cmd/CmdUnclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdUnclaim.java @@ -64,7 +64,7 @@ public class CmdUnclaim extends FCommand { Board.removeAt(flocation); - otherFaction.msg("%s unclaimed some of your land.", fme.getNameAndRelevant(otherFaction)); + otherFaction.msg("%s unclaimed some of your land.", fme.describeTo(otherFaction, true)); msg("You unclaimed this land."); return; } @@ -148,7 +148,7 @@ public class CmdUnclaim extends FCommand } Board.removeAt(flocation); - myFaction.msg("%s unclaimed some land.", fme.getNameAndRelevant(myFaction)); + myFaction.msg("%s unclaimed some land.", fme.describeTo(myFaction, true)); } } diff --git a/src/com/massivecraft/factions/cmd/CmdUnclaimall.java b/src/com/massivecraft/factions/cmd/CmdUnclaimall.java index 2dd9bc78..d462d9c9 100644 --- a/src/com/massivecraft/factions/cmd/CmdUnclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdUnclaimall.java @@ -88,7 +88,7 @@ public class CmdUnclaimall extends FCommand }*/ Board.unclaimAll(myFaction.getId()); - myFaction.msg("%s unclaimed ALL of your faction's land.", fme.getNameAndRelevant(myFaction)); + myFaction.msg("%s unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true)); } } diff --git a/src/com/massivecraft/factions/cmd/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java index 48462f91..36d0d126 100644 --- a/src/com/massivecraft/factions/cmd/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -258,7 +258,7 @@ public abstract class FCommand extends MCommand

{ if ( ! i.getFaction().equals(you.getFaction())) { - i.sendMessage(p.txt.parse("%s is not in the same faction as you.",you.getNameAndRelevant(i))); + i.sendMessage(p.txt.parse("%s is not in the same faction as you.",you.describeTo(i, true))); return false; } diff --git a/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java b/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java index e8f9e533..848c13bd 100644 --- a/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java @@ -46,7 +46,7 @@ public class FactionsChatEarlyListener extends PlayerListener if (me.getChatMode() == ChatMode.FACTION) { - String message = String.format(Conf.factionChatFormat, me.getNameAndRelevant(me), msg); + String message = String.format(Conf.factionChatFormat, me.describeTo(me), msg); me.getFaction().sendMessage(message); P.p.log(Level.INFO, ChatColor.stripColor("FactionChat "+me.getFaction().getTag()+": "+message)); diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 2529d479..ec959d66 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -340,7 +340,7 @@ public class FactionsEntityListener extends EntityListener // You can never hurt faction members or allies if (relation.isMember() || relation.isAlly()) { - attacker.msg("You can't hurt "+defender.getNameAndRelevant(attacker)); + attacker.msg("You can't hurt %s.", defender.describeTo(attacker)); return false; } @@ -349,8 +349,8 @@ public class FactionsEntityListener extends EntityListener // You can not hurt neutrals in their own territory. if (ownTerritory && relation.isNeutral()) { - attacker.msg("You can't hurt "+relation.getColor()+defender.getNameAndRelevant(attacker)+" in their own territory unless you declare them as an enemy."); - defender.msg(attacker.getNameAndRelevant(defender)+" tried to hurt you."); + attacker.msg("You can't hurt %s in their own territory unless you declare them as an enemy.", defender.describeTo(attacker)); + defender.msg("%s tried to hurt you.", attacker.describeTo(defender, true)); return false; } diff --git a/src/com/massivecraft/factions/util/RelationUtil.java b/src/com/massivecraft/factions/util/RelationUtil.java index 6b1ae58e..3168ec59 100644 --- a/src/com/massivecraft/factions/util/RelationUtil.java +++ b/src/com/massivecraft/factions/util/RelationUtil.java @@ -113,8 +113,7 @@ public class RelationUtil return null; } - public static ChatColor getRelationColor(RelationParticipator me, - RelationParticipator that) + public static ChatColor getRelationColor(RelationParticipator me, RelationParticipator that) { return getRelationTo(that, me).getColor(); }