First pass at using Txt.
This commit is contained in:
parent
433d45ae4c
commit
61b526e387
@ -13,6 +13,7 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
|
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
|
||||||
import com.massivecraft.factions.integration.LWCFeatures;
|
import com.massivecraft.factions.integration.LWCFeatures;
|
||||||
import com.massivecraft.factions.iface.RelationParticipator;
|
import com.massivecraft.factions.iface.RelationParticipator;
|
||||||
@ -187,7 +188,7 @@ public class Board
|
|||||||
{
|
{
|
||||||
ArrayList<String> ret = new ArrayList<String>();
|
ArrayList<String> ret = new ArrayList<String>();
|
||||||
Faction factionLoc = getFactionAt(flocation);
|
Faction factionLoc = getFactionAt(flocation);
|
||||||
ret.add(Factions.get().txt.titleize("("+flocation.getCoordString()+") "+factionLoc.getTag(observer)));
|
ret.add(Txt.titleize("("+flocation.getCoordString()+") "+factionLoc.getTag(observer)));
|
||||||
|
|
||||||
int halfWidth = ConfServer.mapWidth / 2;
|
int halfWidth = ConfServer.mapWidth / 2;
|
||||||
int halfHeight = ConfServer.mapHeight / 2;
|
int halfHeight = ConfServer.mapHeight / 2;
|
||||||
@ -233,7 +234,7 @@ public class Board
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the compass
|
// Get the compass
|
||||||
ArrayList<String> asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, Factions.get().txt.parse("<a>"));
|
ArrayList<String> asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, Txt.parse("<a>"));
|
||||||
|
|
||||||
// Add the compass
|
// Add the compass
|
||||||
ret.set(1, asciiCompass.get(0)+ret.get(1).substring(3*3));
|
ret.set(1, asciiCompass.get(0)+ret.get(1).substring(3*3));
|
||||||
|
@ -18,6 +18,7 @@ import com.massivecraft.factions.integration.SpoutFeatures;
|
|||||||
import com.massivecraft.factions.integration.Worldguard;
|
import com.massivecraft.factions.integration.Worldguard;
|
||||||
import com.massivecraft.factions.util.RelationUtil;
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
import com.massivecraft.factions.zcore.persist.PlayerEntity;
|
import com.massivecraft.factions.zcore.persist.PlayerEntity;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -450,7 +451,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Faction factionHere = Board.getFactionAt(this.getLastStoodAt());
|
Faction factionHere = Board.getFactionAt(this.getLastStoodAt());
|
||||||
String msg = Factions.get().txt.parse("<i>")+" ~ "+factionHere.getTag(this);
|
String msg = Txt.parse("<i>")+" ~ "+factionHere.getTag(this);
|
||||||
if (factionHere.getDescription().length() > 0)
|
if (factionHere.getDescription().length() > 0)
|
||||||
{
|
{
|
||||||
msg += " - "+factionHere.getDescription();
|
msg += " - "+factionHere.getDescription();
|
||||||
@ -543,11 +544,11 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
if (ConfServer.worldGuardChecking && Worldguard.checkForRegionsInChunk(location))
|
if (ConfServer.worldGuardChecking && Worldguard.checkForRegionsInChunk(location))
|
||||||
{
|
{
|
||||||
// Checks for WorldGuard regions in the chunk attempting to be claimed
|
// Checks for WorldGuard regions in the chunk attempting to be claimed
|
||||||
error = Factions.get().txt.parse("<b>This land is protected");
|
error = Txt.parse("<b>This land is protected");
|
||||||
}
|
}
|
||||||
else if (ConfServer.worldsNoClaiming.contains(flocation.getWorldName()))
|
else if (ConfServer.worldsNoClaiming.contains(flocation.getWorldName()))
|
||||||
{
|
{
|
||||||
error = Factions.get().txt.parse("<b>Sorry, this world has land claiming disabled.");
|
error = Txt.parse("<b>Sorry, this world has land claiming disabled.");
|
||||||
}
|
}
|
||||||
else if (this.hasAdminMode())
|
else if (this.hasAdminMode())
|
||||||
{
|
{
|
||||||
@ -555,7 +556,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
}
|
}
|
||||||
else if (forFaction == currentFaction)
|
else if (forFaction == currentFaction)
|
||||||
{
|
{
|
||||||
error = Factions.get().txt.parse("%s<i> already own this land.", forFaction.describeTo(this, true));
|
error = Txt.parse("%s<i> already own this land.", forFaction.describeTo(this, true));
|
||||||
}
|
}
|
||||||
else if ( ! FPerm.TERRITORY.has(this, forFaction, true))
|
else if ( ! FPerm.TERRITORY.has(this, forFaction, true))
|
||||||
{
|
{
|
||||||
@ -563,23 +564,23 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
}
|
}
|
||||||
else if (forFaction.getFPlayers().size() < ConfServer.claimsRequireMinFactionMembers)
|
else if (forFaction.getFPlayers().size() < ConfServer.claimsRequireMinFactionMembers)
|
||||||
{
|
{
|
||||||
error = Factions.get().txt.parse("Factions must have at least <h>%s<b> members to claim land.", ConfServer.claimsRequireMinFactionMembers);
|
error = Txt.parse("Factions must have at least <h>%s<b> members to claim land.", ConfServer.claimsRequireMinFactionMembers);
|
||||||
}
|
}
|
||||||
else if (ownedLand >= forFaction.getPowerRounded())
|
else if (ownedLand >= forFaction.getPowerRounded())
|
||||||
{
|
{
|
||||||
error = Factions.get().txt.parse("<b>You can't claim more land! You need more power!");
|
error = Txt.parse("<b>You can't claim more land! You need more power!");
|
||||||
}
|
}
|
||||||
else if (ConfServer.claimedLandsMax != 0 && ownedLand >= ConfServer.claimedLandsMax && ! forFaction.getFlag(FFlag.INFPOWER))
|
else if (ConfServer.claimedLandsMax != 0 && ownedLand >= ConfServer.claimedLandsMax && ! forFaction.getFlag(FFlag.INFPOWER))
|
||||||
{
|
{
|
||||||
error = Factions.get().txt.parse("<b>Limit reached. You can't claim more land!");
|
error = Txt.parse("<b>Limit reached. You can't claim more land!");
|
||||||
}
|
}
|
||||||
else if ( ! ConfServer.claimingFromOthersAllowed && currentFaction.isNormal())
|
else if ( ! ConfServer.claimingFromOthersAllowed && currentFaction.isNormal())
|
||||||
{
|
{
|
||||||
error = Factions.get().txt.parse("<b>You may not claim land from others.");
|
error = Txt.parse("<b>You may not claim land from others.");
|
||||||
}
|
}
|
||||||
else if (currentFaction.getRelationTo(forFaction).isAtLeast(Rel.TRUCE) && ! currentFaction.isNone())
|
else if (currentFaction.getRelationTo(forFaction).isAtLeast(Rel.TRUCE) && ! currentFaction.isNone())
|
||||||
{
|
{
|
||||||
error = Factions.get().txt.parse("<b>You can't claim this land due to your relation with the current owner.");
|
error = Txt.parse("<b>You can't claim this land due to your relation with the current owner.");
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
@ -591,20 +592,20 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (ConfServer.claimsCanBeUnconnectedIfOwnedByOtherFaction)
|
if (ConfServer.claimsCanBeUnconnectedIfOwnedByOtherFaction)
|
||||||
error = Factions.get().txt.parse("<b>You can only claim additional land which is connected to your first claim or controlled by another faction!");
|
error = Txt.parse("<b>You can only claim additional land which is connected to your first claim or controlled by another faction!");
|
||||||
else
|
else
|
||||||
error = Factions.get().txt.parse("<b>You can only claim additional land which is connected to your first claim!");
|
error = Txt.parse("<b>You can only claim additional land which is connected to your first claim!");
|
||||||
}
|
}
|
||||||
else if (currentFaction.isNormal())
|
else if (currentFaction.isNormal())
|
||||||
{
|
{
|
||||||
if ( ! currentFaction.hasLandInflation())
|
if ( ! currentFaction.hasLandInflation())
|
||||||
{
|
{
|
||||||
// TODO more messages WARN current faction most importantly
|
// TODO more messages WARN current faction most importantly
|
||||||
error = Factions.get().txt.parse("%s<i> owns this land and is strong enough to keep it.", currentFaction.getTag(this));
|
error = Txt.parse("%s<i> owns this land and is strong enough to keep it.", currentFaction.getTag(this));
|
||||||
}
|
}
|
||||||
else if ( ! Board.isBorderLocation(flocation))
|
else if ( ! Board.isBorderLocation(flocation))
|
||||||
{
|
{
|
||||||
error = Factions.get().txt.parse("<b>You must start claiming land at the border of the territory.");
|
error = Txt.parse("<b>You must start claiming land at the border of the territory.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,6 +690,6 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
|
|
||||||
public void msg(String str, Object... args)
|
public void msg(String str, Object... args)
|
||||||
{
|
{
|
||||||
this.sendMessage(Factions.get().txt.parse(str, args));
|
this.sendMessage(Txt.parse(str, args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import com.massivecraft.factions.integration.Econ;
|
|||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
import com.massivecraft.factions.util.*;
|
import com.massivecraft.factions.util.*;
|
||||||
import com.massivecraft.factions.zcore.persist.Entity;
|
import com.massivecraft.factions.zcore.persist.Entity;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
|
|
||||||
public class Faction extends Entity implements EconomyParticipator
|
public class Faction extends Entity implements EconomyParticipator
|
||||||
@ -507,9 +508,10 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Messages
|
// Messages
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public void msg(String message, Object... args)
|
public void msg(String message, Object... args)
|
||||||
{
|
{
|
||||||
message = Factions.get().txt.parse(message, args);
|
message = Txt.parse(message, args);
|
||||||
|
|
||||||
for (FPlayer fplayer : this.getFPlayersWhereOnline(true))
|
for (FPlayer fplayer : this.getFPlayersWhereOnline(true))
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
|
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
@ -210,19 +211,19 @@ public class FactionColl extends EntityCollection<Faction>
|
|||||||
|
|
||||||
if(MiscUtil.getComparisonString(str).length() < ConfServer.factionTagLengthMin)
|
if(MiscUtil.getComparisonString(str).length() < ConfServer.factionTagLengthMin)
|
||||||
{
|
{
|
||||||
errors.add(Factions.get().txt.parse("<i>The faction tag can't be shorter than <h>%s<i> chars.", ConfServer.factionTagLengthMin));
|
errors.add(Txt.parse("<i>The faction tag can't be shorter than <h>%s<i> chars.", ConfServer.factionTagLengthMin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(str.length() > ConfServer.factionTagLengthMax)
|
if(str.length() > ConfServer.factionTagLengthMax)
|
||||||
{
|
{
|
||||||
errors.add(Factions.get().txt.parse("<i>The faction tag can't be longer than <h>%s<i> chars.", ConfServer.factionTagLengthMax));
|
errors.add(Txt.parse("<i>The faction tag can't be longer than <h>%s<i> chars.", ConfServer.factionTagLengthMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
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(Factions.get().txt.parse("<i>Faction tag must be alphanumeric. \"<h>%s<i>\" is not allowed.", c));
|
errors.add(Txt.parse("<i>Faction tag must be alphanumeric. \"<h>%s<i>\" is not allowed.", c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.zcore.CommandVisibility;
|
import com.massivecraft.factions.zcore.CommandVisibility;
|
||||||
import com.massivecraft.factions.zcore.MCommand;
|
import com.massivecraft.factions.zcore.MCommand;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class CmdAutoHelp extends MCommand<Factions>
|
public class CmdAutoHelp extends MCommand<Factions>
|
||||||
{
|
{
|
||||||
@ -43,6 +44,6 @@ public class CmdAutoHelp extends MCommand<Factions>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage(p.txt.getPage(lines, this.argAsInt(0, 1), "Help for command \""+pcmd.aliases.get(0)+"\""));
|
sendMessage(Txt.getPage(lines, this.argAsInt(0, 1), "Help for command \""+pcmd.aliases.get(0)+"\""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.FFlag;
|
import com.massivecraft.factions.FFlag;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class CmdFlag extends FCommand
|
public class CmdFlag extends FCommand
|
||||||
{
|
{
|
||||||
@ -38,7 +39,7 @@ public class CmdFlag extends FCommand
|
|||||||
|
|
||||||
if ( ! this.argIsSet(1))
|
if ( ! this.argIsSet(1))
|
||||||
{
|
{
|
||||||
msg(p.txt.titleize("Flags for " + faction.describeTo(fme, true)));
|
msg(Txt.titleize("Flags for " + faction.describeTo(fme, true)));
|
||||||
for (FFlag flag : FFlag.values())
|
for (FFlag flag : FFlag.values())
|
||||||
{
|
{
|
||||||
msg(flag.getStateInfo(faction.getFlag(flag), true));
|
msg(flag.getStateInfo(faction.getFlag(flag), true));
|
||||||
@ -50,7 +51,7 @@ public class CmdFlag extends FCommand
|
|||||||
if (flag == null) return;
|
if (flag == null) return;
|
||||||
if ( ! this.argIsSet(2))
|
if ( ! this.argIsSet(2))
|
||||||
{
|
{
|
||||||
msg(p.txt.titleize("Flag for " + faction.describeTo(fme, true)));
|
msg(Txt.titleize("Flag for " + faction.describeTo(fme, true)));
|
||||||
msg(flag.getStateInfo(faction.getFlag(flag), true));
|
msg(flag.getStateInfo(faction.getFlag(flag), true));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,7 +63,7 @@ public class CmdFlag extends FCommand
|
|||||||
if ( ! Perm.FLAG_SET.has(sender, true)) return;
|
if ( ! Perm.FLAG_SET.has(sender, true)) return;
|
||||||
|
|
||||||
// Do the change
|
// Do the change
|
||||||
msg(p.txt.titleize("Flag for " + faction.describeTo(fme, true)));
|
msg(Txt.titleize("Flag for " + faction.describeTo(fme, true)));
|
||||||
faction.setFlag(flag, targetValue);
|
faction.setFlag(flag, targetValue);
|
||||||
msg(flag.getStateInfo(faction.getFlag(flag), true));
|
msg(flag.getStateInfo(faction.getFlag(flag), true));
|
||||||
}
|
}
|
||||||
|
@ -1,179 +0,0 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.ConfServer;
|
|
||||||
import com.massivecraft.factions.Factions;
|
|
||||||
import com.massivecraft.factions.Perm;
|
|
||||||
import com.massivecraft.factions.integration.Econ;
|
|
||||||
|
|
||||||
|
|
||||||
public class CmdHelp extends FCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
public CmdHelp()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
this.aliases.add("help");
|
|
||||||
this.aliases.add("h");
|
|
||||||
this.aliases.add("?");
|
|
||||||
|
|
||||||
//this.requiredArgs.add("");
|
|
||||||
this.optionalArgs.put("page", "1");
|
|
||||||
|
|
||||||
this.permission = Perm.HELP.node;
|
|
||||||
this.disableOnLock = false;
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
|
||||||
senderMustBeMember = false;
|
|
||||||
senderMustBeOfficer = false;
|
|
||||||
senderMustBeLeader = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void perform()
|
|
||||||
{
|
|
||||||
if (helpPages == null) updateHelp();
|
|
||||||
|
|
||||||
int page = this.argAsInt(0, 1);
|
|
||||||
|
|
||||||
sendMessage(p.txt.titleize("Factions Help ("+page+"/"+helpPages.size()+")"));
|
|
||||||
|
|
||||||
page -= 1;
|
|
||||||
|
|
||||||
if (page < 0 || page >= helpPages.size())
|
|
||||||
{
|
|
||||||
msg("<b>This page does not exist");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sendMessage(helpPages.get(page));
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------//
|
|
||||||
// Build the help pages
|
|
||||||
//----------------------------------------------//
|
|
||||||
|
|
||||||
public ArrayList<ArrayList<String>> helpPages;
|
|
||||||
|
|
||||||
public void updateHelp()
|
|
||||||
{
|
|
||||||
helpPages = new ArrayList<ArrayList<String>>();
|
|
||||||
ArrayList<String> pageLines;
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
//pageLines.add( p.cmdBase.cmdHelp.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdList.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdShow.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdPower.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdJoin.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdLeave.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdHome.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.txt.parse("<i>Learn how to create a faction on the next page.") );
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add( p.cmdBase.cmdCreate.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdDescription.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdTag.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.txt.parse("<i>You might want to close it and use invitations:" ));
|
|
||||||
pageLines.add( p.cmdBase.cmdOpen.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdInvite.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdDeinvite.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.txt.parse("<i>And don't forget to set your home:" ));
|
|
||||||
pageLines.add( p.cmdBase.cmdSethome.getUseageTemplate(true) );
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
|
|
||||||
if (Econ.isSetup() && ConfServer.econEnabled && ConfServer.bankEnabled)
|
|
||||||
{
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add( p.txt.parse("<i>Your faction has a bank which is used to pay for certain" ));
|
|
||||||
pageLines.add( p.txt.parse("<i>things, so it will need to have money deposited into it." ));
|
|
||||||
pageLines.add( p.txt.parse("<i>To learn more, use the money command." ));
|
|
||||||
pageLines.add( "" );
|
|
||||||
pageLines.add( p.cmdBase.cmdMoney.getUseageTemplate(true) );
|
|
||||||
pageLines.add( "" );
|
|
||||||
pageLines.add( "" );
|
|
||||||
pageLines.add( "" );
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
}
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add( p.cmdBase.cmdClaim.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdAutoClaim.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdKick.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdPromote.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdDemote.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdOfficer.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdLeader.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdTitle.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.txt.parse("<i>Player titles are just for fun. No rules connected to them." ));
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add( p.cmdBase.cmdMap.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdSeeChunks.getUseageTemplate(true) );
|
|
||||||
pageLines.add(p.txt.parse("<i>Claimed land with ownership set is further protected so"));
|
|
||||||
pageLines.add(p.txt.parse("<i>that only the owner(s), faction admin, and possibly the"));
|
|
||||||
pageLines.add(p.txt.parse("<i>faction moderators have full access."));
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add( p.cmdBase.cmdDisband.getUseageTemplate(true) );
|
|
||||||
pageLines.add("");
|
|
||||||
pageLines.add( p.cmdBase.cmdRelationAlly.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdRelationTruce.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdRelationNeutral.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdRelationEnemy.getUseageTemplate(true) );
|
|
||||||
pageLines.add(p.txt.parse("<i>Set the relation you WISH to have with another faction."));
|
|
||||||
pageLines.add(p.txt.parse("<i>Your default relation with other factions will be neutral."));
|
|
||||||
pageLines.add(p.txt.parse("<i>If BOTH factions choose \"ally\" you will be allies."));
|
|
||||||
pageLines.add(p.txt.parse("<i>If ONE faction chooses \"enemy\" you will be enemies."));
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add(p.txt.parse("<i>You can never hurt members or allies."));
|
|
||||||
pageLines.add(p.txt.parse("<i>You can not hurt neutrals in their own territory."));
|
|
||||||
pageLines.add(p.txt.parse("<i>You can always hurt enemies and players without faction."));
|
|
||||||
pageLines.add("");
|
|
||||||
pageLines.add(p.txt.parse("<i>Damage from enemies is reduced in your own territory."));
|
|
||||||
pageLines.add(p.txt.parse("<i>When you die you lose power. It is restored over time."));
|
|
||||||
pageLines.add(p.txt.parse("<i>The power of a faction is the sum of all member power."));
|
|
||||||
pageLines.add(p.txt.parse("<i>The power of a faction determines how much land it can hold."));
|
|
||||||
pageLines.add(p.txt.parse("<i>You can claim land from factions with too little power."));
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add(p.txt.parse("<i>Only faction members can build and destroy in their own"));
|
|
||||||
pageLines.add(p.txt.parse("<i>territory. Usage of the following items is also restricted:"));
|
|
||||||
pageLines.add(p.txt.parse("<i>Door, Chest, Furnace, Dispenser, Diode."));
|
|
||||||
pageLines.add("");
|
|
||||||
pageLines.add(p.txt.parse("<i>Make sure to put pressure plates in front of doors for your"));
|
|
||||||
pageLines.add(p.txt.parse("<i>guest visitors. Otherwise they can't get through. You can"));
|
|
||||||
pageLines.add(p.txt.parse("<i>also use this to create member only areas."));
|
|
||||||
pageLines.add(p.txt.parse("<i>As dispensers are protected, you can create traps without"));
|
|
||||||
pageLines.add(p.txt.parse("<i>worrying about those arrows getting stolen."));
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add("Finally some commands for the server admins:");
|
|
||||||
pageLines.add( p.cmdBase.cmdBypass.getUseageTemplate(true) );
|
|
||||||
pageLines.add(p.txt.parse("<c>/f claim safezone <i>claim land for the Safe Zone"));
|
|
||||||
pageLines.add(p.txt.parse("<c>/f claim warzone <i>claim land for the War Zone"));
|
|
||||||
pageLines.add(p.txt.parse("<c>/f autoclaim [safezone|warzone] <i>take a guess"));
|
|
||||||
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + Factions.get().txt.parse("<i>") + " works on safe/war zones as well."));
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
|
|
||||||
pageLines = new ArrayList<String>();
|
|
||||||
pageLines.add(p.txt.parse("<i>More commands for server admins:"));
|
|
||||||
pageLines.add( p.cmdBase.cmdPowerBoost.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdLock.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdSaveAll.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdVersion.getUseageTemplate(true) );
|
|
||||||
pageLines.add( p.cmdBase.cmdConfig.getUseageTemplate(true) );
|
|
||||||
helpPages.add(pageLines);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.massivecraft.factions.Perm;
|
|||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||||
import com.massivecraft.factions.util.RelationUtil;
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class CmdLeader extends FCommand
|
public class CmdLeader extends FCommand
|
||||||
{
|
{
|
||||||
@ -50,7 +51,7 @@ public class CmdLeader extends FCommand
|
|||||||
// Follow the standard rules
|
// Follow the standard rules
|
||||||
if (fme.getRole() != Rel.LEADER || targetFaction != myFaction)
|
if (fme.getRole() != Rel.LEADER || targetFaction != myFaction)
|
||||||
{
|
{
|
||||||
sender.sendMessage(p.txt.parse("<b>You must be leader of the faction to %s.", this.getHelpShort()));
|
sender.sendMessage(Txt.parse("<b>You must be leader of the faction to %s.", this.getHelpShort()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.ConfServer;
|
|||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.FactionColl;
|
import com.massivecraft.factions.FactionColl;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
|
|
||||||
public class CmdList extends FCommand
|
public class CmdList extends FCommand
|
||||||
@ -75,10 +76,10 @@ public class CmdList extends FCommand
|
|||||||
ArrayList<String> lines = new ArrayList<String>();
|
ArrayList<String> lines = new ArrayList<String>();
|
||||||
|
|
||||||
/* // this code was really slow on large servers, getting full info for every faction and then only showing 9 of them; rewritten below
|
/* // this code was really slow on large servers, getting full info for every faction and then only showing 9 of them; rewritten below
|
||||||
lines.add(p.txt.parse("<i>Factionless<i> %d online", Factions.i.getNone().getFPlayersWhereOnline(true).size()));
|
lines.add(Txt.parse("<i>Factionless<i> %d online", Factions.i.getNone().getFPlayersWhereOnline(true).size()));
|
||||||
for (Faction faction : factionList)
|
for (Faction faction : factionList)
|
||||||
{
|
{
|
||||||
lines.add(p.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.getTag(fme),
|
||||||
faction.getFPlayersWhereOnline(true).size(),
|
faction.getFPlayersWhereOnline(true).size(),
|
||||||
faction.getFPlayers().size(),
|
faction.getFPlayers().size(),
|
||||||
@ -88,7 +89,7 @@ public class CmdList extends FCommand
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage(p.txt.getPage(lines, this.argAsInt(0, 1), "Faction List"));
|
sendMessage(Txt.getPage(lines, this.argAsInt(0, 1), "Faction List"));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
factionList.add(0, FactionColl.i.getNone());
|
factionList.add(0, FactionColl.i.getNone());
|
||||||
@ -105,16 +106,16 @@ public class CmdList extends FCommand
|
|||||||
if (end > factionList.size())
|
if (end > factionList.size())
|
||||||
end = factionList.size();
|
end = factionList.size();
|
||||||
|
|
||||||
lines.add(p.txt.titleize("Faction List "+pagenumber+"/"+pagecount));
|
lines.add(Txt.titleize("Faction List "+pagenumber+"/"+pagecount));
|
||||||
|
|
||||||
for (Faction faction : factionList.subList(start, end))
|
for (Faction faction : factionList.subList(start, end))
|
||||||
{
|
{
|
||||||
if (faction.isNone())
|
if (faction.isNone())
|
||||||
{
|
{
|
||||||
lines.add(p.txt.parse("<i>Factionless<i> %d online", FactionColl.i.getNone().getFPlayersWhereOnline(true).size()));
|
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColl.i.getNone().getFPlayersWhereOnline(true).size()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lines.add(p.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.getTag(fme),
|
||||||
faction.getFPlayersWhereOnline(true).size(),
|
faction.getFPlayersWhereOnline(true).size(),
|
||||||
faction.getFPlayers().size(),
|
faction.getFPlayers().size(),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class CmdMoney extends FCommand
|
public class CmdMoney extends FCommand
|
||||||
{
|
{
|
||||||
@ -27,7 +28,7 @@ public class CmdMoney extends FCommand
|
|||||||
senderMustBeLeader = false;
|
senderMustBeLeader = false;
|
||||||
|
|
||||||
this.setHelpShort("faction money commands");
|
this.setHelpShort("faction money commands");
|
||||||
this.helpLong.add(p.txt.parseTags("<i>The faction money commands."));
|
this.helpLong.add(Txt.parse("<i>The faction money commands."));
|
||||||
|
|
||||||
this.addSubCommand(this.cmdMoneyBalance);
|
this.addSubCommand(this.cmdMoneyBalance);
|
||||||
this.addSubCommand(this.cmdMoneyDeposit);
|
this.addSubCommand(this.cmdMoneyDeposit);
|
||||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.Factions;
|
|||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ public class CmdMoneyDeposit extends FCommand
|
|||||||
boolean success = Econ.transferMoney(fme, fme, faction, amount);
|
boolean success = Econ.transferMoney(fme, fme, faction, amount);
|
||||||
|
|
||||||
if (success && ConfServer.logMoneyTransactions)
|
if (success && ConfServer.logMoneyTransactions)
|
||||||
Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
|
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.Perm;
|
|||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
@ -42,6 +43,6 @@ public class CmdMoneyTransferFf extends FCommand
|
|||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
|
||||||
if (success && ConfServer.logMoneyTransactions)
|
if (success && ConfServer.logMoneyTransactions)
|
||||||
Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
|
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.Perm;
|
|||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
@ -42,6 +43,6 @@ public class CmdMoneyTransferFp extends FCommand
|
|||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
|
||||||
if (success && ConfServer.logMoneyTransactions)
|
if (success && ConfServer.logMoneyTransactions)
|
||||||
Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
|
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.Perm;
|
|||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
@ -42,6 +43,6 @@ public class CmdMoneyTransferPf extends FCommand
|
|||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
|
||||||
if (success && ConfServer.logMoneyTransactions)
|
if (success && ConfServer.logMoneyTransactions)
|
||||||
Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
|
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.Perm;
|
|||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
@ -37,6 +38,6 @@ public class CmdMoneyWithdraw extends FCommand
|
|||||||
boolean success = Econ.transferMoney(fme, faction, fme, amount);
|
boolean success = Econ.transferMoney(fme, faction, fme, amount);
|
||||||
|
|
||||||
if (success && ConfServer.logMoneyTransactions)
|
if (success && ConfServer.logMoneyTransactions)
|
||||||
Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
|
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.massivecraft.factions.FPerm;
|
|||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class CmdPerm extends FCommand
|
public class CmdPerm extends FCommand
|
||||||
{
|
{
|
||||||
@ -41,7 +42,7 @@ public class CmdPerm extends FCommand
|
|||||||
|
|
||||||
if ( ! this.argIsSet(1))
|
if ( ! this.argIsSet(1))
|
||||||
{
|
{
|
||||||
msg(p.txt.titleize("Perms for " + faction.describeTo(fme, true)));
|
msg(Txt.titleize("Perms for " + faction.describeTo(fme, true)));
|
||||||
msg(FPerm.getStateHeaders());
|
msg(FPerm.getStateHeaders());
|
||||||
for (FPerm perm : FPerm.values())
|
for (FPerm perm : FPerm.values())
|
||||||
{
|
{
|
||||||
@ -54,7 +55,7 @@ public class CmdPerm extends FCommand
|
|||||||
if (perm == null) return;
|
if (perm == null) return;
|
||||||
if ( ! this.argIsSet(2))
|
if ( ! this.argIsSet(2))
|
||||||
{
|
{
|
||||||
msg(p.txt.titleize("Perm for " + faction.describeTo(fme, true)));
|
msg(Txt.titleize("Perm for " + faction.describeTo(fme, true)));
|
||||||
msg(FPerm.getStateHeaders());
|
msg(FPerm.getStateHeaders());
|
||||||
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
||||||
return;
|
return;
|
||||||
@ -78,7 +79,7 @@ public class CmdPerm extends FCommand
|
|||||||
faction.setRelationPermitted(FPerm.PERMS, Rel.LEADER, true);
|
faction.setRelationPermitted(FPerm.PERMS, Rel.LEADER, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg(p.txt.titleize("Perm for " + faction.describeTo(fme, true)));
|
msg(Txt.titleize("Perm for " + faction.describeTo(fme, true)));
|
||||||
msg(FPerm.getStateHeaders());
|
msg(FPerm.getStateHeaders());
|
||||||
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import com.massivecraft.factions.Faction;
|
|||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class CmdShow extends FCommand
|
public class CmdShow extends FCommand
|
||||||
{
|
{
|
||||||
@ -51,7 +52,7 @@ public class CmdShow extends FCommand
|
|||||||
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER);
|
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER);
|
||||||
Collection<FPlayer> recruits = faction.getFPlayersWhereRole(Rel.RECRUIT);
|
Collection<FPlayer> recruits = faction.getFPlayersWhereRole(Rel.RECRUIT);
|
||||||
|
|
||||||
msg(p.txt.titleize(faction.getTag(fme)));
|
msg(Txt.titleize(faction.getTag(fme)));
|
||||||
msg("<a>Description: <i>%s", faction.getDescription());
|
msg("<a>Description: <i>%s", faction.getDescription());
|
||||||
|
|
||||||
// Display important flags
|
// Display important flags
|
||||||
@ -91,22 +92,22 @@ public class CmdShow extends FCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String sepparator = p.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>> relationTags = faction.getFactionTagsPerRelation(fme, true);
|
||||||
|
|
||||||
if (faction.getFlag(FFlag.PEACEFUL))
|
if (faction.getFlag(FFlag.PEACEFUL))
|
||||||
{
|
{
|
||||||
sendMessage(p.txt.parse("<a>In Truce with:<i> *everyone*"));
|
sendMessage(Txt.parse("<a>In Truce with:<i> *everyone*"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendMessage(p.txt.parse("<a>In Truce with: ") + TextUtil.implode(relationTags.get(Rel.TRUCE), sepparator));
|
sendMessage(Txt.parse("<a>In Truce with: ") + TextUtil.implode(relationTags.get(Rel.TRUCE), sepparator));
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage(p.txt.parse("<a>Allied to: ") + TextUtil.implode(relationTags.get(Rel.ALLY), sepparator));
|
sendMessage(Txt.parse("<a>Allied to: ") + TextUtil.implode(relationTags.get(Rel.ALLY), sepparator));
|
||||||
sendMessage(p.txt.parse("<a>Enemies: ") + TextUtil.implode(relationTags.get(Rel.ENEMY), sepparator));
|
sendMessage(Txt.parse("<a>Enemies: ") + TextUtil.implode(relationTags.get(Rel.ENEMY), sepparator));
|
||||||
|
|
||||||
// List the members...
|
// List the members...
|
||||||
List<String> memberOnlineNames = new ArrayList<String>();
|
List<String> memberOnlineNames = new ArrayList<String>();
|
||||||
@ -159,8 +160,8 @@ public class CmdShow extends FCommand
|
|||||||
memberOfflineNames.add(follower.getNameAndTitle(fme));
|
memberOfflineNames.add(follower.getNameAndTitle(fme));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendMessage(p.txt.parse("<a>Members online: ") + TextUtil.implode(memberOnlineNames, sepparator));
|
sendMessage(Txt.parse("<a>Members online: ") + TextUtil.implode(memberOnlineNames, sepparator));
|
||||||
sendMessage(p.txt.parse("<a>Members offline: ") + TextUtil.implode(memberOfflineNames, sepparator));
|
sendMessage(Txt.parse("<a>Members offline: ") + TextUtil.implode(memberOfflineNames, sepparator));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Collections;
|
|||||||
|
|
||||||
import com.massivecraft.factions.ConfServer;
|
import com.massivecraft.factions.ConfServer;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class FCmdRoot extends FCommand
|
public class FCmdRoot extends FCommand
|
||||||
{
|
{
|
||||||
@ -67,7 +68,7 @@ public class FCmdRoot extends FCommand
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
this.setHelpShort("The faction base command");
|
this.setHelpShort("The faction base command");
|
||||||
this.helpLong.add(p.txt.parseTags("<i>This command contains all faction stuff."));
|
this.helpLong.add(Txt.parse("<i>This command contains all faction stuff."));
|
||||||
|
|
||||||
this.addSubCommand(Factions.get().cmdAutoHelp);
|
this.addSubCommand(Factions.get().cmdAutoHelp);
|
||||||
this.addSubCommand(this.cmdList);
|
this.addSubCommand(this.cmdList);
|
||||||
|
@ -16,6 +16,7 @@ import com.massivecraft.factions.FactionColl;
|
|||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.zcore.MCommand;
|
import com.massivecraft.factions.zcore.MCommand;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
|
|
||||||
public abstract class FCommand extends MCommand<Factions>
|
public abstract class FCommand extends MCommand<Factions>
|
||||||
@ -101,19 +102,19 @@ public abstract class FCommand extends MCommand<Factions>
|
|||||||
|
|
||||||
if ( ! fplayer.hasFaction())
|
if ( ! fplayer.hasFaction())
|
||||||
{
|
{
|
||||||
sender.sendMessage(p.txt.parse("<b>You are not member of any faction."));
|
sender.sendMessage(Txt.parse("<b>You are not member of any faction."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.senderMustBeOfficer && ! fplayer.getRole().isAtLeast(Rel.OFFICER))
|
if (this.senderMustBeOfficer && ! fplayer.getRole().isAtLeast(Rel.OFFICER))
|
||||||
{
|
{
|
||||||
sender.sendMessage(p.txt.parse("<b>Only faction moderators can %s.", this.getHelpShort()));
|
sender.sendMessage(Txt.parse("<b>Only faction moderators can %s.", this.getHelpShort()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.senderMustBeLeader && ! fplayer.getRole().isAtLeast(Rel.LEADER))
|
if (this.senderMustBeLeader && ! fplayer.getRole().isAtLeast(Rel.LEADER))
|
||||||
{
|
{
|
||||||
sender.sendMessage(p.txt.parse("<b>Only faction admins can %s.", this.getHelpShort()));
|
sender.sendMessage(Txt.parse("<b>Only faction admins can %s.", this.getHelpShort()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +393,7 @@ public abstract class FCommand extends MCommand<Factions>
|
|||||||
{
|
{
|
||||||
if ( ! i.getFaction().equals(you.getFaction()))
|
if ( ! i.getFaction().equals(you.getFaction()))
|
||||||
{
|
{
|
||||||
i.sendMessage(p.txt.parse("%s <b>is not in the same faction as you.",you.describeTo(i, true)));
|
i.sendMessage(Txt.parse("%s <b>is not in the same faction as you.",you.describeTo(i, true)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +404,7 @@ public abstract class FCommand extends MCommand<Factions>
|
|||||||
|
|
||||||
if (you.getRole().equals(Rel.LEADER))
|
if (you.getRole().equals(Rel.LEADER))
|
||||||
{
|
{
|
||||||
i.sendMessage(p.txt.parse("<b>Only the faction admin can do that."));
|
i.sendMessage(Txt.parse("<b>Only the faction admin can do that."));
|
||||||
}
|
}
|
||||||
else if (i.getRole().equals(Rel.OFFICER))
|
else if (i.getRole().equals(Rel.OFFICER))
|
||||||
{
|
{
|
||||||
@ -413,12 +414,12 @@ public abstract class FCommand extends MCommand<Factions>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i.sendMessage(p.txt.parse("<b>Moderators can't control each other..."));
|
i.sendMessage(Txt.parse("<b>Moderators can't control each other..."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i.sendMessage(p.txt.parse("<b>You must be a faction moderator to do that."));
|
i.sendMessage(Txt.parse("<b>You must be a faction moderator to do that."));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.massivecraft.factions.zcore.MCommand;
|
import com.massivecraft.factions.zcore.MCommand;
|
||||||
import com.massivecraft.factions.zcore.MPlugin;
|
import com.massivecraft.factions.zcore.MPlugin;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
|
|
||||||
public abstract class MCommand<T extends MPlugin>
|
public abstract class MCommand<T extends MPlugin>
|
||||||
@ -221,7 +222,7 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
public String getUseageTemplate(List<MCommand<?>> commandChain, boolean addShortHelp)
|
public String getUseageTemplate(List<MCommand<?>> commandChain, boolean addShortHelp)
|
||||||
{
|
{
|
||||||
StringBuilder ret = new StringBuilder();
|
StringBuilder ret = new StringBuilder();
|
||||||
ret.append(p.txt.parseTags("<c>"));
|
ret.append(Txt.parse("<c>"));
|
||||||
ret.append('/');
|
ret.append('/');
|
||||||
|
|
||||||
for (MCommand<?> mc : commandChain)
|
for (MCommand<?> mc : commandChain)
|
||||||
@ -255,13 +256,13 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
|
|
||||||
if (args.size() > 0)
|
if (args.size() > 0)
|
||||||
{
|
{
|
||||||
ret.append(p.txt.parseTags("<p> "));
|
ret.append(Txt.parse("<p> "));
|
||||||
ret.append(TextUtil.implode(args, " "));
|
ret.append(TextUtil.implode(args, " "));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addShortHelp)
|
if (addShortHelp)
|
||||||
{
|
{
|
||||||
ret.append(p.txt.parseTags(" <i>"));
|
ret.append(Txt.parse(" <i>"));
|
||||||
ret.append(this.getHelpShort());
|
ret.append(this.getHelpShort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +285,7 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
|
|
||||||
public void msg(String str, Object... args)
|
public void msg(String str, Object... args)
|
||||||
{
|
{
|
||||||
sender.sendMessage(p.txt.parse(str, args));
|
sender.sendMessage(Txt.parse(str, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(String msg)
|
public void sendMessage(String msg)
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package com.massivecraft.factions.zcore;
|
package com.massivecraft.factions.zcore;
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -14,17 +11,15 @@ import com.massivecraft.factions.zcore.persist.SaveTask;
|
|||||||
import com.massivecraft.factions.zcore.util.LibLoader;
|
import com.massivecraft.factions.zcore.util.LibLoader;
|
||||||
import com.massivecraft.factions.zcore.util.PermUtil;
|
import com.massivecraft.factions.zcore.util.PermUtil;
|
||||||
import com.massivecraft.factions.zcore.util.Persist;
|
import com.massivecraft.factions.zcore.util.Persist;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
import com.massivecraft.mcore.xlib.gson.Gson;
|
import com.massivecraft.mcore.xlib.gson.Gson;
|
||||||
import com.massivecraft.mcore.xlib.gson.GsonBuilder;
|
import com.massivecraft.mcore.xlib.gson.GsonBuilder;
|
||||||
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
|
|
||||||
public abstract class MPlugin extends JavaPlugin
|
public abstract class MPlugin extends JavaPlugin
|
||||||
{
|
{
|
||||||
// Some utils
|
// Some utils
|
||||||
public Persist persist;
|
public Persist persist;
|
||||||
public TextUtil txt;
|
|
||||||
public LibLoader lib;
|
public LibLoader lib;
|
||||||
public PermUtil perm;
|
public PermUtil perm;
|
||||||
|
|
||||||
@ -60,8 +55,8 @@ public abstract class MPlugin extends JavaPlugin
|
|||||||
// if ( ! lib.require("gson.jar", "http://search.maven.org/remotecontent?filepath=com/google/code/gson/gson/2.1/gson-2.1.jar")) return false;
|
// if ( ! lib.require("gson.jar", "http://search.maven.org/remotecontent?filepath=com/google/code/gson/gson/2.1/gson-2.1.jar")) return false;
|
||||||
this.gson = this.getGsonBuilder().create();
|
this.gson = this.getGsonBuilder().create();
|
||||||
|
|
||||||
this.txt = new TextUtil();
|
//this.txt = new TextUtil();
|
||||||
initTXT();
|
//initTXT();
|
||||||
|
|
||||||
// Create and register listeners
|
// Create and register listeners
|
||||||
this.mPluginSecretPlayerListener = new MPluginSecretPlayerListener(this);
|
this.mPluginSecretPlayerListener = new MPluginSecretPlayerListener(this);
|
||||||
@ -119,7 +114,7 @@ public abstract class MPlugin extends JavaPlugin
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// LANG AND TAGS
|
// LANG AND TAGS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
/*
|
||||||
// These are not supposed to be used directly.
|
// These are not supposed to be used directly.
|
||||||
// They are loaded and used through the TextUtil instance for the plugin.
|
// They are loaded and used through the TextUtil instance for the plugin.
|
||||||
public Map<String, String> rawTags = new LinkedHashMap<String, String>();
|
public Map<String, String> rawTags = new LinkedHashMap<String, String>();
|
||||||
@ -151,7 +146,7 @@ public abstract class MPlugin extends JavaPlugin
|
|||||||
{
|
{
|
||||||
this.txt.tags.put(rawTag.getKey(), TextUtil.parseColor(rawTag.getValue()));
|
this.txt.tags.put(rawTag.getKey(), TextUtil.parseColor(rawTag.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// HOOKS
|
// HOOKS
|
||||||
@ -176,12 +171,12 @@ public abstract class MPlugin extends JavaPlugin
|
|||||||
|
|
||||||
public void log(String str, Object... args)
|
public void log(String str, Object... args)
|
||||||
{
|
{
|
||||||
log(Level.INFO, this.txt.parse(str, args));
|
log(Level.INFO, Txt.parse(str, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(Level level, String str, Object... args)
|
public void log(Level level, String str, Object... args)
|
||||||
{
|
{
|
||||||
log(level, this.txt.parse(str, args));
|
log(level, Txt.parse(str, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(Level level, Object msg)
|
public void log(Level level, Object msg)
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.permissions.Permission;
|
|||||||
|
|
||||||
import com.massivecraft.factions.zcore.Lang;
|
import com.massivecraft.factions.zcore.Lang;
|
||||||
import com.massivecraft.factions.zcore.MPlugin;
|
import com.massivecraft.factions.zcore.MPlugin;
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
|
|
||||||
public class PermUtil {
|
public class PermUtil {
|
||||||
@ -25,7 +26,7 @@ public class PermUtil {
|
|||||||
|
|
||||||
public String getForbiddenMessage(String perm)
|
public String getForbiddenMessage(String perm)
|
||||||
{
|
{
|
||||||
return p.txt.parse(Lang.permForbidden, getPermissionDescription(perm));
|
return Txt.parse(Lang.permForbidden, getPermissionDescription(perm));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user