Rename Faction Tag to Faction Name. What did tag ever mean? Name makes more sense.
This commit is contained in:
parent
82e380cd3d
commit
5eed71fc67
@ -50,7 +50,7 @@ permissions:
|
|||||||
factions.seechunk: {description: see the chunk you stand in, default: false}
|
factions.seechunk: {description: see the chunk you stand in, default: false}
|
||||||
factions.sethome: {description: set the faction home, default: false}
|
factions.sethome: {description: set the faction home, default: false}
|
||||||
factions.show: {description: show faction information, default: false}
|
factions.show: {description: show faction information, default: false}
|
||||||
factions.tag: {description: set faction tag, default: false}
|
factions.name: {description: set faction name, default: false}
|
||||||
factions.title: {description: set player title, default: false}
|
factions.title: {description: set player title, default: false}
|
||||||
factions.unclaim: {description: unclaim land where you stand, default: false}
|
factions.unclaim: {description: unclaim land where you stand, default: false}
|
||||||
factions.unclaimall: {description: unclaim all land, default: false}
|
factions.unclaimall: {description: unclaim all land, default: false}
|
||||||
@ -95,7 +95,7 @@ permissions:
|
|||||||
factions.seechunk: true
|
factions.seechunk: true
|
||||||
factions.sethome: true
|
factions.sethome: true
|
||||||
factions.show: true
|
factions.show: true
|
||||||
factions.tag: true
|
factions.name: true
|
||||||
factions.title: true
|
factions.title: true
|
||||||
factions.unclaim: true
|
factions.unclaim: true
|
||||||
factions.unclaimall: true
|
factions.unclaimall: true
|
||||||
@ -165,7 +165,7 @@ permissions:
|
|||||||
factions.seechunk: true
|
factions.seechunk: true
|
||||||
factions.sethome: true
|
factions.sethome: true
|
||||||
factions.show: true
|
factions.show: true
|
||||||
factions.tag: true
|
factions.name: true
|
||||||
factions.title: true
|
factions.title: true
|
||||||
factions.unclaim: true
|
factions.unclaim: true
|
||||||
factions.unclaimall: true
|
factions.unclaimall: true
|
||||||
|
@ -15,8 +15,8 @@ import com.massivecraft.factions.chat.modifier.ChatModifierUcf;
|
|||||||
import com.massivecraft.factions.chat.tag.ChatTagRelcolor;
|
import com.massivecraft.factions.chat.tag.ChatTagRelcolor;
|
||||||
import com.massivecraft.factions.chat.tag.ChatTagRole;
|
import com.massivecraft.factions.chat.tag.ChatTagRole;
|
||||||
import com.massivecraft.factions.chat.tag.ChatTagRoleprefix;
|
import com.massivecraft.factions.chat.tag.ChatTagRoleprefix;
|
||||||
import com.massivecraft.factions.chat.tag.ChatTagTag;
|
import com.massivecraft.factions.chat.tag.ChatTagName;
|
||||||
import com.massivecraft.factions.chat.tag.ChatTagTagforce;
|
import com.massivecraft.factions.chat.tag.ChatTagNameforce;
|
||||||
import com.massivecraft.factions.chat.tag.ChatTagTitle;
|
import com.massivecraft.factions.chat.tag.ChatTagTitle;
|
||||||
import com.massivecraft.factions.cmd.*;
|
import com.massivecraft.factions.cmd.*;
|
||||||
import com.massivecraft.factions.entity.Board;
|
import com.massivecraft.factions.entity.Board;
|
||||||
@ -146,8 +146,8 @@ public class Factions extends MPlugin
|
|||||||
ChatTagRelcolor.get().register();
|
ChatTagRelcolor.get().register();
|
||||||
ChatTagRole.get().register();
|
ChatTagRole.get().register();
|
||||||
ChatTagRoleprefix.get().register();
|
ChatTagRoleprefix.get().register();
|
||||||
ChatTagTag.get().register();
|
ChatTagName.get().register();
|
||||||
ChatTagTagforce.get().register();
|
ChatTagNameforce.get().register();
|
||||||
ChatTagTitle.get().register();
|
ChatTagTitle.get().register();
|
||||||
|
|
||||||
postEnable();
|
postEnable();
|
||||||
|
@ -52,7 +52,7 @@ public enum Perm
|
|||||||
SEE_CHUNK("seechunk"),
|
SEE_CHUNK("seechunk"),
|
||||||
SETHOME("sethome"),
|
SETHOME("sethome"),
|
||||||
SHOW("show"),
|
SHOW("show"),
|
||||||
TAG("tag"),
|
NAME("name"),
|
||||||
TITLE("title"),
|
TITLE("title"),
|
||||||
UNCLAIM("unclaim"),
|
UNCLAIM("unclaim"),
|
||||||
UNCLAIM_ALL("unclaimall"),
|
UNCLAIM_ALL("unclaimall"),
|
||||||
|
@ -136,7 +136,7 @@ public class TerritoryAccess
|
|||||||
{
|
{
|
||||||
if (list.length() > 0)
|
if (list.length() > 0)
|
||||||
list.append(", ");
|
list.append(", ");
|
||||||
list.append(FactionColls.get().get(universeExtractable).get(factionID).getTag());
|
list.append(FactionColls.get().get(universeExtractable).get(factionID).getName());
|
||||||
}
|
}
|
||||||
return list.toString();
|
return list.toString();
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,15 @@ import com.massivecraft.factions.chat.ChatTagAbstract;
|
|||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.UPlayer;
|
import com.massivecraft.factions.entity.UPlayer;
|
||||||
|
|
||||||
public class ChatTagTag extends ChatTagAbstract
|
public class ChatTagName extends ChatTagAbstract
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private ChatTagTag() { super("factions_tag"); }
|
private ChatTagName() { super("factions_name"); }
|
||||||
private static ChatTagTag i = new ChatTagTag();
|
private static ChatTagName i = new ChatTagName();
|
||||||
public static ChatTagTag get() { return i; }
|
public static ChatTagName get() { return i; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// OVERRIDE
|
// OVERRIDE
|
||||||
@ -23,7 +23,7 @@ public class ChatTagTag extends ChatTagAbstract
|
|||||||
{
|
{
|
||||||
Faction faction = fsender.getFaction();
|
Faction faction = fsender.getFaction();
|
||||||
if (faction.isNone()) return "";
|
if (faction.isNone()) return "";
|
||||||
return faction.getTag();
|
return faction.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -3,15 +3,15 @@ package com.massivecraft.factions.chat.tag;
|
|||||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||||
import com.massivecraft.factions.entity.UPlayer;
|
import com.massivecraft.factions.entity.UPlayer;
|
||||||
|
|
||||||
public class ChatTagTagforce extends ChatTagAbstract
|
public class ChatTagNameforce extends ChatTagAbstract
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private ChatTagTagforce() { super("factions_tagforce"); }
|
private ChatTagNameforce() { super("factions_nameforce"); }
|
||||||
private static ChatTagTagforce i = new ChatTagTagforce();
|
private static ChatTagNameforce i = new ChatTagNameforce();
|
||||||
public static ChatTagTagforce get() { return i; }
|
public static ChatTagNameforce get() { return i; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// OVERRIDE
|
// OVERRIDE
|
||||||
@ -20,7 +20,7 @@ public class ChatTagTagforce extends ChatTagAbstract
|
|||||||
@Override
|
@Override
|
||||||
public String getReplacement(UPlayer fsender, UPlayer frecipient)
|
public String getReplacement(UPlayer fsender, UPlayer frecipient)
|
||||||
{
|
{
|
||||||
return fsender.getFaction().getTag();
|
return fsender.getFaction().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -40,7 +40,7 @@ public class CmdFactions extends FCommand
|
|||||||
public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk();
|
public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk();
|
||||||
public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
|
public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
|
||||||
public CmdFactionsShow cmdFactionsShow = new CmdFactionsShow();
|
public CmdFactionsShow cmdFactionsShow = new CmdFactionsShow();
|
||||||
public CmdFactionsTag cmdFactionsTag = new CmdFactionsTag();
|
public CmdFactionsName cmdFactionsName = new CmdFactionsName();
|
||||||
public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
|
public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
|
||||||
public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim();
|
public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim();
|
||||||
public CmdFactionsUnclaimall cmdFactionsUnclaimall = new CmdFactionsUnclaimall();
|
public CmdFactionsUnclaimall cmdFactionsUnclaimall = new CmdFactionsUnclaimall();
|
||||||
@ -66,7 +66,7 @@ public class CmdFactions extends FCommand
|
|||||||
this.addSubCommand(this.cmdFactionsHome);
|
this.addSubCommand(this.cmdFactionsHome);
|
||||||
this.addSubCommand(this.cmdFactionsCreate);
|
this.addSubCommand(this.cmdFactionsCreate);
|
||||||
this.addSubCommand(this.cmdFactionsSethome);
|
this.addSubCommand(this.cmdFactionsSethome);
|
||||||
this.addSubCommand(this.cmdFactionsTag);
|
this.addSubCommand(this.cmdFactionsName);
|
||||||
this.addSubCommand(this.cmdFactionsDemote);
|
this.addSubCommand(this.cmdFactionsDemote);
|
||||||
this.addSubCommand(this.cmdFactionsDescription);
|
this.addSubCommand(this.cmdFactionsDescription);
|
||||||
this.addSubCommand(this.cmdFactionsPerm);
|
this.addSubCommand(this.cmdFactionsPerm);
|
||||||
|
@ -82,7 +82,7 @@ public class CmdFactionsAccess extends FCommand
|
|||||||
Faction targetFaction = this.arg(1, ARFaction.get(myFaction), myFaction);
|
Faction targetFaction = this.arg(1, ARFaction.get(myFaction), myFaction);
|
||||||
if (targetFaction == null) return;
|
if (targetFaction == null) return;
|
||||||
added = territory.toggleFaction(targetFaction);
|
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"));
|
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)
|
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 players = territory.fplayerList();
|
||||||
String factions = territory.factionList(locFaction);
|
String factions = territory.factionList(locFaction);
|
||||||
|
@ -22,7 +22,7 @@ public class CmdFactionsCreate extends FCommand
|
|||||||
{
|
{
|
||||||
this.addAliases("create");
|
this.addAliases("create");
|
||||||
|
|
||||||
this.addRequiredArg("faction tag");
|
this.addRequiredArg("name");
|
||||||
|
|
||||||
this.addRequirements(ReqHasPerm.get(Perm.CREATE.node));
|
this.addRequirements(ReqHasPerm.get(Perm.CREATE.node));
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ public class CmdFactionsCreate extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
String newTag = this.arg(0);
|
String newName = this.arg(0);
|
||||||
|
|
||||||
// Verify
|
// Verify
|
||||||
if (fme.getFaction().isNormal())
|
if (fme.getFaction().isNormal())
|
||||||
@ -42,16 +42,16 @@ public class CmdFactionsCreate extends FCommand
|
|||||||
|
|
||||||
FactionColl coll = FactionColls.get().get(fme);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> tagValidationErrors = coll.validateTag(newTag);
|
ArrayList<String> nameValidationErrors = coll.validateName(newName);
|
||||||
if (tagValidationErrors.size() > 0)
|
if (nameValidationErrors.size() > 0)
|
||||||
{
|
{
|
||||||
sendMessage(tagValidationErrors);
|
sendMessage(nameValidationErrors);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,13 +59,13 @@ public class CmdFactionsCreate extends FCommand
|
|||||||
String factionId = coll.getIdStrategy().generate(coll);
|
String factionId = coll.getIdStrategy().generate(coll);
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newTag);
|
FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newName);
|
||||||
createEvent.run();
|
createEvent.run();
|
||||||
if (createEvent.isCancelled()) return;
|
if (createEvent.isCancelled()) return;
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
Faction faction = coll.create(factionId);
|
Faction faction = coll.create(factionId);
|
||||||
faction.setTag(newTag);
|
faction.setName(newName);
|
||||||
|
|
||||||
fme.setRole(Rel.LEADER);
|
fme.setRole(Rel.LEADER);
|
||||||
fme.setFaction(faction);
|
fme.setFaction(faction);
|
||||||
@ -77,14 +77,14 @@ public class CmdFactionsCreate extends FCommand
|
|||||||
// Inform
|
// Inform
|
||||||
for (UPlayer follower : UPlayerColls.get().get(fme).getAllOnline())
|
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());
|
msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
|
||||||
|
|
||||||
if (MConf.get().logFactionCreate)
|
if (MConf.get().logFactionCreate)
|
||||||
{
|
{
|
||||||
Factions.get().log(fme.getName()+" created a new faction: "+newTag);
|
Factions.get().log(fme.getName()+" created a new faction: "+newName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,13 +67,13 @@ public class CmdFactionsDisband extends FCommand
|
|||||||
}
|
}
|
||||||
else
|
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)
|
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())+".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class CmdFactionsInvite extends FCommand
|
|||||||
// Allready member?
|
// Allready member?
|
||||||
if (uplayer.getFaction() == myFaction)
|
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));
|
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -46,13 +46,13 @@ public class CmdFactionsJoin extends FCommand
|
|||||||
|
|
||||||
if (faction == uplayerFaction)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UConf.get(faction).factionMemberLimit > 0 && faction.getUPlayers().size() >= UConf.get(faction).factionMemberLimit)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,10 +86,10 @@ public class CmdFactionsJoin extends FCommand
|
|||||||
// Inform
|
// Inform
|
||||||
if (!samePlayer)
|
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));
|
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
|
// Apply
|
||||||
uplayer.resetFactionData();
|
uplayer.resetFactionData();
|
||||||
@ -101,9 +101,9 @@ public class CmdFactionsJoin extends FCommand
|
|||||||
if (MConf.get().logFactionJoin)
|
if (MConf.get().logFactionJoin)
|
||||||
{
|
{
|
||||||
if (samePlayer)
|
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
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public class CmdFactionsKick extends FCommand
|
|||||||
|
|
||||||
if (MConf.get().logFactionKick)
|
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
|
// Apply
|
||||||
|
@ -57,7 +57,7 @@ public class CmdFactionsList extends FCommand
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
||||||
faction.getTag(fme),
|
faction.getName(fme),
|
||||||
faction.getUPlayersWhereOnline(true).size(),
|
faction.getUPlayersWhereOnline(true).size(),
|
||||||
faction.getUPlayers().size(),
|
faction.getUPlayers().size(),
|
||||||
faction.getLandCount(),
|
faction.getLandCount(),
|
||||||
|
@ -8,20 +8,20 @@ import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
|||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColl;
|
||||||
import com.massivecraft.factions.entity.FactionColls;
|
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.factions.util.MiscUtil;
|
||||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
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));
|
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,19 +29,19 @@ public class CmdFactionsTag extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Arg
|
// Arg
|
||||||
String newTag = this.arg(0);
|
String newName = this.arg(0);
|
||||||
|
|
||||||
// TODO does not first test cover selfcase?
|
// TODO does not first test cover selfcase?
|
||||||
|
|
||||||
FactionColl factionColl = FactionColls.get().get(myFaction);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> errors = new ArrayList<String>();
|
ArrayList<String> errors = new ArrayList<String>();
|
||||||
errors.addAll(factionColl.validateTag(newTag));
|
errors.addAll(factionColl.validateName(newName));
|
||||||
if (errors.size() > 0)
|
if (errors.size() > 0)
|
||||||
{
|
{
|
||||||
sendMessage(errors);
|
sendMessage(errors);
|
||||||
@ -49,24 +49,24 @@ public class CmdFactionsTag extends FCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
FactionsEventTagChange event = new FactionsEventTagChange(sender, myFaction, newTag);
|
FactionsEventNameChange event = new FactionsEventNameChange(sender, myFaction, newName);
|
||||||
event.run();
|
event.run();
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
newTag = event.getNewTag();
|
newName = event.getNewName();
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
String oldtag = myFaction.getTag();
|
String oldName = myFaction.getName();
|
||||||
myFaction.setTag(newTag);
|
myFaction.setName(newName);
|
||||||
|
|
||||||
// Inform
|
// 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())
|
for (Faction faction : FactionColls.get().get(myFaction).getAll())
|
||||||
{
|
{
|
||||||
if (faction == myFaction)
|
if (faction == myFaction)
|
||||||
{
|
{
|
||||||
continue;
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -30,9 +30,9 @@ public class CmdFactionsPowerBoost extends FCommand
|
|||||||
|
|
||||||
faction.setPowerBoost(amount);
|
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?
|
// 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+".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
|
|||||||
|
|
||||||
if (myFaction.getRelationWish(otherFaction) == newRelation)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
otherFaction.msg("%s<i> wishes to be %s.", myFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
|
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());
|
myFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(myFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class CmdFactionsSethome extends FCommand
|
|||||||
faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
|
faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
|
||||||
if (faction != myFaction)
|
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class CmdFactionsShow extends FCommand
|
|||||||
Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER);
|
Collection<UPlayer> normals = faction.getUPlayersWhereRole(Rel.MEMBER);
|
||||||
Collection<UPlayer> recruits = faction.getUPlayersWhereRole(Rel.RECRUIT);
|
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());
|
msg("<a>Description: <i>%s", faction.getDescription());
|
||||||
|
|
||||||
// Display important flags
|
// Display important flags
|
||||||
@ -99,7 +99,7 @@ public class CmdFactionsShow extends FCommand
|
|||||||
String sepparator = Txt.parse("<i>")+", ";
|
String sepparator = Txt.parse("<i>")+", ";
|
||||||
|
|
||||||
// List the relations to other factions
|
// 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))
|
if (faction.getFlag(FFlag.PEACEFUL))
|
||||||
{
|
{
|
||||||
@ -107,11 +107,11 @@ public class CmdFactionsShow extends FCommand
|
|||||||
}
|
}
|
||||||
else
|
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>Allied to: ") + Txt.implode(relationNames.get(Rel.ALLY), sepparator));
|
||||||
sendMessage(Txt.parse("<a>Enemies: ") + Txt.implode(relationTags.get(Rel.ENEMY), sepparator));
|
sendMessage(Txt.parse("<a>Enemies: ") + Txt.implode(relationNames.get(Rel.ENEMY), sepparator));
|
||||||
|
|
||||||
// List the members...
|
// List the members...
|
||||||
List<String> memberOnlineNames = new ArrayList<String>();
|
List<String> memberOnlineNames = new ArrayList<String>();
|
||||||
|
@ -30,15 +30,6 @@ public class CmdFactionsUnclaim extends FCommand
|
|||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
if (fme.tryClaim(newFaction, chunk, true, true)) return;
|
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());
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class CmdFactionsUnclaimall extends FCommand
|
|||||||
// Log
|
// Log
|
||||||
if (MConf.get().logLandUnclaims)
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,12 +39,12 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
|||||||
{
|
{
|
||||||
ArgResult<Faction> result = new ArgResult<Faction>();
|
ArgResult<Faction> result = new ArgResult<Faction>();
|
||||||
|
|
||||||
// Faction Tag Exact
|
// Faction Name Exact
|
||||||
result.setResult(this.getColl().getByTag(str));
|
result.setResult(this.getColl().getByName(str));
|
||||||
if (result.hasResult()) return result;
|
if (result.hasResult()) return result;
|
||||||
|
|
||||||
// Faction Tag Match
|
// Faction Name Match
|
||||||
result.setResult(this.getColl().getBestTagMatch(str));
|
result.setResult(this.getColl().getBestNameMatch(str));
|
||||||
if (result.hasResult()) return result;
|
if (result.hasResult()) return result;
|
||||||
|
|
||||||
// UPlayer Name Exact
|
// UPlayer Name Exact
|
||||||
|
@ -270,7 +270,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
|||||||
ArrayList<String> ret = new ArrayList<String>();
|
ArrayList<String> ret = new ArrayList<String>();
|
||||||
Faction centerFaction = this.getFactionAt(centerPs);
|
Faction centerFaction = this.getFactionAt(centerPs);
|
||||||
|
|
||||||
ret.add(Txt.titleize("("+centerPs.getChunkX() + "," + centerPs.getChunkZ()+") "+centerFaction.getTag(observer)));
|
ret.add(Txt.titleize("("+centerPs.getChunkX() + "," + centerPs.getChunkZ()+") "+centerFaction.getName(observer)));
|
||||||
|
|
||||||
int halfWidth = Const.MAP_WIDTH / 2;
|
int halfWidth = Const.MAP_WIDTH / 2;
|
||||||
int halfHeight = Const.MAP_HEIGHT / 2;
|
int halfHeight = Const.MAP_HEIGHT / 2;
|
||||||
@ -280,7 +280,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
|||||||
int width = halfWidth * 2 + 1;
|
int width = halfWidth * 2 + 1;
|
||||||
int height = halfHeight * 2 + 1;
|
int height = halfHeight * 2 + 1;
|
||||||
|
|
||||||
//Make room for the list of tags
|
// Make room for the list of names
|
||||||
height--;
|
height--;
|
||||||
|
|
||||||
Map<Faction, Character> fList = new HashMap<Faction, Character>();
|
Map<Faction, Character> fList = new HashMap<Faction, Character>();
|
||||||
@ -327,7 +327,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
|||||||
String fRow = "";
|
String fRow = "";
|
||||||
for (Faction keyfaction : fList.keySet())
|
for (Faction keyfaction : fList.keySet())
|
||||||
{
|
{
|
||||||
fRow += ""+keyfaction.getColorTo(observer) + fList.get(keyfaction) + ": " + keyfaction.getTag() + " ";
|
fRow += ""+keyfaction.getColorTo(observer) + fList.get(keyfaction) + ": " + keyfaction.getName() + " ";
|
||||||
}
|
}
|
||||||
fRow = fRow.trim();
|
fRow = fRow.trim();
|
||||||
ret.add(fRow);
|
ret.add(fRow);
|
||||||
|
@ -43,7 +43,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
@Override
|
@Override
|
||||||
public Faction load(Faction that)
|
public Faction load(Faction that)
|
||||||
{
|
{
|
||||||
this.setTag(that.tag);
|
this.setName(that.name);
|
||||||
this.setDescription(that.description);
|
this.setDescription(that.description);
|
||||||
this.setHome(that.home);
|
this.setHome(that.home);
|
||||||
this.setPowerBoost(that.powerBoost);
|
this.setPowerBoost(that.powerBoost);
|
||||||
@ -62,11 +62,11 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
// In this section of the source code we place the field declarations only.
|
// In this section of the source code we place the field declarations only.
|
||||||
// Each field has it's own section further down since just the getter and setter logic takes up quite some place.
|
// Each field has it's own section further down since just the getter and setter logic takes up quite some place.
|
||||||
|
|
||||||
// TODO: The faction "tag" could/should also have been called "name".
|
|
||||||
// The actual faction id looks something like "54947df8-0e9e-4471-a2f9-9af509fb5889" and that is not too easy to remember for humans.
|
// The actual faction id looks something like "54947df8-0e9e-4471-a2f9-9af509fb5889" and that is not too easy to remember for humans.
|
||||||
// Thus we make use of a name. Since the id is used in all foreign key situations changing the name is fine.
|
// Thus we make use of a name. Since the id is used in all foreign key situations changing the name is fine.
|
||||||
// Null should never happen. The tag must not be null.
|
// Null should never happen. The name must not be null.
|
||||||
private String tag = null;
|
@SerializedName("tag")
|
||||||
|
private String name = null;
|
||||||
|
|
||||||
// Factions can optionally set a description for themselves.
|
// Factions can optionally set a description for themselves.
|
||||||
// This description can for example be seen in territorial alerts.
|
// This description can for example be seen in territorial alerts.
|
||||||
@ -124,18 +124,17 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FIELD: tag
|
// FIELD: name
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// TODO: Rename tag --> name ?
|
|
||||||
|
|
||||||
// RAW
|
// RAW
|
||||||
|
|
||||||
public String getTag()
|
public String getName()
|
||||||
{
|
{
|
||||||
String ret = this.tag;
|
String ret = this.name;
|
||||||
|
|
||||||
UConf uconf = UConf.get(this);
|
UConf uconf = UConf.get(this);
|
||||||
if (uconf != null && UConf.get(this).factionTagForceUpperCase)
|
if (uconf != null && UConf.get(this).factionNameForceUpperCase)
|
||||||
{
|
{
|
||||||
ret = ret.toUpperCase();
|
ret = ret.toUpperCase();
|
||||||
}
|
}
|
||||||
@ -143,34 +142,34 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTag(String str)
|
public void setName(String str)
|
||||||
{
|
{
|
||||||
UConf uconf = UConf.get(this);
|
UConf uconf = UConf.get(this);
|
||||||
if (uconf != null && UConf.get(this).factionTagForceUpperCase)
|
if (uconf != null && UConf.get(this).factionNameForceUpperCase)
|
||||||
{
|
{
|
||||||
str = str.toUpperCase();
|
str = str.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tag = str;
|
this.name = str;
|
||||||
this.changed();
|
this.changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FINER
|
// FINER
|
||||||
|
|
||||||
public String getComparisonTag()
|
public String getComparisonName()
|
||||||
{
|
{
|
||||||
return MiscUtil.getComparisonString(this.getTag());
|
return MiscUtil.getComparisonString(this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTag(String prefix)
|
public String getName(String prefix)
|
||||||
{
|
{
|
||||||
return prefix + this.getTag();
|
return prefix + this.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTag(RelationParticipator observer)
|
public String getName(RelationParticipator observer)
|
||||||
{
|
{
|
||||||
if (observer == null) return getTag();
|
if (observer == null) return getName();
|
||||||
return this.getTag(this.getColorTo(observer).toString());
|
return this.getName(this.getColorTo(observer).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -411,13 +410,13 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
|
|
||||||
// TODO: What is this and where is it used?
|
// TODO: What is this and where is it used?
|
||||||
|
|
||||||
public Map<Rel, List<String>> getFactionTagsPerRelation(RelationParticipator rp)
|
public Map<Rel, List<String>> getFactionNamesPerRelation(RelationParticipator rp)
|
||||||
{
|
{
|
||||||
return getFactionTagsPerRelation(rp, false);
|
return getFactionNamesPerRelation(rp, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// onlyNonNeutral option provides substantial performance boost on large servers for listing only non-neutral factions
|
// onlyNonNeutral option provides substantial performance boost on large servers for listing only non-neutral factions
|
||||||
public Map<Rel, List<String>> getFactionTagsPerRelation(RelationParticipator rp, boolean onlyNonNeutral)
|
public Map<Rel, List<String>> getFactionNamesPerRelation(RelationParticipator rp, boolean onlyNonNeutral)
|
||||||
{
|
{
|
||||||
Map<Rel, List<String>> ret = new HashMap<Rel, List<String>>();
|
Map<Rel, List<String>> ret = new HashMap<Rel, List<String>>();
|
||||||
for (Rel rel : Rel.values())
|
for (Rel rel : Rel.values())
|
||||||
@ -428,7 +427,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
{
|
{
|
||||||
Rel relation = faction.getRelationTo(this);
|
Rel relation = faction.getRelationTo(this);
|
||||||
if (onlyNonNeutral && relation == Rel.NEUTRAL) continue;
|
if (onlyNonNeutral && relation == Rel.NEUTRAL) continue;
|
||||||
ret.get(relation).add(faction.getTag(rp));
|
ret.get(relation).add(faction.getName(rp));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -815,12 +814,12 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
// no members left and faction isn't permanent, so disband it
|
// no members left and faction isn't permanent, so disband it
|
||||||
if (MConf.get().logFactionDisband)
|
if (MConf.get().logFactionDisband)
|
||||||
{
|
{
|
||||||
Factions.get().log("The faction "+this.getTag()+" ("+this.getId()+") has been disbanded since it has no members left.");
|
Factions.get().log("The faction "+this.getName()+" ("+this.getId()+") has been disbanded since it has no members left.");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (UPlayer uplayer : UPlayerColls.get().get(this).getAllOnline())
|
for (UPlayer uplayer : UPlayerColls.get().get(this).getAllOnline())
|
||||||
{
|
{
|
||||||
uplayer.msg("The faction %s<i> was disbanded.", this.getTag(uplayer));
|
uplayer.msg("The faction %s<i> was disbanded.", this.getName(uplayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.detach();
|
this.detach();
|
||||||
@ -834,7 +833,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
|
|
||||||
replacements.get(0).setRole(Rel.LEADER);
|
replacements.get(0).setRole(Rel.LEADER);
|
||||||
this.msg("<i>Faction leader <h>%s<i> has been removed. %s<i> has been promoted as the new faction leader.", oldLeader == null ? "" : oldLeader.getName(), replacements.get(0).getName());
|
this.msg("<i>Faction leader <h>%s<i> has been removed. %s<i> has been promoted as the new faction leader.", oldLeader == null ? "" : oldLeader.getName(), replacements.get(0).getName());
|
||||||
Factions.get().log("Faction "+this.getTag()+" ("+this.getId()+") leader was removed. Replacement leader: "+replacements.get(0).getName());
|
Factions.get().log("Faction "+this.getName()+" ("+this.getId()+") leader was removed. Replacement leader: "+replacements.get(0).getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ public class FactionColl extends Coll<Faction>
|
|||||||
|
|
||||||
faction = this.create(id);
|
faction = this.create(id);
|
||||||
|
|
||||||
faction.setTag(ChatColor.DARK_GREEN+"Wilderness");
|
faction.setName(ChatColor.DARK_GREEN+"Wilderness");
|
||||||
faction.setDescription(null);
|
faction.setDescription(null);
|
||||||
faction.setOpen(false);
|
faction.setOpen(false);
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ public class FactionColl extends Coll<Faction>
|
|||||||
|
|
||||||
faction = this.create(id);
|
faction = this.create(id);
|
||||||
|
|
||||||
faction.setTag("SafeZone");
|
faction.setName("SafeZone");
|
||||||
faction.setDescription("Free from PVP and monsters");
|
faction.setDescription("Free from PVP and monsters");
|
||||||
faction.setOpen(false);
|
faction.setOpen(false);
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ public class FactionColl extends Coll<Faction>
|
|||||||
|
|
||||||
faction = this.create(id);
|
faction = this.create(id);
|
||||||
|
|
||||||
faction.setTag("WarZone");
|
faction.setName("WarZone");
|
||||||
faction.setDescription("Not the safest place to be");
|
faction.setDescription("Not the safest place to be");
|
||||||
faction.setOpen(false);
|
faction.setOpen(false);
|
||||||
|
|
||||||
@ -246,40 +246,40 @@ public class FactionColl extends Coll<Faction>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FACTION TAG
|
// FACTION NAME
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public ArrayList<String> validateTag(String str)
|
public ArrayList<String> validateName(String str)
|
||||||
{
|
{
|
||||||
ArrayList<String> errors = new ArrayList<String>();
|
ArrayList<String> errors = new ArrayList<String>();
|
||||||
|
|
||||||
if (MiscUtil.getComparisonString(str).length() < UConf.get(this).factionTagLengthMin)
|
if (MiscUtil.getComparisonString(str).length() < UConf.get(this).factionNameLengthMin)
|
||||||
{
|
{
|
||||||
errors.add(Txt.parse("<i>The faction tag can't be shorter than <h>%s<i> chars.", UConf.get(this).factionTagLengthMin));
|
errors.add(Txt.parse("<i>The faction name can't be shorter than <h>%s<i> chars.", UConf.get(this).factionNameLengthMin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str.length() > UConf.get(this).factionTagLengthMax)
|
if (str.length() > UConf.get(this).factionNameLengthMax)
|
||||||
{
|
{
|
||||||
errors.add(Txt.parse("<i>The faction tag can't be longer than <h>%s<i> chars.", UConf.get(this).factionTagLengthMax));
|
errors.add(Txt.parse("<i>The faction name can't be longer than <h>%s<i> chars.", UConf.get(this).factionNameLengthMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (char c : str.toCharArray())
|
for (char c : str.toCharArray())
|
||||||
{
|
{
|
||||||
if ( ! MiscUtil.substanceChars.contains(String.valueOf(c)))
|
if ( ! MiscUtil.substanceChars.contains(String.valueOf(c)))
|
||||||
{
|
{
|
||||||
errors.add(Txt.parse("<i>Faction tag must be alphanumeric. \"<h>%s<i>\" is not allowed.", c));
|
errors.add(Txt.parse("<i>Faction name must be alphanumeric. \"<h>%s<i>\" is not allowed.", c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Faction getByTag(String str)
|
public Faction getByName(String str)
|
||||||
{
|
{
|
||||||
String compStr = MiscUtil.getComparisonString(str);
|
String compStr = MiscUtil.getComparisonString(str);
|
||||||
for (Faction faction : this.getAll())
|
for (Faction faction : this.getAll())
|
||||||
{
|
{
|
||||||
if (faction.getComparisonTag().equals(compStr))
|
if (faction.getComparisonName().equals(compStr))
|
||||||
{
|
{
|
||||||
return faction;
|
return faction;
|
||||||
}
|
}
|
||||||
@ -287,24 +287,24 @@ public class FactionColl extends Coll<Faction>
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Faction getBestTagMatch(String searchFor)
|
public Faction getBestNameMatch(String searchFor)
|
||||||
{
|
{
|
||||||
Map<String, Faction> tag2faction = new HashMap<String, Faction>();
|
Map<String, Faction> name2faction = new HashMap<String, Faction>();
|
||||||
|
|
||||||
// TODO: Slow index building
|
// TODO: Slow index building
|
||||||
for (Faction faction : this.getAll())
|
for (Faction faction : this.getAll())
|
||||||
{
|
{
|
||||||
tag2faction.put(ChatColor.stripColor(faction.getTag()), faction);
|
name2faction.put(ChatColor.stripColor(faction.getName()), faction);
|
||||||
}
|
}
|
||||||
|
|
||||||
String tag = Txt.getBestCIStart(tag2faction.keySet(), searchFor);
|
String tag = Txt.getBestCIStart(name2faction.keySet(), searchFor);
|
||||||
if (tag == null) return null;
|
if (tag == null) return null;
|
||||||
return tag2faction.get(tag);
|
return name2faction.get(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTagTaken(String str)
|
public boolean isNameTaken(String str)
|
||||||
{
|
{
|
||||||
return this.getByTag(str) != null;
|
return this.getByName(str) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class MConf extends Entity<MConf>
|
|||||||
// We offer a simple standard way to set the format
|
// We offer a simple standard way to set the format
|
||||||
public boolean chatSetFormat = false;
|
public boolean chatSetFormat = false;
|
||||||
public EventPriority chatSetFormatAt = EventPriority.LOWEST;
|
public EventPriority chatSetFormatAt = EventPriority.LOWEST;
|
||||||
public String chatSetFormatTo = "<{factions_relcolor}§l{factions_roleprefix}§r{factions_relcolor}{factions_tag|rp}§f%1$s> %2$s";
|
public String chatSetFormatTo = "<{factions_relcolor}§l{factions_roleprefix}§r{factions_relcolor}{factions_name|rp}§f%1$s> %2$s";
|
||||||
|
|
||||||
// We offer a simple standard way to parse the chat tags
|
// We offer a simple standard way to parse the chat tags
|
||||||
public boolean chatParseTags = true;
|
public boolean chatParseTags = true;
|
||||||
@ -78,7 +78,7 @@ public class MConf extends Entity<MConf>
|
|||||||
// HeroChat: The Allies Channel
|
// HeroChat: The Allies Channel
|
||||||
public String herochatAlliesName = "Allies";
|
public String herochatAlliesName = "Allies";
|
||||||
public String herochatAlliesNick = "A";
|
public String herochatAlliesNick = "A";
|
||||||
public String herochatAlliesFormat = "{color}[&l{nick}&r&f {factions_relcolor}&l{factions_roleprefix}&r{factions_relcolor}{factions_tag|rp}{sender}{color}] &f{msg}";
|
public String herochatAlliesFormat = "{color}[&l{nick}&r&f {factions_relcolor}&l{factions_roleprefix}&r{factions_relcolor}{factions_name|rp}{sender}{color}] &f{msg}";
|
||||||
public ChatColor herochatAlliesColor = ChatColor.DARK_PURPLE;
|
public ChatColor herochatAlliesColor = ChatColor.DARK_PURPLE;
|
||||||
public int herochatAlliesDistance = 0;
|
public int herochatAlliesDistance = 0;
|
||||||
public boolean herochatAlliesIsShortcutAllowed = false;
|
public boolean herochatAlliesIsShortcutAllowed = false;
|
||||||
|
@ -62,9 +62,9 @@ public class UConf extends Entity<UConf>
|
|||||||
public int factionMemberLimit = 0;
|
public int factionMemberLimit = 0;
|
||||||
public double factionPowerMax = 1000.0;
|
public double factionPowerMax = 1000.0;
|
||||||
|
|
||||||
public int factionTagLengthMin = 3;
|
public int factionNameLengthMin = 3;
|
||||||
public int factionTagLengthMax = 10;
|
public int factionNameLengthMax = 16;
|
||||||
public boolean factionTagForceUpperCase = false;
|
public boolean factionNameForceUpperCase = false;
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CLAIMS
|
// CLAIMS
|
||||||
@ -154,7 +154,7 @@ public class UConf extends Entity<UConf>
|
|||||||
public double econCostInvite = 0.0;
|
public double econCostInvite = 0.0;
|
||||||
public double econCostDeinvite = 0.0;
|
public double econCostDeinvite = 0.0;
|
||||||
public double econCostHome = 0.0;
|
public double econCostHome = 0.0;
|
||||||
public double econCostTag = 0.0;
|
public double econCostName = 0.0;
|
||||||
public double econCostDescription = 0.0;
|
public double econCostDescription = 0.0;
|
||||||
public double econCostTitle = 0.0;
|
public double econCostTitle = 0.0;
|
||||||
public double econCostOpen = 0.0;
|
public double econCostOpen = 0.0;
|
||||||
|
@ -332,7 +332,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// TITLE, NAME, FACTION TAG AND CHAT
|
// TITLE, NAME, FACTION NAME AND CHAT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
@ -340,11 +340,11 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
return this.getFixedId();
|
return this.getFixedId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTag()
|
public String getFactionName()
|
||||||
{
|
{
|
||||||
Faction faction = this.getFaction();
|
Faction faction = this.getFaction();
|
||||||
if (faction.isNone()) return "";
|
if (faction.isNone()) return "";
|
||||||
return faction.getTag();
|
return faction.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base concatenations:
|
// Base concatenations:
|
||||||
@ -372,9 +372,9 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNameAndTag()
|
public String getNameAndFactionName()
|
||||||
{
|
{
|
||||||
return this.getNameAndSomething(this.getTag());
|
return this.getNameAndSomething(this.getFactionName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Colored concatenations:
|
// Colored concatenations:
|
||||||
@ -498,7 +498,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
if (MConf.get().logFactionLeave)
|
if (MConf.get().logFactionLeave)
|
||||||
{
|
{
|
||||||
Factions.get().log(this.getName()+" left the faction: "+myFaction.getTag());
|
Factions.get().log(this.getName()+" left the faction: "+myFaction.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,7 +515,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
myFaction.detach();
|
myFaction.detach();
|
||||||
if (MConf.get().logFactionDisband)
|
if (MConf.get().logFactionDisband)
|
||||||
{
|
{
|
||||||
Factions.get().log("The faction "+myFaction.getTag()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving.");
|
Factions.get().log("The faction "+myFaction.getName()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
if (!oldFaction.hasLandInflation())
|
if (!oldFaction.hasLandInflation())
|
||||||
{
|
{
|
||||||
msg("%s<i> owns this land and is strong enough to keep it.", oldFaction.getTag(this));
|
msg("%s<i> owns this land and is strong enough to keep it.", oldFaction.getName(this));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,19 +23,19 @@ public class FactionsEventCreate extends FactionsEventAbstractSender
|
|||||||
private final String factionId;
|
private final String factionId;
|
||||||
public final String getFactionId() { return this.factionId; }
|
public final String getFactionId() { return this.factionId; }
|
||||||
|
|
||||||
private final String factionTag;
|
private final String factionName;
|
||||||
public final String getFactionTag() { return this.factionTag; }
|
public final String getFactionName() { return this.factionName; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public FactionsEventCreate(CommandSender sender, String universe, String factionId, String factionTag)
|
public FactionsEventCreate(CommandSender sender, String universe, String factionId, String factionName)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.universe = universe;
|
this.universe = universe;
|
||||||
this.factionId = factionId;
|
this.factionId = factionId;
|
||||||
this.factionTag = factionTag;
|
this.factionName = factionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ import org.bukkit.event.HandlerList;
|
|||||||
|
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
|
|
||||||
public class FactionsEventTagChange extends FactionsEventAbstractSender
|
public class FactionsEventNameChange extends FactionsEventAbstractSender
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// REQUIRED EVENT CODE
|
// REQUIRED EVENT CODE
|
||||||
@ -22,19 +22,19 @@ public class FactionsEventTagChange extends FactionsEventAbstractSender
|
|||||||
private final Faction faction;
|
private final Faction faction;
|
||||||
public Faction getFaction() { return this.faction; }
|
public Faction getFaction() { return this.faction; }
|
||||||
|
|
||||||
private String newTag;
|
private String newName;
|
||||||
public String getNewTag() { return this.newTag; }
|
public String getNewName() { return this.newName; }
|
||||||
public void setNewTag(String newTag) { this.newTag = newTag; }
|
public void setNewName(String newName) { this.newName = newName; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public FactionsEventTagChange(CommandSender sender, Faction faction, String newTag)
|
public FactionsEventNameChange(CommandSender sender, Faction faction, String newName)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.faction = faction;
|
this.faction = faction;
|
||||||
this.newTag = newTag;
|
this.newName = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -22,7 +22,7 @@ import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
|||||||
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
|
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
|
||||||
import com.massivecraft.factions.event.FactionsEventOpenChange;
|
import com.massivecraft.factions.event.FactionsEventOpenChange;
|
||||||
import com.massivecraft.factions.event.FactionsEventRelationChange;
|
import com.massivecraft.factions.event.FactionsEventRelationChange;
|
||||||
import com.massivecraft.factions.event.FactionsEventTagChange;
|
import com.massivecraft.factions.event.FactionsEventNameChange;
|
||||||
import com.massivecraft.factions.event.FactionsEventTitleChange;
|
import com.massivecraft.factions.event.FactionsEventTitleChange;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.mcore.money.Money;
|
import com.massivecraft.mcore.money.Money;
|
||||||
@ -88,7 +88,7 @@ public class FactionsListenerEcon implements Listener
|
|||||||
Econ.transferMoney(usender, faction, usender, amount, false);
|
Econ.transferMoney(usender, faction, usender, amount, false);
|
||||||
|
|
||||||
usender.msg("<i>You have been given the disbanded faction's bank, totaling %s.", amountString);
|
usender.msg("<i>You have been given the disbanded faction's bank, totaling %s.", amountString);
|
||||||
Factions.get().log(usender.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+".");
|
Factions.get().log(usender.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getName()+".");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -191,10 +191,10 @@ public class FactionsListenerEcon implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void payForCommand(FactionsEventTagChange event)
|
public void payForCommand(FactionsEventNameChange event)
|
||||||
{
|
{
|
||||||
Double cost = UConf.get(event.getSender()).econCostTag;
|
Double cost = UConf.get(event.getSender()).econCostName;
|
||||||
String desc = Factions.get().getOuterCmdFactions().cmdFactionsTag.getDesc();
|
String desc = Factions.get().getOuterCmdFactions().cmdFactionsName.getDesc();
|
||||||
|
|
||||||
payForAction(event, cost, desc);
|
payForAction(event, cost, desc);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class FactionsListenerMain implements Listener
|
|||||||
}
|
}
|
||||||
else if (factionFrom != factionTo)
|
else if (factionFrom != factionTo)
|
||||||
{
|
{
|
||||||
String msg = Txt.parse("<i>") + " ~ " + factionTo.getTag(uplayer);
|
String msg = Txt.parse("<i>") + " ~ " + factionTo.getName(uplayer);
|
||||||
if (factionTo.hasDescription())
|
if (factionTo.hasDescription())
|
||||||
{
|
{
|
||||||
msg += " - " + factionTo.getDescription();
|
msg += " - " + factionTo.getDescription();
|
||||||
|
@ -24,7 +24,7 @@ public class MiscUtil
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TODO create tag whitelist!!
|
/// TODO create name whitelist!!?
|
||||||
public static HashSet<String> substanceChars = new HashSet<String>(Arrays.asList(new String []{
|
public static HashSet<String> substanceChars = new HashSet<String>(Arrays.asList(new String []{
|
||||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H",
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H",
|
||||||
"I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
"I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
||||||
|
@ -35,7 +35,7 @@ public class RelationUtil
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = thatFaction.getTag();
|
ret = thatFaction.getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (that instanceof UPlayer)
|
else if (that instanceof UPlayer)
|
||||||
@ -51,7 +51,7 @@ public class RelationUtil
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = uplayerthat.getNameAndTag();
|
ret = uplayerthat.getNameAndFactionName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user