Rename Faction Tag to Faction Name. What did tag ever mean? Name makes more sense.

This commit is contained in:
Olof Larsson
2013-04-24 19:01:17 +02:00
parent 82e380cd3d
commit 5eed71fc67
34 changed files with 156 additions and 166 deletions

View File

@@ -40,7 +40,7 @@ public class CmdFactions extends FCommand
public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk();
public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
public CmdFactionsShow cmdFactionsShow = new CmdFactionsShow();
public CmdFactionsTag cmdFactionsTag = new CmdFactionsTag();
public CmdFactionsName cmdFactionsName = new CmdFactionsName();
public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim();
public CmdFactionsUnclaimall cmdFactionsUnclaimall = new CmdFactionsUnclaimall();
@@ -66,7 +66,7 @@ public class CmdFactions extends FCommand
this.addSubCommand(this.cmdFactionsHome);
this.addSubCommand(this.cmdFactionsCreate);
this.addSubCommand(this.cmdFactionsSethome);
this.addSubCommand(this.cmdFactionsTag);
this.addSubCommand(this.cmdFactionsName);
this.addSubCommand(this.cmdFactionsDemote);
this.addSubCommand(this.cmdFactionsDescription);
this.addSubCommand(this.cmdFactionsPerm);

View File

@@ -82,7 +82,7 @@ public class CmdFactionsAccess extends FCommand
Faction targetFaction = this.arg(1, ARFaction.get(myFaction), myFaction);
if (targetFaction == null) return;
added = territory.toggleFaction(targetFaction);
target = "Faction \""+targetFaction.getTag()+"\"";
target = "Faction \""+targetFaction.getName()+"\"";
}
msg("<i>%s has been %s<i> the access list for this territory.", target, Txt.parse(added ? "<lime>added to" : "<rose>removed from"));
@@ -91,7 +91,7 @@ public class CmdFactionsAccess extends FCommand
private void showAccessList(TerritoryAccess territory, Faction locFaction)
{
msg("<i>Host faction %s has %s<i> in this territory.", locFaction.getTag(), Txt.parse(territory.isHostFactionAllowed() ? "<lime>normal access" : "<rose>restricted access"));
msg("<i>Host faction %s has %s<i> in this territory.", locFaction.getName(), Txt.parse(territory.isHostFactionAllowed() ? "<lime>normal access" : "<rose>restricted access"));
String players = territory.fplayerList();
String factions = territory.factionList(locFaction);

View File

@@ -22,7 +22,7 @@ public class CmdFactionsCreate extends FCommand
{
this.addAliases("create");
this.addRequiredArg("faction tag");
this.addRequiredArg("name");
this.addRequirements(ReqHasPerm.get(Perm.CREATE.node));
}
@@ -31,7 +31,7 @@ public class CmdFactionsCreate extends FCommand
public void perform()
{
// Args
String newTag = this.arg(0);
String newName = this.arg(0);
// Verify
if (fme.getFaction().isNormal())
@@ -42,16 +42,16 @@ public class CmdFactionsCreate extends FCommand
FactionColl coll = FactionColls.get().get(fme);
if (coll.isTagTaken(newTag))
if (coll.isNameTaken(newName))
{
msg("<b>That tag is already in use.");
msg("<b>That name is already in use.");
return;
}
ArrayList<String> tagValidationErrors = coll.validateTag(newTag);
if (tagValidationErrors.size() > 0)
ArrayList<String> nameValidationErrors = coll.validateName(newName);
if (nameValidationErrors.size() > 0)
{
sendMessage(tagValidationErrors);
sendMessage(nameValidationErrors);
return;
}
@@ -59,13 +59,13 @@ public class CmdFactionsCreate extends FCommand
String factionId = coll.getIdStrategy().generate(coll);
// Event
FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newTag);
FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newName);
createEvent.run();
if (createEvent.isCancelled()) return;
// Apply
Faction faction = coll.create(factionId);
faction.setTag(newTag);
faction.setName(newName);
fme.setRole(Rel.LEADER);
fme.setFaction(faction);
@@ -77,14 +77,14 @@ public class CmdFactionsCreate extends FCommand
// Inform
for (UPlayer follower : UPlayerColls.get().get(fme).getAllOnline())
{
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower));
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getName(follower));
}
msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
if (MConf.get().logFactionCreate)
{
Factions.get().log(fme.getName()+" created a new faction: "+newTag);
Factions.get().log(fme.getName()+" created a new faction: "+newName);
}
}

View File

@@ -67,13 +67,13 @@ public class CmdFactionsDisband extends FCommand
}
else
{
uplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(uplayer));
uplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getName(uplayer));
}
}
if (MConf.get().logFactionDisband)
{
Factions.get().log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
Factions.get().log("The faction "+faction.getName()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
}

View File

@@ -36,7 +36,7 @@ public class CmdFactionsInvite extends FCommand
// Allready member?
if (uplayer.getFaction() == myFaction)
{
msg("%s<i> is already a member of %s", uplayer.getName(), myFaction.getTag());
msg("%s<i> is already a member of %s", uplayer.getName(), myFaction.getName());
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
return;
}

View File

@@ -46,13 +46,13 @@ public class CmdFactionsJoin extends FCommand
if (faction == uplayerFaction)
{
msg("<b>%s %s already a member of %s", uplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme));
msg("<b>%s %s already a member of %s", uplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getName(fme));
return;
}
if (UConf.get(faction).factionMemberLimit > 0 && faction.getUPlayers().size() >= UConf.get(faction).factionMemberLimit)
{
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getTag(fme), UConf.get(faction).factionMemberLimit, uplayer.describeTo(fme, false));
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(fme), UConf.get(faction).factionMemberLimit, uplayer.describeTo(fme, false));
return;
}
@@ -86,10 +86,10 @@ public class CmdFactionsJoin extends FCommand
// Inform
if (!samePlayer)
{
uplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(uplayer, true), faction.getTag(uplayer));
uplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(uplayer, true), faction.getName(uplayer));
}
faction.msg("<i>%s joined your faction.", uplayer.describeTo(faction, true));
fme.msg("<i>%s successfully joined %s.", uplayer.describeTo(fme, true), faction.getTag(fme));
fme.msg("<i>%s successfully joined %s.", uplayer.describeTo(fme, true), faction.getName(fme));
// Apply
uplayer.resetFactionData();
@@ -101,9 +101,9 @@ public class CmdFactionsJoin extends FCommand
if (MConf.get().logFactionJoin)
{
if (samePlayer)
Factions.get().log("%s joined the faction %s.", uplayer.getName(), faction.getTag());
Factions.get().log("%s joined the faction %s.", uplayer.getName(), faction.getName());
else
Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), uplayer.getName(), faction.getTag());
Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), uplayer.getName(), faction.getName());
}
}
}

View File

@@ -72,7 +72,7 @@ public class CmdFactionsKick extends FCommand
if (MConf.get().logFactionKick)
{
Factions.get().log(fme.getDisplayName() + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getTag());
Factions.get().log(fme.getDisplayName() + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getName());
}
// Apply

View File

@@ -57,7 +57,7 @@ public class CmdFactionsList extends FCommand
continue;
}
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
faction.getTag(fme),
faction.getName(fme),
faction.getUPlayersWhereOnline(true).size(),
faction.getUPlayers().size(),
faction.getLandCount(),

View File

@@ -8,20 +8,20 @@ import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.event.FactionsEventTagChange;
import com.massivecraft.factions.event.FactionsEventNameChange;
import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsTag extends FCommand
public class CmdFactionsName extends FCommand
{
public CmdFactionsTag()
public CmdFactionsName()
{
this.addAliases("tag");
this.addAliases("name");
this.addRequiredArg("new tag");
this.addRequiredArg("new name");
this.addRequirements(ReqHasPerm.get(Perm.TAG.node));
this.addRequirements(ReqHasPerm.get(Perm.NAME.node));
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
}
@@ -29,19 +29,19 @@ public class CmdFactionsTag extends FCommand
public void perform()
{
// Arg
String newTag = this.arg(0);
String newName = this.arg(0);
// TODO does not first test cover selfcase?
FactionColl factionColl = FactionColls.get().get(myFaction);
if (factionColl.isTagTaken(newTag) && ! MiscUtil.getComparisonString(newTag).equals(myFaction.getComparisonTag()))
if (factionColl.isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(myFaction.getComparisonName()))
{
msg("<b>That tag is already taken");
msg("<b>That name is already taken");
return;
}
ArrayList<String> errors = new ArrayList<String>();
errors.addAll(factionColl.validateTag(newTag));
errors.addAll(factionColl.validateName(newName));
if (errors.size() > 0)
{
sendMessage(errors);
@@ -49,24 +49,24 @@ public class CmdFactionsTag extends FCommand
}
// Event
FactionsEventTagChange event = new FactionsEventTagChange(sender, myFaction, newTag);
FactionsEventNameChange event = new FactionsEventNameChange(sender, myFaction, newName);
event.run();
if (event.isCancelled()) return;
newTag = event.getNewTag();
newName = event.getNewName();
// Apply
String oldtag = myFaction.getTag();
myFaction.setTag(newTag);
String oldName = myFaction.getName();
myFaction.setName(newName);
// Inform
myFaction.msg("%s<i> changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
myFaction.msg("%s<i> changed your faction name to %s", fme.describeTo(myFaction, true), myFaction.getName(myFaction));
for (Faction faction : FactionColls.get().get(myFaction).getAll())
{
if (faction == myFaction)
{
continue;
}
faction.msg("<i>The faction %s<i> changed their name to %s.", fme.getColorTo(faction)+oldtag, myFaction.getTag(faction));
faction.msg("<i>The faction %s<i> changed their name to %s.", fme.getColorTo(faction)+oldName, myFaction.getName(faction));
}
}

View File

@@ -30,9 +30,9 @@ public class CmdFactionsPowerBoost extends FCommand
faction.setPowerBoost(amount);
msg("<i>"+faction.getTag()+" now has a power bonus/penalty of "+amount+" to min and max power levels.");
msg("<i>"+faction.getName()+" now has a power bonus/penalty of "+amount+" to min and max power levels.");
// TODO: Inconsistent. Why is there no boolean to toggle this logging of?
Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+faction.getTag()+" to "+amount+".");
Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+faction.getName()+" to "+amount+".");
}
}

View File

@@ -47,7 +47,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
if (myFaction.getRelationWish(otherFaction) == newRelation)
{
msg("<b>You already have that relation wish set with %s.", otherFaction.getTag());
msg("<b>You already have that relation wish set with %s.", otherFaction.getName());
return;
}
@@ -71,7 +71,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
else
{
otherFaction.msg("%s<i> wishes to be %s.", myFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
otherFaction.msg("<i>Type <c>/"+ConfServer.baseCommandAliases.get(0)+" "+newRelation+" "+myFaction.getTag()+"<i> to accept.");
otherFaction.msg("<i>Type <c>/"+ConfServer.baseCommandAliases.get(0)+" "+newRelation+" "+myFaction.getName()+"<i> to accept.");
myFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(myFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
}

View File

@@ -63,7 +63,7 @@ public class CmdFactionsSethome extends FCommand
faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
if (faction != myFaction)
{
fme.msg("<b>You have set the home for the "+faction.getTag(fme)+"<i> faction.");
fme.msg("<b>You have set the home for the "+faction.getName(fme)+"<i> faction.");
}
}

View File

@@ -43,7 +43,7 @@ public class CmdFactionsShow extends FCommand
Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER);
Collection<UPlayer> recruits = faction.getUPlayersWhereRole(Rel.RECRUIT);
msg(Txt.titleize(faction.getTag(fme)));
msg(Txt.titleize(faction.getName(fme)));
msg("<a>Description: <i>%s", faction.getDescription());
// Display important flags
@@ -99,7 +99,7 @@ public class CmdFactionsShow extends FCommand
String sepparator = Txt.parse("<i>")+", ";
// List the relations to other factions
Map<Rel, List<String>> relationTags = faction.getFactionTagsPerRelation(fme, true);
Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(fme, true);
if (faction.getFlag(FFlag.PEACEFUL))
{
@@ -107,11 +107,11 @@ public class CmdFactionsShow extends FCommand
}
else
{
sendMessage(Txt.parse("<a>In Truce with: ") + Txt.implode(relationTags.get(Rel.TRUCE), sepparator));
sendMessage(Txt.parse("<a>In Truce with: ") + Txt.implode(relationNames.get(Rel.TRUCE), sepparator));
}
sendMessage(Txt.parse("<a>Allied to: ") + Txt.implode(relationTags.get(Rel.ALLY), sepparator));
sendMessage(Txt.parse("<a>Enemies: ") + Txt.implode(relationTags.get(Rel.ENEMY), sepparator));
sendMessage(Txt.parse("<a>Allied to: ") + Txt.implode(relationNames.get(Rel.ALLY), sepparator));
sendMessage(Txt.parse("<a>Enemies: ") + Txt.implode(relationNames.get(Rel.ENEMY), sepparator));
// List the members...
List<String> memberOnlineNames = new ArrayList<String>();

View File

@@ -30,15 +30,6 @@ public class CmdFactionsUnclaim extends FCommand
// Apply
if (fme.tryClaim(newFaction, chunk, true, true)) return;
// Inform
// TODO: Move the logging stuff into the try-method
/*myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true));
if (MConf.get().logLandUnclaims)
{
Factions.get().log(fme.getName()+" unclaimed land at ("+chunk.getChunkX()+","+chunk.getChunkZ()+") from the faction: "+oldFaction.getTag());
}*/
}
}

View File

@@ -63,7 +63,7 @@ public class CmdFactionsUnclaimall extends FCommand
// Log
if (MConf.get().logLandUnclaims)
{
Factions.get().log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getTag());
Factions.get().log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getName());
}
}

View File

@@ -39,12 +39,12 @@ public class ARFaction extends ArgReaderAbstract<Faction>
{
ArgResult<Faction> result = new ArgResult<Faction>();
// Faction Tag Exact
result.setResult(this.getColl().getByTag(str));
// Faction Name Exact
result.setResult(this.getColl().getByName(str));
if (result.hasResult()) return result;
// Faction Tag Match
result.setResult(this.getColl().getBestTagMatch(str));
// Faction Name Match
result.setResult(this.getColl().getBestNameMatch(str));
if (result.hasResult()) return result;
// UPlayer Name Exact