Add TL for commands. Resolves #162. Supercedes #97.

This commit is contained in:
korikisulda 2014-12-07 23:12:52 +00:00 committed by drtshock
parent bd8f572cbf
commit 1230803cfb
64 changed files with 864 additions and 318 deletions

View File

@ -6,6 +6,8 @@ import com.massivecraft.factions.Faction;
import com.massivecraft.factions.event.FPlayerJoinEvent; import com.massivecraft.factions.event.FPlayerJoinEvent;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
public class CmdAdmin extends FCommand { public class CmdAdmin extends FCommand {
@ -37,17 +39,17 @@ public class CmdAdmin extends FCommand {
Faction targetFaction = fyou.getFaction(); Faction targetFaction = fyou.getFaction();
if (targetFaction != myFaction && !permAny) { if (targetFaction != myFaction && !permAny) {
msg("%s<i> is not a member in your faction.", fyou.describeTo(fme, true)); msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(fme, true));
return; return;
} }
if (fme != null && fme.getRole() != Role.ADMIN && !permAny) { if (fme != null && fme.getRole() != Role.ADMIN && !permAny) {
msg("<b>You are not the faction admin."); msg(TL.COMMAND_ADMIN_NOTADMIN);
return; return;
} }
if (fyou == fme && !permAny) { if (fyou == fme && !permAny) {
msg("<b>The target player musn't be yourself."); msg(TL.COMMAND_ADMIN_TARGETSELF);
return; return;
} }
@ -65,8 +67,8 @@ public class CmdAdmin extends FCommand {
// if target player is currently admin, demote and replace him // if target player is currently admin, demote and replace him
if (fyou == admin) { if (fyou == admin) {
targetFaction.promoteNewLeader(); targetFaction.promoteNewLeader();
msg("<i>You have demoted %s<i> from the position of faction admin.", fyou.describeTo(fme, true)); msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(fme, true));
fyou.msg("<i>You have been demoted from the position of faction admin by %s<i>.", senderIsConsole ? "a server admin" : fme.describeTo(fyou, true)); fyou.msg(TL.COMMAND_ADMIN_DEMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fyou, true));
return; return;
} }
@ -75,11 +77,11 @@ public class CmdAdmin extends FCommand {
admin.setRole(Role.MODERATOR); admin.setRole(Role.MODERATOR);
} }
fyou.setRole(Role.ADMIN); fyou.setRole(Role.ADMIN);
msg("<i>You have promoted %s<i> to the position of faction admin.", fyou.describeTo(fme, true)); msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(fme, true));
// Inform all players // Inform all players
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
fplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : fme.describeTo(fplayer, true), fyou.describeTo(fplayer), targetFaction.describeTo(fplayer)); fplayer.msg(TL.COMMAND_ADMIN_PROMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true), fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
} }
} }

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.TL;
public class CmdAutoClaim extends FCommand { public class CmdAutoClaim extends FCommand {
@ -27,15 +28,15 @@ public class CmdAutoClaim extends FCommand {
Faction forFaction = this.argAsFaction(0, myFaction); Faction forFaction = this.argAsFaction(0, myFaction);
if (forFaction == null || forFaction == fme.getAutoClaimFor()) { if (forFaction == null || forFaction == fme.getAutoClaimFor()) {
fme.setAutoClaimFor(null); fme.setAutoClaimFor(null);
msg("<i>Auto-claiming of land disabled."); msg(TL.COMMAND_AUTOCLAIM_DISABLED);
return; return;
} }
if (!fme.canClaimForFaction(forFaction)) { if (!fme.canClaimForFaction(forFaction)) {
if (myFaction == forFaction) { if (myFaction == forFaction) {
msg("<b>You must be <h>%s<b> to claim land.", Role.MODERATOR.toString()); msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.toString());
} else { } else {
msg("<b>You can't claim land for <h>%s<b>.", forFaction.describeTo(fme)); msg(TL.COMMAND_AUTOCLAIM_OTHERFACTION, forFaction.describeTo(fme));
} }
return; return;
@ -43,7 +44,7 @@ public class CmdAutoClaim extends FCommand {
fme.setAutoClaimFor(forFaction); fme.setAutoClaimFor(forFaction);
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(fme)); msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(fme));
fme.attemptClaim(forFaction, me.getLocation(), true); fme.attemptClaim(forFaction, me.getLocation(), true);
} }

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
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.factions.zcore.util.TL;
import java.util.ArrayList; import java.util.ArrayList;
@ -36,6 +37,6 @@ public class CmdAutoHelp extends MCommand<P> {
} }
} }
sendMessage(p.txt.getPage(lines, this.argAsInt(0, 1), "Help for command \"" + pcmd.aliases.get(0) + "\"")); sendMessage(p.txt.getPage(lines, this.argAsInt(0, 1), TL.COMMAND_AUTOHELP_HELPFOR.toString() + pcmd.aliases.get(0) + "\""));
} }
} }

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdBoom extends FCommand { public class CmdBoom extends FCommand {
@ -24,20 +25,20 @@ public class CmdBoom extends FCommand {
@Override @Override
public void perform() { public void perform() {
if (!myFaction.isPeaceful()) { if (!myFaction.isPeaceful()) {
fme.msg("<b>This command is only usable by factions which are specially designated as peaceful."); fme.msg(TL.COMMAND_BOOM_PEACEFULONLY);
return; return;
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostNoBoom, "to toggle explosions", "for toggling explosions")) { if (!payForCommand(Conf.econCostNoBoom, TL.COMMAND_BOOM_TOTOGGLE, TL.COMMAND_BOOM_FORTOGGLE)) {
return; return;
} }
myFaction.setPeacefulExplosionsEnabled(this.argAsBool(0, !myFaction.getPeacefulExplosionsEnabled())); myFaction.setPeacefulExplosionsEnabled(this.argAsBool(0, !myFaction.getPeacefulExplosionsEnabled()));
String enabled = myFaction.noExplosionsInTerritory() ? "disabled" : "enabled"; String enabled = myFaction.noExplosionsInTerritory() ? TL.GENERIC_DISABLED.toString() : TL.GENERIC_ENABLED.toString();
// Inform // Inform
myFaction.msg("%s<i> has " + enabled + " explosions in your faction's territory.", fme.describeTo(myFaction)); myFaction.msg(TL.COMMAND_BOOM_ENABLED, fme.describeTo(myFaction),enabled);
} }
} }

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdBypass extends FCommand { public class CmdBypass extends FCommand {
@ -27,11 +28,11 @@ public class CmdBypass extends FCommand {
// TODO: Move this to a transient field in the model?? // TODO: Move this to a transient field in the model??
if (fme.isAdminBypassing()) { if (fme.isAdminBypassing()) {
fme.msg("<i>You have enabled admin bypass mode. You will be able to build or destroy anywhere."); fme.msg(TL.COMMAND_BYPASS_ENABLE.toString());
P.p.log(fme.getName() + " has ENABLED admin bypass mode."); P.p.log(fme.getName() + TL.COMMAND_BYPASS_ENABLELOG.toString());
} else { } else {
fme.msg("<i>You have disabled admin bypass mode."); fme.msg(TL.COMMAND_BYPASS_DISABLE.toString());
P.p.log(fme.getName() + " DISABLED admin bypass mode."); P.p.log(fme.getName() + TL.COMMAND_BYPASS_DISABLELOG.toString());
} }
} }
} }

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdChat extends FCommand { public class CmdChat extends FCommand {
@ -26,7 +27,7 @@ public class CmdChat extends FCommand {
@Override @Override
public void perform() { public void perform() {
if (!Conf.factionOnlyChat) { if (!Conf.factionOnlyChat) {
msg("<b>The built in chat chat channels are disabled on this server."); msg(TL.COMMAND_CHAT_DISABLED.toString());
return; return;
} }
@ -42,7 +43,7 @@ public class CmdChat extends FCommand {
} else if (modeString.startsWith("f")) { } else if (modeString.startsWith("f")) {
modeTarget = ChatMode.FACTION; modeTarget = ChatMode.FACTION;
} else { } else {
msg("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'"); msg(TL.COMMAND_CHAT_INVALIDMODE);
return; return;
} }
} }
@ -50,11 +51,11 @@ public class CmdChat extends FCommand {
fme.setChatMode(modeTarget); fme.setChatMode(modeTarget);
if (fme.getChatMode() == ChatMode.PUBLIC) { if (fme.getChatMode() == ChatMode.PUBLIC) {
msg("<i>Public chat mode."); msg(TL.COMMAND_CHAT_MODE_PUBLIC);
} else if (fme.getChatMode() == ChatMode.ALLIANCE) { } else if (fme.getChatMode() == ChatMode.ALLIANCE) {
msg("<i>Alliance only chat mode."); msg(TL.COMMAND_CHAT_MODE_ALLIANCE);
} else { } else {
msg("<i>Faction only chat mode."); msg(TL.COMMAND_CHAT_MODE_FACTION);
} }
} }
} }

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdChatSpy extends FCommand { public class CmdChatSpy extends FCommand {
@ -25,11 +26,11 @@ public class CmdChatSpy extends FCommand {
fme.setSpyingChat(this.argAsBool(0, !fme.isSpyingChat())); fme.setSpyingChat(this.argAsBool(0, !fme.isSpyingChat()));
if (fme.isSpyingChat()) { if (fme.isSpyingChat()) {
fme.msg("<i>You have enabled chat spying mode."); fme.msg(TL.COMMAND_CHATSPY_ENABLE);
P.p.log(fme.getName() + " has ENABLED chat spying mode."); P.p.log(fme.getName() + TL.COMMAND_CHATSPY_ENABLELOG.toString());
} else { } else {
fme.msg("<i>You have disabled chat spying mode."); fme.msg(TL.COMMAND_CHATSPY_DISABLE);
P.p.log(fme.getName() + " DISABLED chat spying mode."); P.p.log(fme.getName() + TL.COMMAND_CHATSPY_DISABLELOG.toString());
} }
} }
} }

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.SpiralTask; import com.massivecraft.factions.util.SpiralTask;
import com.massivecraft.factions.zcore.util.TL;
public class CmdClaim extends FCommand { public class CmdClaim extends FCommand {
@ -33,7 +34,7 @@ public class CmdClaim extends FCommand {
int radius = this.argAsInt(1, 1); int radius = this.argAsInt(1, 1);
if (radius < 1) { if (radius < 1) {
msg("<b>If you specify a radius, it must be at least 1."); msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
return; return;
} }
@ -43,7 +44,7 @@ public class CmdClaim extends FCommand {
} else { } else {
// radius claim // radius claim
if (!Permission.CLAIM_RADIUS.has(sender, false)) { if (!Permission.CLAIM_RADIUS.has(sender, false)) {
msg("<b>You do not have permission to claim in a radius."); msg(TL.COMMAND_CLAIM_DENIED);
return; return;
} }

View File

@ -3,6 +3,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -52,7 +54,7 @@ public class CmdConfig extends FCommand {
String fieldName = properFieldNames.get(field); String fieldName = properFieldNames.get(field);
if (fieldName == null || fieldName.isEmpty()) { if (fieldName == null || fieldName.isEmpty()) {
msg("<b>No configuration setting \"<h>%s<b>\" exists.", field); msg(TL.COMMAND_CONFIG_NOEXIST, field);
return; return;
} }
@ -72,9 +74,9 @@ public class CmdConfig extends FCommand {
target.setBoolean(null, targetValue); target.setBoolean(null, targetValue);
if (targetValue) { if (targetValue) {
success = "\"" + fieldName + "\" option set to true (enabled)."; success = "\"" + fieldName + TL.COMMAND_CONFIG_SET_TRUE.toString();
} else { } else {
success = "\"" + fieldName + "\" option set to false (disabled)."; success = "\"" + fieldName + TL.COMMAND_CONFIG_SET_FALSE.toString();
} }
} }
@ -83,9 +85,9 @@ public class CmdConfig extends FCommand {
try { try {
int intVal = Integer.parseInt(value); int intVal = Integer.parseInt(value);
target.setInt(null, intVal); target.setInt(null, intVal);
success = "\"" + fieldName + "\" option set to " + intVal + "."; success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + intVal + ".";
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
sendMessage("Cannot set \"" + fieldName + "\": integer (whole number) value required."); sendMessage(TL.COMMAND_CONFIG_INTREQUIRED.format(fieldName));
return; return;
} }
} }
@ -95,9 +97,9 @@ public class CmdConfig extends FCommand {
try { try {
long longVal = Long.parseLong(value); long longVal = Long.parseLong(value);
target.setLong(null, longVal); target.setLong(null, longVal);
success = "\"" + fieldName + "\" option set to " + longVal + "."; success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + longVal + ".";
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
sendMessage("Cannot set \"" + fieldName + "\": long integer (whole number) value required."); sendMessage(TL.COMMAND_CONFIG_LONGREQUIRED.format(fieldName));
return; return;
} }
} }
@ -107,9 +109,9 @@ public class CmdConfig extends FCommand {
try { try {
double doubleVal = Double.parseDouble(value); double doubleVal = Double.parseDouble(value);
target.setDouble(null, doubleVal); target.setDouble(null, doubleVal);
success = "\"" + fieldName + "\" option set to " + doubleVal + "."; success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + doubleVal + ".";
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
sendMessage("Cannot set \"" + fieldName + "\": double (numeric) value required."); sendMessage(TL.COMMAND_CONFIG_DOUBLEREQUIRED.format(fieldName));
return; return;
} }
} }
@ -119,9 +121,9 @@ public class CmdConfig extends FCommand {
try { try {
float floatVal = Float.parseFloat(value); float floatVal = Float.parseFloat(value);
target.setFloat(null, floatVal); target.setFloat(null, floatVal);
success = "\"" + fieldName + "\" option set to " + floatVal + "."; success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + floatVal + ".";
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
sendMessage("Cannot set \"" + fieldName + "\": float (numeric) value required."); sendMessage(TL.COMMAND_CONFIG_FLOATREQUIRED.format(fieldName));
return; return;
} }
} }
@ -129,7 +131,7 @@ public class CmdConfig extends FCommand {
// String // String
else if (target.getType() == String.class) { else if (target.getType() == String.class) {
target.set(null, value); target.set(null, value);
success = "\"" + fieldName + "\" option set to \"" + value + "\"."; success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + value + "\".";
} }
// ChatColor // ChatColor
@ -141,11 +143,11 @@ public class CmdConfig extends FCommand {
} }
if (newColor == null) { if (newColor == null) {
sendMessage("Cannot set \"" + fieldName + "\": \"" + value.toUpperCase() + "\" is not a valid color."); sendMessage(TL.COMMAND_CONFIG_INVALID_COLOUR.format(fieldName,value.toUpperCase()));
return; return;
} }
target.set(null, newColor); target.set(null, newColor);
success = "\"" + fieldName + "\" color option set to \"" + value.toUpperCase() + "\"."; success = "\"" + fieldName + TL.COMMAND_CONFIG_COLOURSET.toString() + value.toUpperCase() + "\".";
} }
// Set<?> or other parameterized collection // Set<?> or other parameterized collection
@ -155,7 +157,7 @@ public class CmdConfig extends FCommand {
// not a Set, somehow, and that should be the only collection we're using in Conf.java // not a Set, somehow, and that should be the only collection we're using in Conf.java
if (targSet.getRawType() != Set.class) { if (targSet.getRawType() != Set.class) {
sendMessage("\"" + fieldName + "\" is not a data collection type which can be modified with this command."); sendMessage(TL.COMMAND_CONFIG_INVALID_COLLECTION.format(fieldName));
return; return;
} }
@ -168,7 +170,7 @@ public class CmdConfig extends FCommand {
} }
if (newMat == null) { if (newMat == null) {
sendMessage("Cannot change \"" + fieldName + "\" set: \"" + value.toUpperCase() + "\" is not a valid material."); sendMessage(TL.COMMAND_CONFIG_INVALID_MATERIAL.format(fieldName,value.toUpperCase()));
return; return;
} }
@ -178,13 +180,13 @@ public class CmdConfig extends FCommand {
if (matSet.contains(newMat)) { if (matSet.contains(newMat)) {
matSet.remove(newMat); matSet.remove(newMat);
target.set(null, matSet); target.set(null, matSet);
success = "\"" + fieldName + "\" set: Material \"" + value.toUpperCase() + "\" removed."; success = TL.COMMAND_CONFIG_MATERIAL_REMOVED.format(fieldName,value.toUpperCase());
} }
// Material not present yet, add it // Material not present yet, add it
else { else {
matSet.add(newMat); matSet.add(newMat);
target.set(null, matSet); target.set(null, matSet);
success = "\"" + fieldName + "\" set: Material \"" + value.toUpperCase() + "\" added."; success = TL.COMMAND_CONFIG_MATERIAL_ADDED.format(fieldName,value.toUpperCase());
} }
} }
@ -196,40 +198,40 @@ public class CmdConfig extends FCommand {
if (stringSet.contains(value)) { if (stringSet.contains(value)) {
stringSet.remove(value); stringSet.remove(value);
target.set(null, stringSet); target.set(null, stringSet);
success = "\"" + fieldName + "\" set: \"" + value + "\" removed."; success = TL.COMMAND_CONFIG_SET_REMOVED.format(fieldName,value);
} }
// String not present yet, add it // String not present yet, add it
else { else {
stringSet.add(value); stringSet.add(value);
target.set(null, stringSet); target.set(null, stringSet);
success = "\"" + fieldName + "\" set: \"" + value + "\" added."; success = TL.COMMAND_CONFIG_SET_ADDED.format(fieldName,value);
} }
} }
// Set of unknown type // Set of unknown type
else { else {
sendMessage("\"" + fieldName + "\" is not a data type set which can be modified with this command."); sendMessage(TL.COMMAND_CONFIG_INVALID_TYPESET.format(fieldName));
return; return;
} }
} }
// unknown type // unknown type
else { else {
sendMessage("\"" + fieldName + "\" is not a data type which can be modified with this command."); sendMessage(TL.COMMAND_CONFIG_ERROR_TYPE.format(fieldName,target.getClass().getName()));
return; return;
} }
} catch (NoSuchFieldException ex) { } catch (NoSuchFieldException ex) {
sendMessage("Configuration setting \"" + fieldName + "\" couldn't be matched, though it should be... please report this error."); sendMessage(TL.COMMAND_CONFIG_ERROR_MATCHING.format(fieldName));
return; return;
} catch (IllegalAccessException ex) { } catch (IllegalAccessException ex) {
sendMessage("Error setting configuration setting \"" + fieldName + "\" to \"" + value + "\"."); sendMessage(TL.COMMAND_CONFIG_ERROR_SETTING.format(fieldName,value));
return; return;
} }
if (!success.isEmpty()) { if (!success.isEmpty()) {
if (sender instanceof Player) { if (sender instanceof Player) {
sendMessage(success); sendMessage(success);
P.p.log(success + " Command was run by " + fme.getName() + "."); P.p.log(success + TL.COMMAND_CONFIG_LOG.format((Player)sender));
} else // using P.p.log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log } else // using P.p.log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log
{ {
P.p.log(success); P.p.log(success);

View File

@ -3,6 +3,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Conf.Backend; import com.massivecraft.factions.Conf.Backend;
import com.massivecraft.factions.zcore.persist.json.FactionsJSON; import com.massivecraft.factions.zcore.persist.json.FactionsJSON;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
public class CmdConvert extends FCommand { public class CmdConvert extends FCommand {
@ -16,11 +18,11 @@ public class CmdConvert extends FCommand {
@Override @Override
public void perform() { public void perform() {
if (!(this.sender instanceof ConsoleCommandSender)) { if (!(this.sender instanceof ConsoleCommandSender)) {
this.sender.sendMessage("Console only command"); this.sender.sendMessage(TL.GENERIC_CONSOLEONLY.toString());
} }
Backend nb = Backend.valueOf(this.argAsString(0).toUpperCase()); Backend nb = Backend.valueOf(this.argAsString(0).toUpperCase());
if (nb == Conf.backEnd) { if (nb == Conf.backEnd) {
this.sender.sendMessage("Already running that backend"); this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_RUNNING.toString());
return; return;
} }
switch (nb) { switch (nb) {
@ -28,7 +30,7 @@ public class CmdConvert extends FCommand {
FactionsJSON.convertTo(); FactionsJSON.convertTo();
break; break;
default: default:
this.sender.sendMessage("Invalid backend"); this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_INVALID.toString());
return; return;
} }

View File

@ -6,6 +6,8 @@ import com.massivecraft.factions.event.FactionCreateEvent;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import java.util.ArrayList; import java.util.ArrayList;
@ -34,12 +36,12 @@ public class CmdCreate extends FCommand {
String tag = this.argAsString(0); String tag = this.argAsString(0);
if (fme.hasFaction()) { if (fme.hasFaction()) {
msg("<b>You must leave your current faction first."); msg(TL.COMMAND_CREATE_MUSTLEAVE);
return; return;
} }
if (Factions.getInstance().isTagTaken(tag)) { if (Factions.getInstance().isTagTaken(tag)) {
msg("<b>That tag is already in use."); msg(TL.COMMAND_CREATE_INUSE);
return; return;
} }
@ -50,7 +52,7 @@ public class CmdCreate extends FCommand {
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostCreate, "to create a new faction")) { if (!canAffordCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) {
return; return;
} }
@ -62,7 +64,7 @@ public class CmdCreate extends FCommand {
} }
// then make 'em pay (if applicable) // then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostCreate, "to create a new faction", "for creating a new faction")) { if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) {
return; return;
} }
@ -70,7 +72,7 @@ public class CmdCreate extends FCommand {
// TODO: Why would this even happen??? Auto increment clash?? // TODO: Why would this even happen??? Auto increment clash??
if (faction == null) { if (faction == null) {
msg("<b>There was an internal error while trying to create your faction. Please try again."); msg(TL.COMMAND_CREATE_ERROR);
return; return;
} }
@ -87,13 +89,13 @@ public class CmdCreate extends FCommand {
fme.setFaction(faction); fme.setFaction(faction);
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower)); follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));
} }
msg("<i>You should now: %s", p.cmdBase.cmdDescription.getUseageTemplate()); msg(TL.COMMAND_CREATE_YOUSHOULD, p.cmdBase.cmdDescription.getUseageTemplate());
if (Conf.logFactionCreate) { if (Conf.logFactionCreate) {
P.p.log(fme.getName() + " created a new faction: " + tag); P.p.log(fme.getName() + TL.COMMAND_CREATE_CREATED_LOG.toString() + tag);
} }
} }

View File

@ -3,7 +3,10 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdDeinvite extends FCommand { public class CmdDeinvite extends FCommand {
@ -29,27 +32,27 @@ public class CmdDeinvite extends FCommand {
public void perform() { public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0); FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) { if (you == null) {
FancyMessage msg = new FancyMessage("Players you can deinvite: ").color(ChatColor.GOLD); FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
for (String id : myFaction.getInvites()) { for (String id : myFaction.getInvites()) {
FPlayer fp = FPlayers.getInstance().getById(id); FPlayer fp = FPlayers.getInstance().getById(id);
String name = fp != null ? fp.getName() : id; String name = fp != null ? fp.getName() : id;
msg.then(name + " ").color(ChatColor.WHITE).tooltip("Click to revoke invite for " + name).command("f deinvite " + name); msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.toString() + name).command("f deinvite " + name);
} }
sendFancyMessage(msg); sendFancyMessage(msg);
return; return;
} }
if (you.getFaction() == myFaction) { if (you.getFaction() == myFaction) {
msg("%s<i> is already a member of %s", you.getName(), myFaction.getTag()); msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), myFaction.getTag());
msg("<i>You might want to: %s", p.cmdBase.cmdKick.getUseageTemplate(false)); msg(TL.COMMAND_DEINVITE_MIGHTWANT, p.cmdBase.cmdKick.getUseageTemplate(false));
return; return;
} }
myFaction.deinvite(you); myFaction.deinvite(you);
you.msg("%s<i> revoked your invitation to <h>%s<i>.", fme.describeTo(you), myFaction.describeTo(you)); you.msg(TL.COMMAND_DEINVITE_REVOKED, fme.describeTo(you), myFaction.describeTo(you));
myFaction.msg("%s<i> revoked %s's<i> invitation.", fme.describeTo(myFaction), you.describeTo(myFaction)); myFaction.msg(TL.COMMAND_DEINVITE_REVOKES, fme.describeTo(myFaction), you.describeTo(myFaction));
} }
} }

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdDelFWarp extends FCommand { public class CmdDelFWarp extends FCommand {
@ -27,13 +28,13 @@ public class CmdDelFWarp extends FCommand {
return; return;
} }
myFaction.removeWarp(warp); myFaction.removeWarp(warp);
fme.msg("<i>Deleted warp <a>%s", warp); fme.msg(TL.COMMAND_DELFWARP_DELETED, warp);
} else { } else {
fme.msg("<i>Couldn't find warp <a>%s", warp); fme.msg(TL.COMMAND_DELFWARP_INVALID, warp);
} }
} }
private boolean transact(FPlayer player) { private boolean transact(FPlayer player) {
return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.delwarp", 5), "to delete warp", "for deleting warp"); return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString());
} }
} }

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TextUtil; import com.massivecraft.factions.zcore.util.TextUtil;
public class CmdDescription extends FCommand { public class CmdDescription extends FCommand {
@ -28,21 +29,21 @@ public class CmdDescription extends FCommand {
@Override @Override
public void perform() { public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostDesc, "to change faction description", "for changing faction description")) { if (!payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) {
return; return;
} }
myFaction.setDescription(TextUtil.implode(args, " ").replaceAll("(&([a-f0-9]))", "& $2")); // since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up myFaction.setDescription(TextUtil.implode(args, " ").replaceAll("(&([a-f0-9]))", "& $2")); // since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
if (!Conf.broadcastDescriptionChanges) { if (!Conf.broadcastDescriptionChanges) {
fme.msg("You have changed the description for <h>%s<i> to:", myFaction.describeTo(fme)); fme.msg(TL.COMMAND_DESCRIPTION_CHANGED, myFaction.describeTo(fme));
fme.sendMessage(myFaction.getDescription()); fme.sendMessage(myFaction.getDescription());
return; return;
} }
// Broadcast the description to everyone // Broadcast the description to everyone
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
fplayer.msg("<i>The faction %s<i> changed their description to:", myFaction.describeTo(fplayer)); fplayer.msg(TL.COMMAND_DESCRIPTION_CHANGES, myFaction.describeTo(fplayer));
fplayer.sendMessage(myFaction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking fplayer.sendMessage(myFaction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
} }
} }

View File

@ -7,6 +7,8 @@ import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.scoreboards.FTeamWrapper; import com.massivecraft.factions.scoreboards.FTeamWrapper;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -49,11 +51,11 @@ public class CmdDisband extends FCommand {
} }
if (!faction.isNormal()) { if (!faction.isNormal()) {
msg("<i>You cannot disband the Wilderness, SafeZone, or WarZone."); msg(TL.COMMAND_DISBAND_IMMUTABLE.toString());
return; return;
} }
if (faction.isPermanent()) { if (faction.isPermanent()) {
msg("<i>This faction is designated as permanent, so you cannot disband it."); msg(TL.COMMAND_DISBAND_MARKEDPERMANENT.toString());
return; return;
} }
@ -70,14 +72,15 @@ public class CmdDisband extends FCommand {
// Inform all players // Inform all players
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
String who = senderIsConsole ? "A server admin" : fme.describeTo(fplayer); String who = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer);
if (fplayer.getFaction() == faction) { if (fplayer.getFaction() == faction) {
fplayer.msg("<h>%s<i> disbanded your faction.", who); fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, who);
} else { } else {
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer)); fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, who, faction.getTag(fplayer));
} }
} }
if (Conf.logFactionDisband) { if (Conf.logFactionDisband) {
//TODO: Format this correctly and translate.
P.p.log("The faction " + faction.getTag() + " (" + faction.getId() + ") was disbanded by " + (senderIsConsole ? "console command" : fme.getName()) + "."); P.p.log("The faction " + faction.getTag() + " (" + faction.getId() + ") was disbanded by " + (senderIsConsole ? "console command" : fme.getName()) + ".");
} }
@ -88,7 +91,8 @@ public class CmdDisband extends FCommand {
if (amount > 0.0) { if (amount > 0.0) {
String amountString = Econ.moneyString(amount); String amountString = Econ.moneyString(amount);
msg("<i>You have been given the disbanded faction's bank, totaling %s.", amountString); msg(TL.COMMAND_DISBAND_HOLDINGS, amountString);
//TODO: Format this correctly and translate
P.p.log(fme.getName() + " has been given bank holdings of " + amountString + " from disbanding " + faction.getTag() + "."); P.p.log(fme.getName() + " has been given bank holdings of " + amountString + " from disbanding " + faction.getTag() + ".");
} }
} }

View File

@ -5,7 +5,11 @@ import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.LazyLocation; import com.massivecraft.factions.util.LazyLocation;
import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.util.LazyLocation;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import java.util.Map; import java.util.Map;
@ -27,14 +31,14 @@ public class CmdFWarp extends FCommand {
public void perform() { public void perform() {
//TODO: check if in combat. //TODO: check if in combat.
if (args.size() == 0) { if (args.size() == 0) {
FancyMessage msg = new FancyMessage("Warps: ").color(ChatColor.GOLD); FancyMessage msg = new FancyMessage(TL.COMMAND_FWARP_WARPS.toString()).color(ChatColor.GOLD);
Map<String, LazyLocation> warps = myFaction.getWarps(); Map<String, LazyLocation> warps = myFaction.getWarps();
for (String s : warps.keySet()) { for (String s : warps.keySet()) {
msg.then(s + " ").tooltip("Click to warp!").command("f warp " + s).color(ChatColor.WHITE); msg.then(s + " ").tooltip(TL.COMMAND_FWARP_CLICKTOWARP.toString()).command("f warp " + s).color(ChatColor.WHITE);
} }
sendFancyMessage(msg); sendFancyMessage(msg);
} else if (args.size() > 1) { } else if (args.size() > 1) {
fme.msg("<i>/f warp <warpname>"); fme.msg(TL.COMMAND_FWARP_COMMANDFORMAT);
} else { } else {
String warpName = argAsString(0); String warpName = argAsString(0);
if (myFaction.isWarp(argAsString(0))) { if (myFaction.isWarp(argAsString(0))) {
@ -42,14 +46,14 @@ public class CmdFWarp extends FCommand {
return; return;
} }
fme.getPlayer().teleport(myFaction.getWarp(warpName).getLocation()); fme.getPlayer().teleport(myFaction.getWarp(warpName).getLocation());
fme.msg("<i>Warped to <a>%s", warpName); fme.msg(TL.COMMAND_FWARP_WARPED, warpName);
} else { } else {
fme.msg("<i>Couldn't find warp <a>%s", warpName); fme.msg(TL.COMMAND_FWARP_INVALID, warpName);
} }
} }
} }
private boolean transact(FPlayer player) { private boolean transact(FPlayer player) {
return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.warp", 5), "to warp", "for warping"); return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.warp", 5), TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
} }
} }

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,7 +42,7 @@ public class CmdHelp extends FCommand {
page -= 1; page -= 1;
if (page < 0 || page >= helpPages.size()) { if (page < 0 || page >= helpPages.size()) {
msg("<b>This page does not exist"); msg(TL.COMMAND_HELP_404.toString());
return; return;
} }
sendMessage(helpPages.get(page)); sendMessage(helpPages.get(page));
@ -66,27 +67,27 @@ public class CmdHelp extends FCommand {
pageLines.add(p.cmdBase.cmdLeave.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdLeave.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdChat.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdChat.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdHome.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.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_NEXTCREATE.toString()));
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add(p.cmdBase.cmdCreate.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdCreate.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdDescription.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdDescription.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdTag.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.txt.parse(TL.COMMAND_HELP_INVITATIONS.toString()));
pageLines.add(p.cmdBase.cmdOpen.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdOpen.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdInvite.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdInvite.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdDeinvite.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.txt.parse(TL.COMMAND_HELP_HOME.toString()));
pageLines.add(p.cmdBase.cmdSethome.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdSethome.getUseageTemplate(true));
helpPages.add(pageLines); helpPages.add(pageLines);
if (Econ.isSetup() && Conf.econEnabled && Conf.bankEnabled) { if (Econ.isSetup() && Conf.econEnabled && Conf.bankEnabled) {
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add(""); pageLines.add("");
pageLines.add(p.txt.parse("<i>Your faction has a bank which is used to pay for certain")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_1.toString()));
pageLines.add(p.txt.parse("<i>things, so it will need to have money deposited into it.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_2.toString()));
pageLines.add(p.txt.parse("<i>To learn more, use the money command.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_3.toString()));
pageLines.add(""); pageLines.add("");
pageLines.add(p.cmdBase.cmdMoney.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdMoney.getUseageTemplate(true));
pageLines.add(""); pageLines.add("");
@ -107,7 +108,7 @@ public class CmdHelp extends FCommand {
pageLines.add(p.cmdBase.cmdSB.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdSB.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdSeeChunk.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdSeeChunk.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdStatus.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdStatus.getUseageTemplate(true));
pageLines.add(p.txt.parse("<i>Player titles are just for fun. No rules connected to them.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_PLAYERTITLES.toString()));
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
@ -115,9 +116,9 @@ public class CmdHelp extends FCommand {
pageLines.add(p.cmdBase.cmdBoom.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdBoom.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdOwner.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdOwner.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdOwnerList.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdOwnerList.getUseageTemplate(true));
pageLines.add(p.txt.parse("<i>Claimed land with ownership set is further protected so")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_1.toString()));
pageLines.add(p.txt.parse("<i>that only the owner(s), faction admin, and possibly the")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_2.toString()));
pageLines.add(p.txt.parse("<i>faction moderators have full access.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_3.toString()));
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
@ -126,50 +127,51 @@ public class CmdHelp extends FCommand {
pageLines.add(p.cmdBase.cmdRelationAlly.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdRelationAlly.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdRelationNeutral.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdRelationNeutral.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdRelationEnemy.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(TL.COMMAND_HELP_RELATIONS_1.toString()));
pageLines.add(p.txt.parse("<i>Your default relation with other factions will be neutral.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_2.toString()));
pageLines.add(p.txt.parse("<i>If BOTH factions choose \"ally\" you will be allies.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_3.toString()));
pageLines.add(p.txt.parse("<i>If ONE faction chooses \"enemy\" you will be enemies.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_4.toString()));
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add(p.txt.parse("<i>You can never hurt members or allies.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_5.toString()));
pageLines.add(p.txt.parse("<i>You can not hurt neutrals in their own territory.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_6.toString()));
pageLines.add(p.txt.parse("<i>You can always hurt enemies and players without faction.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_7.toString()));
pageLines.add(""); pageLines.add(TL.COMMAND_HELP_RELATIONS_8.toString());
pageLines.add(p.txt.parse("<i>Damage from enemies is reduced in your own territory.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_9.toString()));
pageLines.add(p.txt.parse("<i>When you die you lose power. It is restored over time.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_10.toString()));
pageLines.add(p.txt.parse("<i>The power of a faction is the sum of all member power.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_11.toString()));
pageLines.add(p.txt.parse("<i>The power of a faction determines how much land it can hold.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_12.toString()));
pageLines.add(p.txt.parse("<i>You can claim land from factions with too little power.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_13.toString()));
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); 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(TL.COMMAND_HELP_PERMISSIONS_1.toString()));
pageLines.add(p.txt.parse("<i>territory. Usage of the following items is also restricted:")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_2.toString()));
pageLines.add(p.txt.parse("<i>Door, Chest, Furnace, Dispenser, Diode.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_3.toString()));
pageLines.add(""); pageLines.add(TL.COMMAND_HELP_PERMISSIONS_4.toString());
pageLines.add(p.txt.parse("<i>Make sure to put pressure plates in front of doors for your")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_5.toString()));
pageLines.add(p.txt.parse("<i>guest visitors. Otherwise they can't get through. You can")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_6.toString()));
pageLines.add(p.txt.parse("<i>also use this to create member only areas.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_7.toString()));
pageLines.add(p.txt.parse("<i>As dispensers are protected, you can create traps without")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_8.toString()));
pageLines.add(p.txt.parse("<i>worrying about those arrows getting stolen.")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_9.toString()));
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add("Finally some commands for the server admins:"); pageLines.add(TL.COMMAND_HELP_MOAR_1.toString());
pageLines.add(p.cmdBase.cmdBypass.getUseageTemplate(true)); 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(TL.COMMAND_HELP_ADMIN_1.toString()));
pageLines.add(p.txt.parse("<c>/f claim warzone <i>claim land for the War Zone")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_2.toString()));
pageLines.add(p.txt.parse("<c>/f autoclaim [safezone|warzone] <i>take a guess")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_3.toString()));
pageLines.add(p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdWarunclaimall.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdWarunclaimall.getUseageTemplate(true));
//TODO:TL
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well.")); pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."));
pageLines.add(p.cmdBase.cmdPeaceful.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdPeaceful.getUseageTemplate(true));
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add(p.txt.parse("<i>More commands for server admins:")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_MOAR_2.toString()));
pageLines.add(p.cmdBase.cmdChatSpy.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdChatSpy.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPermanent.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdPermanent.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPermanentPower.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdPermanentPower.getUseageTemplate(true));
@ -178,7 +180,7 @@ public class CmdHelp extends FCommand {
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add(p.txt.parse("<i>Even more commands for server admins:")); pageLines.add(p.txt.parse(TL.COMMAND_HELP_MOAR_3.toString()));
pageLines.add(p.cmdBase.cmdLock.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdLock.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdReload.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdReload.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdSaveAll.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdSaveAll.getUseageTemplate(true));

View File

@ -6,6 +6,8 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.SmokeUtil; import com.massivecraft.factions.zcore.util.SmokeUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -36,28 +38,28 @@ public class CmdHome extends FCommand {
public void perform() { public void perform() {
// TODO: Hide this command on help also. // TODO: Hide this command on help also.
if (!Conf.homesEnabled) { if (!Conf.homesEnabled) {
fme.msg("<b>Sorry, Faction homes are disabled on this server."); fme.msg(TL.COMMAND_HOME_DISABLED);
return; return;
} }
if (!Conf.homesTeleportCommandEnabled) { if (!Conf.homesTeleportCommandEnabled) {
fme.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server."); fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED);
return; return;
} }
if (!myFaction.hasHome()) { if (!myFaction.hasHome()) {
fme.msg("<b>Your faction does not have a home. " + (fme.getRole().value < Role.MODERATOR.value ? "<i> Ask your leader to:" : "<i>You should:")); fme.msg(TL.COMMAND_HOME_NOHOME.toString() + (fme.getRole().value < Role.MODERATOR.value ? TL.GENERIC_ASKYOURLEADER.toString() : TL.GENERIC_YOUSHOULD.toString()));
fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate()); fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate());
return; return;
} }
if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) { if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) {
fme.msg("<b>You cannot teleport to your faction home while in the territory of an enemy faction."); fme.msg(TL.COMMAND_HOME_INENEMY);
return; return;
} }
if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) { if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
fme.msg("<b>You cannot teleport to your faction home while in a different world."); fme.msg(TL.COMMAND_HOME_WRONGWORLD);
return; return;
} }
@ -94,7 +96,7 @@ public class CmdHome extends FCommand {
continue; continue;
} }
fme.msg("<b>You cannot teleport to your faction home while an enemy is within " + Conf.homesTeleportAllowedEnemyDistance + " blocks of you."); fme.msg(TL.COMMAND_HOME_ENEMYNEAR,String.valueOf(Conf.homesTeleportAllowedEnemyDistance));
return; return;
} }
} }
@ -105,7 +107,7 @@ public class CmdHome extends FCommand {
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostHome, "to teleport to your faction home", "for teleporting to your faction home")) { if (!payForCommand(Conf.econCostHome, TL.COMMAND_HOME_TOTELEPORT.toString(), TL.COMMAND_HOME_FORTELEPORT.toString())) {
return; return;
} }

View File

@ -3,7 +3,10 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdInvite extends FCommand { public class CmdInvite extends FCommand {
@ -33,13 +36,13 @@ public class CmdInvite extends FCommand {
} }
if (you.getFaction() == myFaction) { if (you.getFaction() == myFaction) {
msg("%s<i> is already a member of %s", you.getName(), myFaction.getTag()); msg(TL.COMMAND_INVITE_ALREADYMEMBER, you.getName(), myFaction.getTag());
msg("<i>You might want to: " + p.cmdBase.cmdKick.getUseageTemplate(false)); msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdKick.getUseageTemplate(false));
return; return;
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostInvite, "to invite someone", "for inviting someone")) { if (!payForCommand(Conf.econCostInvite, TL.COMMAND_INVITE_TOINVITE.toString(), TL.COMMAND_INVITE_FORINVITE.toString())) {
return; return;
} }
@ -49,12 +52,12 @@ public class CmdInvite extends FCommand {
} }
// Tooltips, colors, and commands only apply to the string immediately before it. // Tooltips, colors, and commands only apply to the string immediately before it.
FancyMessage message = new FancyMessage(fme.describeTo(you, true)).tooltip("Click to join!").command("f join " + myFaction.getTag()).then(" has invited you to join ").color(ChatColor.YELLOW).tooltip("Click to join!").command("f join " + myFaction.getTag()).then(myFaction.describeTo(you)).tooltip("Click to join!").command("f join " + myFaction.getTag()); FancyMessage message = new FancyMessage(fme.describeTo(you, true)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("f join " + myFaction.getTag()).then(TL.COMMAND_INVITE_INVITEDYOU.toString()).color(ChatColor.YELLOW).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("f join " + myFaction.getTag()).then(myFaction.describeTo(you)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("f join " + myFaction.getTag());
message.send(you.getPlayer()); message.send(you.getPlayer());
//you.msg("%s<i> invited you to %s", fme.describeTo(you, true), myFaction.describeTo(you)); //you.msg("%s<i> invited you to %s", fme.describeTo(you, true), myFaction.describeTo(you));
myFaction.msg("%s<i> invited %s<i> to your faction.", fme.describeTo(myFaction, true), you.describeTo(myFaction)); myFaction.msg(TL.COMMAND_INVITE_INVITED, fme.describeTo(myFaction, true), you.describeTo(myFaction));
} }
} }

View File

@ -3,6 +3,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.*; import com.massivecraft.factions.*;
import com.massivecraft.factions.event.FPlayerJoinEvent; import com.massivecraft.factions.event.FPlayerJoinEvent;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
public class CmdJoin extends FCommand { public class CmdJoin extends FCommand {
@ -34,45 +36,47 @@ public class CmdJoin extends FCommand {
boolean samePlayer = fplayer == fme; boolean samePlayer = fplayer == fme;
if (!samePlayer && !Permission.JOIN_OTHERS.has(sender, false)) { if (!samePlayer && !Permission.JOIN_OTHERS.has(sender, false)) {
msg("<b>You do not have permission to move other players into a faction."); msg(TL.COMMAND_JOIN_CANNOTFORCE);
return; return;
} }
if (!faction.isNormal()) { if (!faction.isNormal()) {
msg("<b>Players may only join normal factions. This is a system faction."); msg(TL.COMMAND_JOIN_SYSTEMFACTION);
return; return;
} }
if (faction == fplayer.getFaction()) { if (faction == fplayer.getFaction()) {
msg("<b>%s %s already a member of %s", fplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme)); //TODO:TL
msg(TL.COMMAND_JOIN_ALREADYMEMBER, fplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme));
return; return;
} }
if (Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= Conf.factionMemberLimit) { if (Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= Conf.factionMemberLimit) {
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getTag(fme), Conf.factionMemberLimit, fplayer.describeTo(fme, false)); msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), Conf.factionMemberLimit, fplayer.describeTo(fme, false));
return; return;
} }
if (fplayer.hasFaction()) { if (fplayer.hasFaction()) {
msg("<b>%s must leave %s current faction first.", fplayer.describeTo(fme, true), (samePlayer ? "your" : "their")); //TODO:TL
msg(TL.COMMAND_JOIN_INOTHERFACTION, fplayer.describeTo(fme, true), (samePlayer ? "your" : "their"));
return; return;
} }
if (!Conf.canLeaveWithNegativePower && fplayer.getPower() < 0) { if (!Conf.canLeaveWithNegativePower && fplayer.getPower() < 0) {
msg("<b>%s cannot join a faction with a negative power level.", fplayer.describeTo(fme, true)); msg(TL.COMMAND_JOIN_NEGATIVEPOWER, fplayer.describeTo(fme, true));
return; return;
} }
if (!(faction.getOpen() || faction.isInvited(fplayer) || fme.isAdminBypassing() || Permission.JOIN_ANY.has(sender, false))) { if (!(faction.getOpen() || faction.isInvited(fplayer) || fme.isAdminBypassing() || Permission.JOIN_ANY.has(sender, false))) {
msg("<i>This faction requires invitation."); msg(TL.COMMAND_JOIN_REQUIRESINVITATION);
if (samePlayer) { if (samePlayer) {
faction.msg("%s<i> tried to join your faction.", fplayer.describeTo(faction, true)); faction.msg(TL.COMMAND_JOIN_ATTEMPTEDJOIN, fplayer.describeTo(faction, true));
} }
return; return;
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (samePlayer && !canAffordCommand(Conf.econCostJoin, "to join a faction")) { if (samePlayer && !canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) {
return; return;
} }
@ -84,16 +88,16 @@ public class CmdJoin extends FCommand {
} }
// then make 'em pay (if applicable) // then make 'em pay (if applicable)
if (samePlayer && !payForCommand(Conf.econCostJoin, "to join a faction", "for joining a faction")) { if (samePlayer && !payForCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString(), TL.COMMAND_JOIN_FORJOIN.toString())) {
return; return;
} }
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme)); fme.msg(TL.COMMAND_JOIN_SUCCESS, fplayer.describeTo(fme, true), faction.getTag(fme));
if (!samePlayer) { if (!samePlayer) {
fplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(fplayer, true), faction.getTag(fplayer)); fplayer.msg(TL.COMMAND_JOIN_MOVED, fme.describeTo(fplayer, true), faction.getTag(fplayer));
} }
faction.msg("<i>%s joined your faction.", fplayer.describeTo(faction, true)); faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
fplayer.resetFactionData(); fplayer.resetFactionData();
fplayer.setFaction(faction); fplayer.setFaction(faction);
@ -101,9 +105,9 @@ public class CmdJoin extends FCommand {
if (Conf.logFactionJoin) { if (Conf.logFactionJoin) {
if (samePlayer) { if (samePlayer) {
P.p.log("%s joined the faction %s.", fplayer.getName(), faction.getTag()); P.p.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
} else { } else {
P.p.log("%s moved the player %s into the faction %s.", fme.getName(), fplayer.getName(), faction.getTag()); P.p.log(TL.COMMAND_JOIN_MOVEDLOG.toString(), fme.getName(), fplayer.getName(), faction.getTag());
} }
} }
} }

View File

@ -34,15 +34,15 @@ public class CmdKick extends FCommand {
public void perform() { public void perform() {
FPlayer toKick = this.argAsBestFPlayerMatch(0); FPlayer toKick = this.argAsBestFPlayerMatch(0);
if (toKick == null) { if (toKick == null) {
FancyMessage msg = new FancyMessage("Players you can kick: ").color(ChatColor.GOLD); FancyMessage msg = new FancyMessage(TL.COMMAND_KICK_CANDIDATES.toString()).color(ChatColor.GOLD);
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) { for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
String s = player.getName(); String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip("Click to kick " + s).command("f kick " + s); msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("f kick " + s);
} }
if (fme.getRole() == Role.ADMIN) { if (fme.getRole() == Role.ADMIN) {
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) { for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) {
String s = player.getName(); String s = player.getName();
msg.then(s + " ").color(ChatColor.GRAY).tooltip("Click to kick " + s).command("f kick " + s); msg.then(s + " ").color(ChatColor.GRAY).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("f kick " + s);
} }
} }
@ -51,8 +51,8 @@ public class CmdKick extends FCommand {
} }
if (fme == toKick) { if (fme == toKick) {
msg("<b>You cannot kick yourself."); msg(TL.COMMAND_KICK_SELF);
msg("<i>You might want to: %s", p.cmdBase.cmdLeave.getUseageTemplate(false)); msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdLeave.getUseageTemplate(false));
return; return;
} }
@ -60,30 +60,30 @@ public class CmdKick extends FCommand {
// The PlayerEntityCollection only holds online players, this was a specific issue that kept happening. // The PlayerEntityCollection only holds online players, this was a specific issue that kept happening.
if (toKickFaction.getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) { if (toKickFaction.getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) {
sender.sendMessage("Something went wrong with getting the offline player's faction."); sender.sendMessage(TL.COMMAND_KICK_OFFLINE.toString());
return; return;
} }
// players with admin-level "disband" permission can bypass these requirements // players with admin-level "disband" permission can bypass these requirements
if (!Permission.KICK_ANY.has(sender)) { if (!Permission.KICK_ANY.has(sender)) {
if (toKickFaction != myFaction) { if (toKickFaction != myFaction) {
msg("%s<b> is not a member of %s", toKick.describeTo(fme, true), myFaction.describeTo(fme)); msg(TL.COMMAND_KICK_NOTMEMBER, toKick.describeTo(fme, true), myFaction.describeTo(fme));
return; return;
} }
if (toKick.getRole().value >= fme.getRole().value) { if (toKick.getRole().value >= fme.getRole().value) {
msg("<b>Your rank is too low to kick this player."); msg(TL.COMMAND_KICK_INSUFFICIENTRANK);
return; return;
} }
if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) { if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) {
msg("<b>You cannot kick that member until their power is positive."); msg(TL.COMMAND_KICK_NEGATIVEPOWER);
return; return;
} }
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostKick, "to kick someone from the faction")) { if (!canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) {
return; return;
} }
@ -95,17 +95,18 @@ public class CmdKick extends FCommand {
} }
// then make 'em pay (if applicable) // then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostKick, "to kick someone from the faction", "for kicking someone from the faction")) { if (!payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) {
return; return;
} }
toKickFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true)); toKickFaction.msg(TL.COMMAND_KICK_FACTION, fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
toKick.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(toKick, true), toKickFaction.describeTo(toKick)); toKick.msg(TL.COMMAND_KICK_KICKED, fme.describeTo(toKick, true), toKickFaction.describeTo(toKick));
if (toKickFaction != myFaction) { if (toKickFaction != myFaction) {
fme.msg("<i>You kicked %s<i> from the faction %s<i>!", toKick.describeTo(fme), toKickFaction.describeTo(fme)); fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme));
} }
if (Conf.logFactionKick) { if (Conf.logFactionKick) {
//TODO:TL
P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag()); P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag());
} }

View File

@ -4,7 +4,10 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import java.util.ArrayList; import java.util.ArrayList;
@ -34,7 +37,7 @@ public class CmdList extends FCommand {
@Override @Override
public void perform() { public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostList, "to list the factions", "for listing the factions")) { if (!payForCommand(Conf.econCostList, TL.COMMAND_LIST_TOLIST.toString() , TL.COMMAND_LIST_FORLIST.toString())) {
return; return;
} }
@ -91,12 +94,12 @@ public class CmdList extends FCommand {
end = factionList.size(); end = factionList.size();
} }
lines.add(new FancyMessage(p.txt.titleize("Faction List " + pagenumber + "/" + pagecount))); lines.add(new FancyMessage(p.txt.titleize(TL.COMMAND_LIST_FACTIONLIST.toString() + pagenumber + "/" + pagecount)));
for (Faction faction : factionList.subList(start, end)) { for (Faction faction : factionList.subList(start, end)) {
if (faction.isNone()) { if (faction.isNone()) {
String online = String.valueOf(faction.getFPlayersWhereOnline(true).size()); String online = String.valueOf(faction.getFPlayersWhereOnline(true).size());
FancyMessage msg = new FancyMessage("Factionless " + online + " online").color(ChatColor.YELLOW); FancyMessage msg = new FancyMessage(TL.COMMAND_LIST_ONLINEFACTIONLESS.toString() + online).color(ChatColor.YELLOW);
lines.add(msg); lines.add(msg);
continue; continue;
} }

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdLock extends FCommand { public class CmdLock extends FCommand {
@ -30,12 +31,7 @@ public class CmdLock extends FCommand {
@Override @Override
public void perform() { public void perform() {
p.setLocked(this.argAsBool(0, !p.getLocked())); p.setLocked(this.argAsBool(0, !p.getLocked()));
msg(p.getLocked()?TL.COMMAND_LOCK_LOCKED:TL.COMMAND_LOCK_UNLOCKED);
if (p.getLocked()) {
msg("<i>Factions is now locked");
} else {
msg("<i>Factions in now unlocked");
}
} }
} }

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdMap extends FCommand { public class CmdMap extends FCommand {
@ -36,18 +37,18 @@ public class CmdMap extends FCommand {
} }
fme.setMapAutoUpdating(true); fme.setMapAutoUpdating(true);
msg("<i>Map auto update <green>ENABLED."); msg(TL.COMMAND_MAP_UPDATE_ENABLED);
// And show the map once // And show the map once
showMap(); showMap();
} else { } else {
// Turn off // Turn off
fme.setMapAutoUpdating(false); fme.setMapAutoUpdating(false);
msg("<i>Map auto update <red>DISABLED."); msg(TL.COMMAND_MAP_UPDATE_DISABLED);
} }
} else { } else {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostMap, "to show the map", "for showing the map")) { if (!payForCommand(Conf.econCostMap, TL.COMMAND_MAP_TOSHOW, TL.COMMAND_MAP_FORSHOW)) {
return; return;
} }

View File

@ -4,7 +4,10 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdMod extends FCommand { public class CmdMod extends FCommand {
@ -29,10 +32,10 @@ public class CmdMod extends FCommand {
public void perform() { public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0); FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) { if (you == null) {
FancyMessage msg = new FancyMessage("Players you can promote: ").color(ChatColor.GOLD); FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) { for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
String s = player.getName(); String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip("Click to promote " + s).command("f mod " + s); msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("f mod " + s);
} }
sendFancyMessage(msg); sendFancyMessage(msg);
@ -42,35 +45,35 @@ public class CmdMod extends FCommand {
Faction targetFaction = you.getFaction(); Faction targetFaction = you.getFaction();
if (targetFaction != myFaction && !permAny) { if (targetFaction != myFaction && !permAny) {
msg("%s<b> is not a member in your faction.", you.describeTo(fme, true)); msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
return; return;
} }
if (fme != null && fme.getRole() != Role.ADMIN && !permAny) { if (fme != null && fme.getRole() != Role.ADMIN && !permAny) {
msg("<b>You are not the faction admin."); msg(TL.COMMAND_MOD_NOTADMIN);
return; return;
} }
if (you == fme && !permAny) { if (you == fme && !permAny) {
msg("<b>The target player musn't be yourself."); msg(TL.COMMAND_MOD_SELF);
return; return;
} }
if (you.getRole() == Role.ADMIN) { if (you.getRole() == Role.ADMIN) {
msg("<b>The target player is a faction admin. Demote them first."); msg(TL.COMMAND_MOD_TARGETISADMIN);
return; return;
} }
if (you.getRole() == Role.MODERATOR) { if (you.getRole() == Role.MODERATOR) {
// Revoke // Revoke
you.setRole(Role.NORMAL); you.setRole(Role.NORMAL);
targetFaction.msg("%s<i> is no longer moderator in your faction.", you.describeTo(targetFaction, true)); targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true));
msg("<i>You have removed moderator status from %s<i>.", you.describeTo(fme, true)); msg(TL.COMMAND_MOD_REVOKES, you.describeTo(fme, true));
} else { } else {
// Give // Give
you.setRole(Role.MODERATOR); you.setRole(Role.MODERATOR);
targetFaction.msg("%s<i> was promoted to moderator in your faction.", you.describeTo(targetFaction, true)); targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
msg("<i>You have promoted %s<i> to moderator.", you.describeTo(fme, true)); msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(fme, true));
} }
} }

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdModifyPower extends FCommand { public class CmdModifyPower extends FCommand {
@ -38,6 +39,6 @@ public class CmdModifyPower extends FCommand {
player.alterPower(number); player.alterPower(number);
int newPower = player.getPowerRounded(); // int so we don't have super long doubles. int newPower = player.getPowerRounded(); // int so we don't have super long doubles.
msg("<i>Added <a>%f <i>power to <a>%s. <i>New total rounded power: <a>%d", number, player.getName(), newPower); msg(TL.COMMAND_MODIFYPOWER_ADDED, number, player.getName(), newPower);
} }
} }

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.zcore.util.TL;
public class CmdMoney extends FCommand { public class CmdMoney extends FCommand {
@ -25,8 +26,8 @@ public class CmdMoney extends FCommand {
senderMustBeModerator = false; senderMustBeModerator = false;
senderMustBeAdmin = false; senderMustBeAdmin = false;
this.setHelpShort("faction money commands"); this.setHelpShort(TL.COMMAND_MONEY_SHORT.toString());
this.helpLong.add(p.txt.parseTags("<i>The faction money commands.")); this.helpLong.add(p.txt.parseTags(TL.COMMAND_MONEY_LONG.toString()));
this.addSubCommand(this.cmdMoneyBalance); this.addSubCommand(this.cmdMoneyBalance);
this.addSubCommand(this.cmdMoneyDeposit); this.addSubCommand(this.cmdMoneyDeposit);

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdMoneyBalance extends FCommand { public class CmdMoneyBalance extends FCommand {
@ -15,7 +16,7 @@ public class CmdMoneyBalance extends FCommand {
this.optionalArgs.put("faction", "yours"); this.optionalArgs.put("faction", "yours");
this.permission = Permission.MONEY_BALANCE.node; this.permission = Permission.MONEY_BALANCE.node;
this.setHelpShort("show faction balance"); this.setHelpShort(TL.COMMAND_MONEYBALANCE_SHORT.toString());
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.P;
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.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -19,7 +21,7 @@ public class CmdMoneyDeposit extends FCommand {
this.optionalArgs.put("faction", "yours"); this.optionalArgs.put("faction", "yours");
this.permission = Permission.MONEY_DEPOSIT.node; this.permission = Permission.MONEY_DEPOSIT.node;
this.setHelpShort("deposit money"); this.setHelpShort(TL.COMMAND_MONEYDEPOSIT_SHORT.toString());
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -37,7 +39,7 @@ public class CmdMoneyDeposit extends FCommand {
boolean success = Econ.transferMoney(fme, fme, faction, amount); boolean success = Econ.transferMoney(fme, fme, faction, amount);
if (success && Conf.logMoneyTransactions) { if (success && Conf.logMoneyTransactions) {
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYDEPOSIT_DEPOSITED.toString(), fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
} }
} }

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.P;
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.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -20,7 +22,7 @@ public class CmdMoneyTransferFf extends FCommand {
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.MONEY_F2F.node; this.permission = Permission.MONEY_F2F.node;
this.setHelpShort("transfer f -> f"); this.setHelpShort(TL.COMMAND_MONEYTRANSFERFF_SHORT.toString());
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -43,7 +45,7 @@ public class CmdMoneyTransferFf extends FCommand {
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && Conf.logMoneyTransactions) { if (success && Conf.logMoneyTransactions) {
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYTRANSFERFF_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.P;
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.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -20,7 +22,7 @@ public class CmdMoneyTransferFp extends FCommand {
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.MONEY_F2P.node; this.permission = Permission.MONEY_F2P.node;
this.setHelpShort("transfer f -> p"); this.setHelpShort(TL.COMMAND_MONEYTRANSFERFP_SHORT.toString());
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -43,7 +45,7 @@ public class CmdMoneyTransferFp extends FCommand {
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && Conf.logMoneyTransactions) { if (success && Conf.logMoneyTransactions) {
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYTRANSFERFP_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.P;
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.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -20,7 +22,7 @@ public class CmdMoneyTransferPf extends FCommand {
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.MONEY_P2F.node; this.permission = Permission.MONEY_P2F.node;
this.setHelpShort("transfer p -> f"); this.setHelpShort(TL.COMMAND_MONEYTRANSFERPF_SHORT.toString());
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -43,7 +45,7 @@ public class CmdMoneyTransferPf extends FCommand {
boolean success = Econ.transferMoney(fme, from, to, amount); boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && Conf.logMoneyTransactions) { if (success && Conf.logMoneyTransactions) {
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null)))); P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYTRANSFERPF_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
} }
} }
} }

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.P;
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.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -18,7 +20,7 @@ public class CmdMoneyWithdraw extends FCommand {
this.optionalArgs.put("faction", "yours"); this.optionalArgs.put("faction", "yours");
this.permission = Permission.MONEY_WITHDRAW.node; this.permission = Permission.MONEY_WITHDRAW.node;
this.setHelpShort("withdraw money"); this.setHelpShort(TL.COMMAND_MONEYWITHDRAW_SHORT.toString());
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -36,7 +38,7 @@ public class CmdMoneyWithdraw extends FCommand {
boolean success = Econ.transferMoney(fme, faction, fme, amount); boolean success = Econ.transferMoney(fme, faction, fme, amount);
if (success && Conf.logMoneyTransactions) { if (success && Conf.logMoneyTransactions) {
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null)))); P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYWITHDRAW_WITHDRAW.toString(), fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
} }
} }
} }

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdOpen extends FCommand { public class CmdOpen extends FCommand {
@ -26,21 +27,21 @@ public class CmdOpen extends FCommand {
@Override @Override
public void perform() { public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostOpen, "to open or close the faction", "for opening or closing the faction")) { if (!payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
return; return;
} }
myFaction.setOpen(this.argAsBool(0, !myFaction.getOpen())); myFaction.setOpen(this.argAsBool(0, !myFaction.getOpen()));
String open = myFaction.getOpen() ? "open" : "closed"; String open = myFaction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
// Inform // Inform
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fplayer.getFactionId().equals(myFaction.getId())) { if (fplayer.getFactionId().equals(myFaction.getId())) {
fplayer.msg("%s<i> changed the faction to <h>%s<i>.", fme.getName(), open); fplayer.msg(TL.COMMAND_OPEN_CHANGES, fme.getName(), open);
continue; continue;
} }
fplayer.msg("<i>The faction %s<i> is now %s", myFaction.getTag(fplayer.getFaction()), open); fplayer.msg(TL.COMMAND_OPEN_CHANGED, myFaction.getTag(fplayer.getFaction()), open);
} }
} }

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.*; import com.massivecraft.factions.*;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.TL;
public class CmdOwner extends FCommand { public class CmdOwner extends FCommand {
@ -34,12 +35,12 @@ public class CmdOwner extends FCommand {
} }
if (!Conf.ownedAreasEnabled) { if (!Conf.ownedAreasEnabled) {
fme.msg("<b>Sorry, but owned areas are disabled on this server."); fme.msg(TL.COMMAND_OWNER_DISABLED);
return; return;
} }
if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) { if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) {
fme.msg("<b>Sorry, but you have reached the server's <h>limit of %d <b>owned areas per faction.", Conf.ownedAreasLimitPerFaction); fme.msg(TL.COMMAND_OWNER_LIMIT, Conf.ownedAreasLimitPerFaction);
return; return;
} }
@ -51,15 +52,16 @@ public class CmdOwner extends FCommand {
Faction factionHere = Board.getInstance().getFactionAt(flocation); Faction factionHere = Board.getInstance().getFactionAt(flocation);
if (factionHere != myFaction) { if (factionHere != myFaction) {
if (!hasBypass) { if (!factionHere.isNormal()) {
fme.msg("<b>This land is not claimed by your faction, so you can't set ownership of it."); fme.msg(TL.COMMAND_OWNER_NOTCLAIMED);
return; return;
} }
if (!factionHere.isNormal()) { if (!hasBypass) {
fme.msg("<b>This land is not claimed by a faction. Ownership is not possible."); fme.msg(TL.COMMAND_OWNER_WRONGFACTION);
return; return;
} }
} }
FPlayer target = this.argAsBestFPlayerMatch(0, fme); FPlayer target = this.argAsBestFPlayerMatch(0, fme);
@ -70,30 +72,30 @@ public class CmdOwner extends FCommand {
String playerName = target.getName(); String playerName = target.getName();
if (target.getFaction() != myFaction) { if (target.getFaction() != myFaction) {
fme.msg("%s<i> is not a member of this faction.", playerName); fme.msg(TL.COMMAND_OWNER_NOTMEMBER, playerName);
return; return;
} }
// if no player name was passed, and this claim does already have owners set, clear them // if no player name was passed, and this claim does already have owners set, clear them
if (args.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation)) { if (args.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation)) {
myFaction.clearClaimOwnership(flocation); myFaction.clearClaimOwnership(flocation);
fme.msg("<i>You have cleared ownership for this claimed area."); fme.msg(TL.COMMAND_OWNER_CLEARED);
return; return;
} }
if (myFaction.isPlayerInOwnerList(target, flocation)) { if (myFaction.isPlayerInOwnerList(target, flocation)) {
myFaction.removePlayerAsOwner(target, flocation); myFaction.removePlayerAsOwner(target, flocation);
fme.msg("<i>You have removed ownership of this claimed land from %s<i>.", playerName); fme.msg(TL.COMMAND_OWNER_REMOVED, playerName);
return; return;
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostOwner, "to set ownership of claimed land", "for setting ownership of claimed land")) { if (!payForCommand(Conf.econCostOwner, TL.COMMAND_OWNER_TOSET , TL.COMMAND_OWNER_FORSET)) {
return; return;
} }
myFaction.setPlayerAsOwner(target, flocation); myFaction.setPlayerAsOwner(target, flocation);
fme.msg("<i>You have added %s<i> to the owner list for this claimed land.", playerName); fme.msg(TL.COMMAND_OWNER_ADDED, playerName);
} }
} }

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdOwnerList extends FCommand { public class CmdOwnerList extends FCommand {
@ -33,7 +34,7 @@ public class CmdOwnerList extends FCommand {
} }
if (!Conf.ownedAreasEnabled) { if (!Conf.ownedAreasEnabled) {
fme.msg("<b>Owned areas are disabled on this server."); fme.msg(TL.COMMAND_OWNERLIST_DISABLED);
return; return;
} }
@ -41,13 +42,13 @@ public class CmdOwnerList extends FCommand {
if (Board.getInstance().getFactionAt(flocation) != myFaction) { if (Board.getInstance().getFactionAt(flocation) != myFaction) {
if (!hasBypass) { if (!hasBypass) {
fme.msg("<b>This land is not claimed by your faction."); fme.msg(TL.COMMAND_OWNERLIST_WRONGFACTION);
return; return;
} }
//TODO: This code won't ever be called.
myFaction = Board.getInstance().getFactionAt(flocation); myFaction = Board.getInstance().getFactionAt(flocation);
if (!myFaction.isNormal()) { if (!myFaction.isNormal()) {
fme.msg("<i>This land is not claimed by any faction, thus no owners."); fme.msg(TL.COMMAND_OWNERLIST_NOTCLAIMED);
return; return;
} }
} }
@ -55,10 +56,10 @@ public class CmdOwnerList extends FCommand {
String owners = myFaction.getOwnerListString(flocation); String owners = myFaction.getOwnerListString(flocation);
if (owners == null || owners.isEmpty()) { if (owners == null || owners.isEmpty()) {
fme.msg("<i>No owners are set here; everyone in the faction has access."); fme.msg(TL.COMMAND_OWNERLIST_NONE);
return; return;
} }
fme.msg("<i>Current owner(s) of this land: %s", owners); fme.msg(TL.COMMAND_OWNERLIST_OWNERS, owners);
} }
} }

View File

@ -23,6 +23,7 @@ public class CmdPeaceful extends FCommand {
senderMustBeAdmin = false; senderMustBeAdmin = false;
} }
//TODO: TL
@Override @Override
public void perform() { public void perform() {
Faction faction = this.argAsFaction(0); Faction faction = this.argAsFaction(0);

View File

@ -25,6 +25,7 @@ public class CmdPermanent extends FCommand {
senderMustBeAdmin = false; senderMustBeAdmin = false;
} }
//TODO: TL
@Override @Override
public void perform() { public void perform() {
Faction faction = this.argAsFaction(0); Faction faction = this.argAsFaction(0);

View File

@ -21,6 +21,7 @@ public class CmdPermanentPower extends FCommand {
senderMustBeAdmin = false; senderMustBeAdmin = false;
} }
//TODO: TL
@Override @Override
public void perform() { public void perform() {
Faction targetFaction = this.argAsFaction(0); Faction targetFaction = this.argAsFaction(0);

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdPower extends FCommand { public class CmdPower extends FCommand {
@ -35,13 +36,13 @@ public class CmdPower extends FCommand {
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostPower, "to show player power info", "for showing player power info")) { if (!payForCommand(Conf.econCostPower, TL.COMMAND_POWER_TOSHOW , TL.COMMAND_POWER_FORSHOW)) {
return; return;
} }
double powerBoost = target.getPowerBoost(); double powerBoost = target.getPowerBoost();
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")"; String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_POWER_BONUS.toString() : TL.COMMAND_POWER_PENALTY.toString()) + powerBoost + ")";
msg("%s<a> - Power / Maxpower: <i>%d / %d %s", target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost); msg(TL.COMMAND_POWER_POWER, target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost);
} }
} }

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdPowerBoost extends FCommand { public class CmdPowerBoost extends FCommand {
@ -31,14 +32,14 @@ public class CmdPowerBoost extends FCommand {
if (type.equals("f") || type.equals("faction")) { if (type.equals("f") || type.equals("faction")) {
doPlayer = false; doPlayer = false;
} else if (!type.equals("p") && !type.equals("player")) { } else if (!type.equals("p") && !type.equals("player")) {
msg("<b>You must specify \"p\" or \"player\" to target a player or \"f\" or \"faction\" to target a faction."); msg(TL.COMMAND_POWERBOOST_HELP_1);
msg("<b>ex. /f powerboost p SomePlayer 0.5 -or- /f powerboost f SomeFaction -5"); msg(TL.COMMAND_POWERBOOST_HELP_2);
return; return;
} }
Double targetPower = this.argAsDouble(2); Double targetPower = this.argAsDouble(2);
if (targetPower == null) { if (targetPower == null) {
msg("<b>You must specify a valid numeric value for the power bonus/penalty amount."); msg(TL.COMMAND_POWERBOOST_INVALIDNUM);
return; return;
} }
@ -50,19 +51,19 @@ public class CmdPowerBoost extends FCommand {
return; return;
} }
targetPlayer.setPowerBoost(targetPower); targetPlayer.setPowerBoost(targetPower);
target = "Player \"" + targetPlayer.getName() + "\""; target = TL.COMMAND_POWERBOOST_PLAYER.format(targetPlayer.getName());
} else { } else {
Faction targetFaction = this.argAsFaction(1); Faction targetFaction = this.argAsFaction(1);
if (targetFaction == null) { if (targetFaction == null) {
return; return;
} }
targetFaction.setPowerBoost(targetPower); targetFaction.setPowerBoost(targetPower);
target = "Faction \"" + targetFaction.getTag() + "\""; target = TL.COMMAND_POWERBOOST_FACTION.format(targetFaction.getTag());
} }
msg("<i>" + target + " now has a power bonus/penalty of " + targetPower + " to min and max power levels."); msg(TL.COMMAND_POWERBOOST_BOOST,target,targetPower);
if (!senderIsConsole) { if (!senderIsConsole) {
P.p.log(fme.getName() + " has set the power bonus/penalty for " + target + " to " + targetPower + "."); P.p.log(TL.COMMAND_POWERBOOST_BOOSTLOG.toString(),fme.getName(),target,targetPower);
} }
} }
} }

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdReload extends FCommand { public class CmdReload extends FCommand {
@ -30,6 +31,6 @@ public class CmdReload extends FCommand {
long timeReload = (System.currentTimeMillis() - timeInitStart); long timeReload = (System.currentTimeMillis() - timeInitStart);
msg("<i>Reloaded <h>conf.json <i>from disk, took <h>%dms<i>.", timeReload); msg(TL.COMMAND_RELOAD_TIME, timeReload);
} }
} }

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdSafeunclaimall extends FCommand { public class CmdSafeunclaimall extends FCommand {
@ -23,16 +24,16 @@ public class CmdSafeunclaimall extends FCommand {
senderMustBeModerator = false; senderMustBeModerator = false;
senderMustBeAdmin = false; senderMustBeAdmin = false;
this.setHelpShort("Unclaim all safezone land"); this.setHelpShort(TL.COMMAND_SAFEUNCLAIMALL_SHORT.toString());
} }
@Override @Override
public void perform() { public void perform() {
Board.getInstance().unclaimAll(Factions.getInstance().getSafeZone().getId()); Board.getInstance().unclaimAll(Factions.getInstance().getSafeZone().getId());
msg("<i>You unclaimed ALL safe zone land."); msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED);
if (Conf.logLandUnclaims) { if (Conf.logLandUnclaims) {
P.p.log(fme.getName() + " unclaimed all safe zones."); P.p.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName()));
} }
} }

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdSaveAll extends FCommand { public class CmdSaveAll extends FCommand {
@ -31,7 +32,7 @@ public class CmdSaveAll extends FCommand {
Factions.getInstance().forceSave(); Factions.getInstance().forceSave();
Board.getInstance().forceSave(); Board.getInstance().forceSave();
Conf.save(); Conf.save();
msg("<i>Factions saved to disk!"); msg(TL.COMMAND_SAVEALL);
} }
} }

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.LazyLocation; import com.massivecraft.factions.util.LazyLocation;
import com.massivecraft.factions.zcore.util.TL;
public class CmdSetFWarp extends FCommand { public class CmdSetFWarp extends FCommand {
@ -23,13 +24,13 @@ public class CmdSetFWarp extends FCommand {
@Override @Override
public void perform() { public void perform() {
if (!(fme.getRelationToLocation() == Relation.MEMBER)) { if (!(fme.getRelationToLocation() == Relation.MEMBER)) {
fme.msg("<i>You can only set warps in your faction territory."); fme.msg(TL.COMMAND_SETFWARP_NOTCLAIMED);
return; return;
} }
int maxWarps = P.p.getConfig().getInt("max-warps", 5); int maxWarps = P.p.getConfig().getInt("max-warps", 5);
if (maxWarps <= myFaction.getWarps().size()) { if (maxWarps <= myFaction.getWarps().size()) {
fme.msg("<i>Your Faction already has the max amount of warps set <a>(%d).", maxWarps); fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);
return; return;
} }
@ -40,10 +41,10 @@ public class CmdSetFWarp extends FCommand {
String warp = argAsString(0); String warp = argAsString(0);
LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation()); LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation());
myFaction.setWarp(warp, loc); myFaction.setWarp(warp, loc);
fme.msg("<i>Set warp <a>%s <i>to your location.", warp); fme.msg(TL.COMMAND_SETFWARP_SET, warp);
} }
private boolean transact(FPlayer player) { private boolean transact(FPlayer player) {
return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.setwarp", 5), "to set warp", "for setting warp"); return P.p.getConfig().getBoolean("warp-cost.enabled", false) && !player.isAdminBypassing() && Econ.modifyMoney(player, P.p.getConfig().getDouble("warp-cost.setwarp", 5), TL.COMMAND_SETFWARP_TOSET.toString() , TL.COMMAND_SETFWARP_FORSET.toString());
} }
} }

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.TL;
public class CmdSethome extends FCommand { public class CmdSethome extends FCommand {
@ -27,7 +28,7 @@ public class CmdSethome extends FCommand {
@Override @Override
public void perform() { public void perform() {
if (!Conf.homesEnabled) { if (!Conf.homesEnabled) {
fme.msg("<b>Sorry, Faction homes are disabled on this server."); fme.msg(TL.COMMAND_SETHOME_DISABLED);
return; return;
} }
@ -51,21 +52,21 @@ public class CmdSethome extends FCommand {
if (!Permission.BYPASS.has(me) && if (!Permission.BYPASS.has(me) &&
Conf.homesMustBeInClaimedTerritory && Conf.homesMustBeInClaimedTerritory &&
Board.getInstance().getFactionAt(new FLocation(me)) != faction) { Board.getInstance().getFactionAt(new FLocation(me)) != faction) {
fme.msg("<b>Sorry, your faction home can only be set inside your own claimed territory."); fme.msg(TL.COMMAND_SETHOME_NOTCLAIMED);
return; return;
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostSethome, "to set the faction home", "for setting the faction home")) { if (!payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
return; return;
} }
faction.setHome(me.getLocation()); faction.setHome(me.getLocation());
faction.msg("%s<i> set the home for your faction. You can now use:", fme.describeTo(myFaction, true)); faction.msg(TL.COMMAND_SETHOME_SET, fme.describeTo(myFaction, true));
faction.sendMessage(p.cmdBase.cmdHome.getUseageTemplate()); faction.sendMessage(p.cmdBase.cmdHome.getUseageTemplate());
if (faction != myFaction) { if (faction != myFaction) {
fme.msg("<b>You have set the home for the " + faction.getTag(fme) + "<i> faction."); fme.msg(TL.COMMAND_SETHOME_SETOTHER,faction.getTag(fme));
} }
} }

View File

@ -8,7 +8,10 @@ import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,29 +45,29 @@ public class CmdShow extends FCommand {
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostShow, "to show faction information", "for showing faction information")) { if (!payForCommand(Conf.econCostShow, TL.COMMAND_SHOW_TOSHOW, TL.COMMAND_SHOW_FORSHOW)) {
return; return;
} }
msg(p.txt.titleize(faction.getTag(fme))); msg(p.txt.titleize(faction.getTag(fme)));
msg("<a>Description: <i>%s", faction.getDescription()); msg(TL.COMMAND_SHOW_DESCRIPTION, faction.getDescription());
if (!faction.isNormal()) { if (!faction.isNormal()) {
return; return;
} }
String peaceStatus = ""; String peaceStatus = "";
if (faction.isPeaceful()) { if (faction.isPeaceful()) {
peaceStatus = " " + Conf.colorNeutral + "This faction is Peaceful"; peaceStatus = " " + Conf.colorNeutral + TL.COMMAND_SHOW_PEACEFUL.toString();
} }
msg("<a>Joining: <i>" + (faction.getOpen() ? "no invitation is needed" : "invitation is required") + peaceStatus); msg(TL.COMMAND_SHOW_JOINING.toString() + peaceStatus,(faction.getOpen() ? TL.COMMAND_SHOW_UNINVITED.toString() : TL.COMMAND_SHOW_INVITATION.toString()));
double powerBoost = faction.getPowerBoost(); double powerBoost = faction.getPowerBoost();
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")"; String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_SHOW_BONUS.toString():TL.COMMAND_SHOW_PENALTY.toString() + powerBoost + ")");
msg("<a>Land / Power / Maxpower: <i> %d/%d/%d %s", faction.getLandRounded(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost); msg(TL.COMMAND_SHOW_POWER, faction.getLandRounded(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost);
if (faction.isPermanent()) { if (faction.isPermanent()) {
msg("<a>This faction is permanent, remaining even with no members."); msg(TL.COMMAND_SHOW_PERMANENT);
} }
// show the land value // show the land value
@ -73,20 +76,20 @@ public class CmdShow extends FCommand {
double refund = value * Conf.econClaimRefundMultiplier; double refund = value * Conf.econClaimRefundMultiplier;
if (value > 0) { if (value > 0) {
String stringValue = Econ.moneyString(value); String stringValue = Econ.moneyString(value);
String stringRefund = (refund > 0.0) ? (" (" + Econ.moneyString(refund) + " depreciated)") : ""; String stringRefund = (refund > 0.0) ? (TL.COMMAND_SHOW_DEPRECIATED.format(Econ.moneyString(refund))) : "";
msg("<a>Total land value: <i>" + stringValue + stringRefund); msg(TL.COMMAND_SHOW_LANDVALUE,stringValue,stringRefund);
} }
//Show bank contents //Show bank contents
if (Conf.bankEnabled) { if (Conf.bankEnabled) {
msg("<a>Bank contains: <i>" + Econ.moneyString(Econ.getBalance(faction.getAccountId()))); msg(TL.COMMAND_SHOW_BANKCONTAINS,Econ.moneyString(Econ.getBalance(faction.getAccountId())));
} }
} }
ArrayList<FancyMessage> allies = new ArrayList<FancyMessage>(); ArrayList<FancyMessage> allies = new ArrayList<FancyMessage>();
ArrayList<FancyMessage> enemies = new ArrayList<FancyMessage>(); ArrayList<FancyMessage> enemies = new ArrayList<FancyMessage>();
FancyMessage currentAllies = new FancyMessage("Allies: ").color(ChatColor.GOLD); FancyMessage currentAllies = new FancyMessage(TL.COMMAND_SHOW_ALLIES.toString()).color(ChatColor.GOLD);
FancyMessage currentEnemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD); FancyMessage currentEnemies = new FancyMessage(TL.COMMAND_SHOW_ENEMIES.toString()).color(ChatColor.GOLD);
boolean firstAlly = true; boolean firstAlly = true;
boolean firstEnemy = true; boolean firstEnemy = true;
@ -126,8 +129,8 @@ public class CmdShow extends FCommand {
allies.add(currentAllies); allies.add(currentAllies);
enemies.add(currentEnemies); enemies.add(currentEnemies);
FancyMessage online = new FancyMessage("Members online: ").color(ChatColor.GOLD); FancyMessage online = new FancyMessage(TL.COMMAND_SHOW_MEMBERSONLINE.toString()).color(ChatColor.GOLD);
FancyMessage offline = new FancyMessage("Members offline: ").color(ChatColor.GOLD); FancyMessage offline = new FancyMessage(TL.COMMAND_SHOW_MEMBERSOFFLINE.toString()).color(ChatColor.GOLD);
boolean firstOnline = true; boolean firstOnline = true;
boolean firstOffline = true; boolean firstOffline = true;
for (FPlayer p : MiscUtil.rankOrder(faction.getFPlayers())) { for (FPlayer p : MiscUtil.rankOrder(faction.getFPlayers())) {

View File

@ -3,7 +3,10 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class CmdShowInvites extends FCommand { public class CmdShowInvites extends FCommand {
@ -19,11 +22,11 @@ public class CmdShowInvites extends FCommand {
@Override @Override
public void perform() { public void perform() {
FancyMessage msg = new FancyMessage("Players with pending invites: ").color(ChatColor.GOLD); FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
for (String id : myFaction.getInvites()) { for (String id : myFaction.getInvites()) {
FPlayer fp = FPlayers.getInstance().getById(id); FPlayer fp = FPlayers.getInstance().getById(id);
String name = fp != null ? fp.getName() : id; String name = fp != null ? fp.getName() : id;
msg.then(name + " ").color(ChatColor.WHITE).tooltip("Click to revoke invite for " + name).command("f deinvite " + name); msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("f deinvite " + name);
} }
sendFancyMessage(msg); sendFancyMessage(msg);

View File

@ -2,6 +2,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.lang.time.DurationFormatUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -26,10 +28,10 @@ public class CmdStatus extends FCommand {
public void perform() { public void perform() {
ArrayList<String> ret = new ArrayList<String>(); ArrayList<String> ret = new ArrayList<String>();
for (FPlayer fp : myFaction.getFPlayers()) { for (FPlayer fp : myFaction.getFPlayers()) {
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + " ago"; String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
String last = fp.isOnline() ? ChatColor.GREEN + "Online" : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized); String last = fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + String.valueOf(fp.getPowerMaxRounded()) + ChatColor.RESET; String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + String.valueOf(fp.getPowerMaxRounded()) + ChatColor.RESET;
ret.add(String.format("%s Power: %s Last Seen: %s", ChatColor.GOLD + fp.getRole().getPrefix() + fp.getName() + ChatColor.RESET, power, last).trim()); ret.add(String.format(TL.COMMAND_STATUS_FORMAT.toString(), ChatColor.GOLD + fp.getRole().getPrefix() + fp.getName() + ChatColor.RESET, power, last).trim());
} }
fme.sendMessage(ret); fme.sendMessage(ret);
} }

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.event.FactionRenameEvent;
import com.massivecraft.factions.scoreboards.FTeamWrapper; import com.massivecraft.factions.scoreboards.FTeamWrapper;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import java.util.ArrayList; import java.util.ArrayList;
@ -32,7 +34,7 @@ public class CmdTag extends FCommand {
// TODO does not first test cover selfcase? // TODO does not first test cover selfcase?
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) { if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) {
msg("<b>That tag is already taken"); msg(TL.COMMAND_TAG_TAKEN);
return; return;
} }
@ -43,7 +45,7 @@ public class CmdTag extends FCommand {
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostTag, "to change the faction tag")) { if (!canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) {
return; return;
} }
@ -55,7 +57,7 @@ public class CmdTag extends FCommand {
} }
// then make 'em pay (if applicable) // then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostTag, "to change the faction tag", "for changing the faction tag")) { if (!payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE,TL.COMMAND_TAG_FORCHANGE)) {
return; return;
} }
@ -65,11 +67,11 @@ public class CmdTag extends FCommand {
// Inform // Inform
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fplayer.getFactionId() == myFaction.getId()) { if (fplayer.getFactionId() == myFaction.getId()) {
fplayer.msg("%s<i> changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction)); fplayer.msg(TL.COMMAND_TAG_FACTION, fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
continue; continue;
} }
Faction faction = fplayer.getFaction(); Faction faction = fplayer.getFaction();
fplayer.msg("<i>The faction %s<i> changed their name to %s.", fme.getColorTo(faction) + oldtag, myFaction.getTag(faction)); fplayer.msg(TL.COMMAND_TAG_CHANGED, fme.getColorTo(faction) + oldtag, myFaction.getTag(faction));
} }
FTeamWrapper.updatePrefixes(myFaction); FTeamWrapper.updatePrefixes(myFaction);

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TextUtil; import com.massivecraft.factions.zcore.util.TextUtil;
public class CmdTitle extends FCommand { public class CmdTitle extends FCommand {
@ -37,14 +38,14 @@ public class CmdTitle extends FCommand {
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostTitle, "to change a players title", "for changing a players title")) { if (!payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) {
return; return;
} }
you.setTitle(title); you.setTitle(title);
// Inform // Inform
myFaction.msg("%s<i> changed a title: %s", fme.describeTo(myFaction, true), you.describeTo(myFaction, true)); myFaction.msg(TL.COMMAND_TITLE_CHANGED, fme.describeTo(myFaction, true), you.describeTo(myFaction, true));
} }
} }

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.event.LandUnclaimEvent;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
public class CmdUnclaim extends FCommand { public class CmdUnclaim extends FCommand {
@ -33,25 +35,25 @@ public class CmdUnclaim extends FCommand {
if (otherFaction.isSafeZone()) { if (otherFaction.isSafeZone()) {
if (Permission.MANAGE_SAFE_ZONE.has(sender)) { if (Permission.MANAGE_SAFE_ZONE.has(sender)) {
Board.getInstance().removeAt(flocation); Board.getInstance().removeAt(flocation);
msg("<i>Safe zone was unclaimed."); msg(TL.COMMAND_UNCLAIM_SAFEZONE_SUCCESS);
if (Conf.logLandUnclaims) { if (Conf.logLandUnclaims) {
P.p.log(fme.getName() + " unclaimed land at (" + flocation.getCoordString() + ") from the faction: " + otherFaction.getTag()); P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(),flocation.getCoordString(),otherFaction.getTag()));
} }
} else { } else {
msg("<b>This is a safe zone. You lack permissions to unclaim."); msg(TL.COMMAND_UNCLAIM_SAFEZONE_NOPERM);
} }
return; return;
} else if (otherFaction.isWarZone()) { } else if (otherFaction.isWarZone()) {
if (Permission.MANAGE_WAR_ZONE.has(sender)) { if (Permission.MANAGE_WAR_ZONE.has(sender)) {
Board.getInstance().removeAt(flocation); Board.getInstance().removeAt(flocation);
msg("<i>War zone was unclaimed."); msg(TL.COMMAND_UNCLAIM_WARZONE_SUCCESS);
if (Conf.logLandUnclaims) { if (Conf.logLandUnclaims) {
P.p.log(fme.getName() + " unclaimed land at (" + flocation.getCoordString() + ") from the faction: " + otherFaction.getTag()); P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(),flocation.getCoordString(),otherFaction.getTag()));
} }
} else { } else {
msg("<b>This is a war zone. You lack permissions to unclaim."); msg(TL.COMMAND_UNCLAIM_WARZONE_NOPERM);
} }
return; return;
} }
@ -59,11 +61,11 @@ public class CmdUnclaim extends FCommand {
if (fme.isAdminBypassing()) { if (fme.isAdminBypassing()) {
Board.getInstance().removeAt(flocation); Board.getInstance().removeAt(flocation);
otherFaction.msg("%s<i> unclaimed some of your land.", fme.describeTo(otherFaction, true)); otherFaction.msg(TL.COMMAND_UNCLAIM_UNCLAIMED, fme.describeTo(otherFaction, true));
msg("<i>You unclaimed this land."); msg(TL.COMMAND_UNCLAIM_UNCLAIMS);
if (Conf.logLandUnclaims) { if (Conf.logLandUnclaims) {
P.p.log(fme.getName() + " unclaimed land at (" + flocation.getCoordString() + ") from the faction: " + otherFaction.getTag()); P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(),flocation.getCoordString(),otherFaction.getTag()));
} }
return; return;
@ -79,7 +81,7 @@ public class CmdUnclaim extends FCommand {
if (myFaction != otherFaction) { if (myFaction != otherFaction) {
msg("<b>You don't own this land."); msg(TL.COMMAND_UNCLAIM_WRONGFACTION);
return; return;
} }
@ -93,21 +95,21 @@ public class CmdUnclaim extends FCommand {
double refund = Econ.calculateClaimRefund(myFaction.getLandRounded()); double refund = Econ.calculateClaimRefund(myFaction.getLandRounded());
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) { if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
if (!Econ.modifyMoney(myFaction, refund, "to unclaim this land", "for unclaiming this land")) { if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
return; return;
} }
} else { } else {
if (!Econ.modifyMoney(fme, refund, "to unclaim this land", "for unclaiming this land")) { if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
return; return;
} }
} }
} }
Board.getInstance().removeAt(flocation); Board.getInstance().removeAt(flocation);
myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true)); myFaction.msg(TL.COMMAND_UNCLAIM_FACTIONUNCLAIMED, fme.describeTo(myFaction, true));
if (Conf.logLandUnclaims) { if (Conf.logLandUnclaims) {
P.p.log(fme.getName() + " unclaimed land at (" + flocation.getCoordString() + ") from the faction: " + otherFaction.getTag()); P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(),flocation.getCoordString(),otherFaction.getTag()));
} }
} }

View File

@ -6,6 +6,8 @@ import com.massivecraft.factions.P;
import com.massivecraft.factions.event.LandUnclaimAllEvent; import com.massivecraft.factions.event.LandUnclaimAllEvent;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
public class CmdUnclaimall extends FCommand { public class CmdUnclaimall extends FCommand {
@ -31,11 +33,11 @@ public class CmdUnclaimall extends FCommand {
if (Econ.shouldBeUsed()) { if (Econ.shouldBeUsed()) {
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded()); double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) { if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
if (!Econ.modifyMoney(myFaction, refund, "to unclaim all faction land", "for unclaiming all faction land")) { if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
return; return;
} }
} else { } else {
if (!Econ.modifyMoney(fme, refund, "to unclaim all faction land", "for unclaiming all faction land")) { if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
return; return;
} }
} }
@ -46,10 +48,10 @@ public class CmdUnclaimall extends FCommand {
// this event cannot be cancelled // this event cannot be cancelled
Board.getInstance().unclaimAll(myFaction.getId()); Board.getInstance().unclaimAll(myFaction.getId());
myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true)); myFaction.msg(TL.COMMAND_UNCLAIMALL_UNCLAIMED, fme.describeTo(myFaction, true));
if (Conf.logLandUnclaims) { if (Conf.logLandUnclaims) {
P.p.log(fme.getName() + " unclaimed everything for the faction: " + myFaction.getTag()); P.p.log(TL.COMMAND_UNCLAIMALL_LOG.format(fme.getName(),myFaction.getTag()));
} }
} }

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdVersion extends FCommand { public class CmdVersion extends FCommand {
@ -23,6 +24,6 @@ public class CmdVersion extends FCommand {
@Override @Override
public void perform() { public void perform() {
msg("<i>You are running " + P.p.getDescription().getFullName()); msg(TL.COMMAND_VERSION_VERSION,P.p.getDescription().getFullName());
} }
} }

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdWarunclaimall extends FCommand { public class CmdWarunclaimall extends FCommand {
@ -23,16 +24,16 @@ public class CmdWarunclaimall extends FCommand {
senderMustBeModerator = false; senderMustBeModerator = false;
senderMustBeAdmin = false; senderMustBeAdmin = false;
this.setHelpShort("unclaim all warzone land"); this.setHelpShort(TL.COMMAND_WARUNCLAIMALL_SHORT.toString());
} }
@Override @Override
public void perform() { public void perform() {
Board.getInstance().unclaimAll(Factions.getInstance().getWarZone().getId()); Board.getInstance().unclaimAll(Factions.getInstance().getWarZone().getId());
msg("<i>You unclaimed ALL war zone land."); msg(TL.COMMAND_WARUNCLAIMALL_SUCCESS);
if (Conf.logLandUnclaims) { if (Conf.logLandUnclaims) {
P.p.log(fme.getName() + " unclaimed all war zones."); P.p.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName()));
} }
} }

View File

@ -4,6 +4,8 @@ import com.massivecraft.factions.*;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.MCommand; import com.massivecraft.factions.zcore.MCommand;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -275,6 +277,10 @@ public abstract class FCommand extends MCommand<P> {
} }
} }
public boolean payForCommand(double cost,TL toDoThis,TL forDoingThis){
return payForCommand(cost,toDoThis.toString(),forDoingThis.toString());
}
// like above, but just make sure they can pay; returns true unless person can't afford the cost // like above, but just make sure they can pay; returns true unless person can't afford the cost
public boolean canAffordCommand(double cost, String toDoThis) { public boolean canAffordCommand(double cost, String toDoThis) {
if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) { if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {

View File

@ -6,6 +6,8 @@ import com.massivecraft.factions.event.FactionRelationEvent;
import com.massivecraft.factions.scoreboards.FTeamWrapper; import com.massivecraft.factions.scoreboards.FTeamWrapper;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -35,22 +37,22 @@ public abstract class FRelationCommand extends FCommand {
} }
if (!them.isNormal()) { if (!them.isNormal()) {
msg("<b>Nope! You can't."); msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
return; return;
} }
if (them == myFaction) { if (them == myFaction) {
msg("<b>Nope! You can't declare a relation to yourself :)"); msg(TL.COMMAND_RELATIONS_MORENOPE);
return; return;
} }
if (myFaction.getRelationWish(them) == targetRelation) { if (myFaction.getRelationWish(them) == targetRelation) {
msg("<b>You already have that relation wish set with %s.", them.getTag()); msg(TL.COMMAND_RELATIONS_ALREADYINRELATIONSHIP, them.getTag());
return; return;
} }
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(targetRelation.getRelationCost(), "to change a relation wish", "for changing a relation wish")) { if (!payForCommand(targetRelation.getRelationCost(),TL.COMMAND_RELATIONS_TOMARRY , TL.COMMAND_RELATIONS_FORMARRY)) {
return; return;
} }
@ -66,24 +68,25 @@ public abstract class FRelationCommand extends FCommand {
FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation); FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation);
Bukkit.getServer().getPluginManager().callEvent(relationEvent); Bukkit.getServer().getPluginManager().callEvent(relationEvent);
them.msg("<i>Your faction is now " + currentRelationColor + targetRelation.toString() + "<i> to " + currentRelationColor + myFaction.getTag()); them.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation() ,currentRelationColor + myFaction.getTag());
myFaction.msg("<i>Your faction is now " + currentRelationColor + targetRelation.toString() + "<i> to " + currentRelationColor + them.getTag()); myFaction.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation() ,currentRelationColor + myFaction.getTag());
} }
// inform the other faction of your request // inform the other faction of your request
else { else {
them.msg(currentRelationColor + myFaction.getTag() + "<i> wishes to be your " + targetRelation.getColor() + targetRelation.toString());
them.msg("<i>Type <c>/" + Conf.baseCommandAliases.get(0) + " " + targetRelation + " " + myFaction.getTag() + "<i> to accept."); them.msg(TL.COMMAND_RELATIONS_PROPOSAL_1,currentRelationColor + myFaction.getTag(),targetRelation.getColor() + targetRelation.getTranslation());
myFaction.msg(currentRelationColor + them.getTag() + "<i> were informed that you wish to be " + targetRelation.getColor() + targetRelation); them.msg(TL.COMMAND_RELATIONS_PROPOSAL_2,Conf.baseCommandAliases.get(0),targetRelation,myFaction.getTag());
myFaction.msg(TL.COMMAND_RELATIONS_PROPOSAL_SENT,currentRelationColor + them.getTag(),"" + targetRelation.getColor() + targetRelation);
} }
if (!targetRelation.isNeutral() && them.isPeaceful()) { if (!targetRelation.isNeutral() && them.isPeaceful()) {
them.msg("<i>This will have no effect while your faction is peaceful."); them.msg(TL.COMMAND_RELATIONS_PEACEFUL);
myFaction.msg("<i>This will have no effect while their faction is peaceful."); myFaction.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER);
} }
if (!targetRelation.isNeutral() && myFaction.isPeaceful()) { if (!targetRelation.isNeutral() && myFaction.isPeaceful()) {
them.msg("<i>This will have no effect while their faction is peaceful."); them.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER);
myFaction.msg("<i>This will have no effect while your faction is peaceful."); myFaction.msg(TL.COMMAND_RELATIONS_PEACEFUL);
} }
FTeamWrapper.updatePrefixes(myFaction); FTeamWrapper.updatePrefixes(myFaction);

View File

@ -1,8 +1,12 @@
package com.massivecraft.factions.iface; package com.massivecraft.factions.iface;
import com.massivecraft.factions.zcore.util.TL;
public interface EconomyParticipator extends RelationParticipator { public interface EconomyParticipator extends RelationParticipator {
public String getAccountId(); public String getAccountId();
public void msg(String str, Object... args); public void msg(String str, Object... args);
public void msg(TL translation,Object... args);
} }

View File

@ -1,6 +1,8 @@
package com.massivecraft.factions.struct; package com.massivecraft.factions.struct;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -23,6 +25,13 @@ public enum Relation {
return this.nicename; return this.nicename;
} }
public String getTranslation(){
for(TL t:TL.values()){
if(t.name().equals("RELATION_" + name())) return t.toString();
}
return toString();
}
public boolean isMember() { public boolean isMember() {
return this == MEMBER; return this == MEMBER;
} }

View File

@ -4,8 +4,11 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TextUtil; import com.massivecraft.factions.zcore.util.TextUtil;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.lang.time.DurationFormatUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -254,6 +257,10 @@ public abstract class MCommand<T extends MPlugin> {
sender.sendMessage(p.txt.parse(str, args)); sender.sendMessage(p.txt.parse(str, args));
} }
public void msg(TL translation,Object... args){
sender.sendMessage(p.txt.parse(translation.toString(),args));
}
public void sendMessage(String msg) { public void sendMessage(String msg) {
sender.sendMessage(msg); sender.sendMessage(msg);
} }

View File

@ -15,6 +15,8 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.RelationUtil; import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -765,6 +767,10 @@ public abstract class MemoryFPlayer implements FPlayer {
this.sendMessage(P.p.txt.parse(str, args)); this.sendMessage(P.p.txt.parse(str, args));
} }
public void msg(TL translation,Object... args){
this.msg(translation.toString(), args);
}
public Player getPlayer() { public Player getPlayer() {
for (Player player : Bukkit.getServer().getOnlinePlayers()) { for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (player.getUniqueId().toString().equals(this.getId())) { if (player.getUniqueId().toString().equals(this.getId())) {

View File

@ -10,6 +10,8 @@ import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.LazyLocation; import com.massivecraft.factions.util.LazyLocation;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.factions.util.RelationUtil; import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -602,6 +604,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
} }
} }
public void msg(TL translation, Object... args){
msg(translation.toString(),args);
}
public void sendMessage(String message) { public void sendMessage(String message) {
for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) { for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) {
fplayer.sendMessage(message); fplayer.sendMessage(message);

View File

@ -21,8 +21,412 @@ import org.bukkit.configuration.file.YamlConfiguration;
/** /**
* An enum for requesting strings from the language file. * An enum for requesting strings from the language file.
* The contents of this enum file may be subject to frequent changes.
*/ */
public enum TL { public enum TL {
/**
* Translation meta
*/
_AUTHOR("misc"),
_LANGUAGE("English"),
_ENCODING("UTF-8"),
_REQUIRESUNICODE("false"),
_DEFAULT("true"),
/**
* Command translations
*/
COMMAND_ADMIN_NOTMEMBER("%s<i> is not a member in your faction."),
COMMAND_ADMIN_NOTADMIN("<b>You are not the faction admin."),
COMMAND_ADMIN_TARGETSELF("<b>The target player musn't be yourself."),
COMMAND_ADMIN_DEMOTES("<i>You have demoted %s<i> from the position of faction admin."),
COMMAND_ADMIN_DEMOTED("<i>You have been demoted from the position of faction admin by %s<i>."),
COMMAND_ADMIN_PROMOTES("<i>You have promoted %s<i> to the position of faction admin."),
COMMAND_ADMIN_PROMOTED("%s<i> gave %s<i> the leadership of %s<i>."),
COMMAND_AUTOCLAIM_ENABLED("<i>Now auto-claiming land for <h>%s<i>."),
COMMAND_AUTOCLAIM_DISABLED("<i>Auto-claiming of land disabled."),
COMMAND_AUTOCLAIM_REQUIREDRANK("<b>You must be <h>%s<b> to claim land."),
COMMAND_AUTOCLAIM_OTHERFACTION("<b>You can't claim land for <h>%s<b>."),
COMMAND_AUTOHELP_HELPFOR("Help for command \""),
COMMAND_BOOM_PEACEFULONLY("<b>This command is only usable by factions which are specifically designated as peaceful."),
COMMAND_BOOM_TOTOGGLE("to toggle explosions"),
COMMAND_BOOM_FORTOGGLE("for toggling explosions"),
COMMAND_BOOM_ENABLED("%s<i> has %s explosions in your faction's territory."),
COMMAND_BYPASS_ENABLE("<i>You have enabled admin bypass mode. You will be able to build or destroy anywhere."),
COMMAND_BYPASS_ENABLELOG(" has ENABLED admin bypass mode."),
COMMAND_BYPASS_DISABLE("<i>You have disabled admin bypass mode."),
COMMAND_BYPASS_DISABLELOG(" has DISABLED admin bypass mode."),
COMMAND_CHAT_DISABLED("<b>The built in chat chat channels are disabled on this server."),
COMMAND_CHAT_INVALIDMODE("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'"),
COMMAND_CHAT_MODE_PUBLIC("<i>Public chat mode."),
COMMAND_CHAT_MODE_ALLIANCE("<i>Alliance only chat mode."),
COMMAND_CHAT_MODE_FACTION("<i>Faction only chat mode."),
COMMAND_CHATSPY_ENABLE("<i>You have enabled chat spying mode."),
COMMAND_CHATSPY_ENABLELOG(" has ENABLED chat spying mode."),
COMMAND_CHATSPY_DISABLE("<i>You have disabled chat spying mode."),
COMMAND_CHATSPY_DISABLELOG(" has DISABLED chat spying mode."),
COMMAND_CLAIM_INVALIDRADIUS("<b>If you specify a radius, it must be at least 1."),
COMMAND_CLAIM_DENIED("<b>You do not have permission to claim in a radius."),
COMMAND_CONFIG_NOEXIST("<b>No configuration setting \"<h>%s<b>\" exists."),
COMMAND_CONFIG_SET_TRUE("\" option set to true (enabled)."),
COMMAND_CONFIG_SET_FALSE("\" option set to false (disabled)."),
COMMAND_CONFIG_OPTIONSET("\" option set to "),
COMMAND_CONFIG_COLOURSET("\" color option set to \""),
COMMAND_CONFIG_INTREQUIRED("Cannot set \"%s\": An integer (whole number) value required."),
COMMAND_CONFIG_LONGREQUIRED("Cannot set \"%s\": A long integer (whole number) value required."),
COMMAND_CONFIG_DOUBLEREQUIRED("Cannot set \"%s\": A double (numeric) value required."),
COMMAND_CONFIG_FLOATREQUIRED("Cannot set \"%s\": A float (numeric) value required."),
COMMAND_CONFIG_INVALID_COLOUR("Cannot set \"%s\": \"%s\" is not a valid color."),
COMMAND_CONFIG_INVALID_COLLECTION("\"%s\" is not a data collection type which can be modified with this command."),
COMMAND_CONFIG_INVALID_MATERIAL("Cannot change \"%s\" set: \"%s\" is not a valid material."),
COMMAND_CONFIG_INVALID_TYPESET("\"%s\" is not a data type set which can be modified with this command."),
COMMAND_CONFIG_MATERIAL_ADDED("\"%s\" set: Material \"%s\" added."),
COMMAND_CONFIG_MATERIAL_REMOVED("\"%s\" set: Material \"%s\" removed."),
COMMAND_CONFIG_SET_ADDED("\"%s\" set: \"%s\" added."),
COMMAND_CONFIG_SET_REMOVED("\"%s\" set: \"%s\" removed."),
COMMAND_CONFIG_LOG(" (Command was run by %s.)"),
COMMAND_CONFIG_ERROR_SETTING("Error setting configuration setting \"%s\" to \"%s\"."),
COMMAND_CONFIG_ERROR_MATCHING("Configuration setting \"%s\" couldn't be matched, though it should be... please report this error."),
COMMAND_CONFIG_ERROR_TYPE("'%s' is of type '%s', which cannot be modified with this command."),
COMMAND_CONVERT_BACKEND_RUNNING("command.convert.backend.running","Already running that backend."),
COMMAND_CONVERT_BACKEND_INVALID("command.convert.backend.invalid","Invalid backend"),
COMMAND_CREATE_MUSTLEAVE("<b>You must leave your current faction first."),
COMMAND_CREATE_INUSE("<b>That tag is already in use."),
COMMAND_CREATE_TOCREATE("to create a new faction"),
COMMAND_CREATE_FORCREATE("for creating a new faction"),
COMMAND_CREATE_ERROR("<b>There was an internal error while trying to create your faction. Please try again."),
COMMAND_CREATE_CREATED("%s<i> created a new faction %s"),
COMMAND_CREATE_YOUSHOULD("<i>You should now: %s"),
COMMAND_CREATE_CREATED_LOG(" created a new faction: "),
COMMAND_DEINVITE_CANDEINVITE("Players you can deinvite: "),
COMMAND_DEINVITE_CLICKTODEINVITE("Click to revoke invite for "),
COMMAND_DEINVITE_ALREADYMEMBER("%s<i> is already a member of %s"),
COMMAND_DEINVITE_MIGHTWANT("<i>You might want to: %s"),
COMMAND_DEINVITE_REVOKED("%s<i> revoked your invitation to <h>%s<i>."),
COMMAND_DEINVITE_REVOKES("%s<i> revoked %s's<i> invitation."),
COMMAND_DELFWARP_DELETED("<i>Deleted warp <a>%s"),
COMMAND_DELFWARP_INVALID("<i>Couldn't find warp <a>%s"),
COMMAND_DELFWARP_TODELETE("to delete warp"),
COMMAND_DELFWARP_FORDELETE("for deleting warp"),
COMMAND_DESCRIPTION_CHANGES("You have changed the description for <h>%s<i> to:"),
COMMAND_DESCRIPTION_CHANGED("<i>The faction %s<i> changed their description to:"),
COMMAND_DESCRIPTION_TOCHANGE("to change faction description"),
COMMAND_DESCRIPTION_FORCHANGE("for changing faction description"),
COMMAND_DISBAND_IMMUTABLE("<i>You cannot disband the Wilderness, SafeZone, or WarZone."),
COMMAND_DISBAND_MARKEDPERMANENT("<i>This faction is designated as permanent, so you cannot disband it."),
COMMAND_DISBAND_BROADCAST_YOURS("<h>%s<i> disbanded your faction."),
COMMAND_DISBAND_BROADCAST_NOTYOURS("<h>%s<i> disbanded the faction %s."),
COMMAND_DISBAND_HOLDINGS("<i>You have been given the disbanded faction's bank, totaling %s."),
COMMAND_FWARP_CLICKTOWARP("Click to warp!"),
COMMAND_FWARP_COMMANDFORMAT("<i>/f warp <warpname>"),
COMMAND_FWARP_WARPED("<i>Warped to <a>%s"),
COMMAND_FWARP_INVALID("<i>Couldn't find warp <a>%s"),
COMMAND_FWARP_TOWARP("to warp"),
COMMAND_FWARP_FORWARPING("for warping"),
COMMAND_FWARP_WARPS("Warps: "),
COMMAND_HELP_404("<b>This page does not exist"),
COMMAND_HELP_NEXTCREATE("<i>Learn how to create a faction on the next page."),
COMMAND_HELP_INVITATIONS("command.help.invitations","<i>You might want to close it and use invitations:"),
COMMAND_HELP_HOME("<i>And don't forget to set your home:"),
COMMAND_HELP_BANK_1("<i>Your faction has a bank which is used to pay for certain"),
COMMAND_HELP_BANK_2("<i>things, so it will need to have money deposited into it."),
COMMAND_HELP_BANK_3("<i>To learn more, use the money command."),
COMMAND_HELP_PLAYERTITLES("<i>Player titles are just for fun. No rules connected to them."),
COMMAND_HELP_OWNERSHIP_1("<i>Claimed land with ownership set is further protected so"),
COMMAND_HELP_OWNERSHIP_2("<i>that only the owner(s), faction admin, and possibly the"),
COMMAND_HELP_OWNERSHIP_3("<i>faction moderators have full access."),
COMMAND_HELP_RELATIONS_1("<i>Set the relation you WISH to have with another faction."),
COMMAND_HELP_RELATIONS_2("<i>Your default relation with other factions will be neutral."),
COMMAND_HELP_RELATIONS_3("<i>If BOTH factions choose \"ally\" you will be allies."),
COMMAND_HELP_RELATIONS_4("<i>If ONE faction chooses \"enemy\" you will be enemies."),
COMMAND_HELP_RELATIONS_5("<i>You can never hurt members or allies."),
COMMAND_HELP_RELATIONS_6("<i>You can not hurt neutrals in their own territory."),
COMMAND_HELP_RELATIONS_7("<i>You can always hurt enemies and players without faction."),
COMMAND_HELP_RELATIONS_8(""),
COMMAND_HELP_RELATIONS_9("<i>Damage from enemies is reduced in your own territory."),
COMMAND_HELP_RELATIONS_10("<i>When you die you lose power. It is restored over time."),
COMMAND_HELP_RELATIONS_11("<i>The power of a faction is the sum of all member power."),
COMMAND_HELP_RELATIONS_12("<i>The power of a faction determines how much land it can hold."),
COMMAND_HELP_RELATIONS_13("<i>You can claim land from factions with too little power."),
COMMAND_HELP_PERMISSIONS_1("<i>Only faction members can build and destroy in their own"),
COMMAND_HELP_PERMISSIONS_2("<i>territory. Usage of the following items is also restricted:"),
COMMAND_HELP_PERMISSIONS_3("<i>Door, Chest, Furnace, Dispenser, Diode."),
COMMAND_HELP_PERMISSIONS_4(""),
COMMAND_HELP_PERMISSIONS_5("<i>Make sure to put pressure plates in front of doors for your"),
COMMAND_HELP_PERMISSIONS_6("<i>guest visitors. Otherwise they can't get through. You can"),
COMMAND_HELP_PERMISSIONS_7("<i>also use this to create member only areas."),
COMMAND_HELP_PERMISSIONS_8("<i>As dispensers are protected, you can create traps without"),
COMMAND_HELP_PERMISSIONS_9("<i>worrying about those arrows getting stolen."),
COMMAND_HELP_ADMIN_1("<c>/f claim safezone <i>claim land for the Safe Zone"),
COMMAND_HELP_ADMIN_2("<c>/f claim warzone <i>claim land for the War Zone"),
COMMAND_HELP_ADMIN_3("<c>/f autoclaim [safezone|warzone] <i>take a guess"),
COMMAND_HELP_MOAR_1("Finally some commands for the server admins:"),
COMMAND_HELP_MOAR_2("<i>More commands for server admins:"),
COMMAND_HELP_MOAR_3("<i>Even more commands for server admins:"),
COMMAND_HOME_DISABLED("<b>Sorry, Faction homes are disabled on this server."),
COMMAND_HOME_TELEPORTDISABLED("<b>Sorry, the ability to teleport to Faction homes is disabled on this server."),
COMMAND_HOME_NOHOME("<b>Your faction does not have a home. "),
COMMAND_HOME_INENEMY("<b>You cannot teleport to your faction home while in the territory of an enemy faction."),
COMMAND_HOME_WRONGWORLD("<b>You cannot teleport to your faction home while in a different world."),
COMMAND_HOME_ENEMYNEAR("<b>You cannot teleport to your faction home while an enemy is within %s blocks of you."),
COMMAND_HOME_TOTELEPORT("to teleport to your faction home"),
COMMAND_HOME_FORTELEPORT("for teleporting to your faction home"),
COMMAND_INVITE_TOINVITE("to invite someone"),
COMMAND_INVITE_FORINVITE("for inviting someone"),
COMMAND_INVITE_CLICKTOJOIN("Click to join!"),
COMMAND_INVITE_INVITEDYOU(" has invited you to join "),
COMMAND_INVITE_INVITED("%s<i> invited %s<i> to your faction."),
COMMAND_INVITE_ALREADYMEMBER("%s<i> is already a member of %s"),
COMMAND_JOIN_CANNOTFORCE("<b>You do not have permission to move other players into a faction."),
COMMAND_JOIN_SYSTEMFACTION("<b>Players may only join normal factions. This is a system faction."),
COMMAND_JOIN_ALREADYMEMBER("<b>%s %s already a member of %s"),
COMMAND_JOIN_ATLIMIT(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join."),
COMMAND_JOIN_INOTHERFACTION("<b>%s must leave %s current faction first."),
COMMAND_JOIN_NEGATIVEPOWER("<b>%s cannot join a faction with a negative power level."),
COMMAND_JOIN_REQUIRESINVITATION("<i>This faction requires invitation."),
COMMAND_JOIN_ATTEMPTEDJOIN("%s<i> tried to join your faction."),
COMMAND_JOIN_TOJOIN("to join a faction"),
COMMAND_JOIN_FORJOIN("for joining a faction"),
COMMAND_JOIN_SUCCESS("<i>%s successfully joined %s."),
COMMAND_JOIN_MOVED("<i>%s moved you into the faction %s."),
COMMAND_JOIN_JOINED("<i>%s joined your faction."),
COMMAND_JOIN_JOINEDLOG("%s joined the faction %s."),
COMMAND_JOIN_MOVEDLOG("%s moved the player %s into the faction %s."),
COMMAND_KICK_CANDIDATES("Players you can kick: "),
COMMAND_KICK_CLICKTOKICK("Click to kick "),
COMMAND_KICK_SELF("<b>You cannot kick yourself."),
COMMAND_KICK_OFFLINE("Something went wrong with getting the offline player's faction."),
COMMAND_KICK_NOTMEMBER("%s<b> is not a member of %s"),
COMMAND_KICK_INSUFFICIENTRANK("<b>Your rank is too low to kick this player."),
COMMAND_KICK_NEGATIVEPOWER("<b>You cannot kick that member until their power is positive."),
COMMAND_KICK_TOKICK("to kick someone from the faction"),
COMMAND_KICK_FORKICK("for kicking someone from the faction"),
COMMAND_KICK_FACTION("%s<i> kicked %s<i> from the faction! :O"), //message given to faction members
COMMAND_KICK_KICKS("<i>You kicked %s<i> from the faction %s<i>!"), //kicker perspective
COMMAND_KICK_KICKED("%s<i> kicked you from %s<i>! :O"), //kicked player perspective
COMMAND_LIST_FACTIONLIST("Faction List "),
COMMAND_LIST_TOLIST("to list the factions"),
COMMAND_LIST_FORLIST("for listing the factions"),
COMMAND_LIST_ONLINEFACTIONLESS("Online factionless: "),
COMMAND_LOCK_LOCKED("<i>Factions is now locked"),
COMMAND_LOCK_UNLOCKED("<i>Factions in now unlocked"),
COMMAND_MAP_TOSHOW("to show the map"),
COMMAND_MAP_FORSHOW("for showing the map"),
COMMAND_MAP_UPDATE_ENABLED("<i>Map auto update <green>ENABLED."),
COMMAND_MAP_UPDATE_DISABLED("<i>Map auto update <red>DISABLED."),
COMMAND_MOD_CANDIDATES("Players you can promote: "),
COMMAND_MOD_CLICKTOPROMOTE("Click to promote "),
COMMAND_MOD_NOTMEMBER("%s<b> is not a member in your faction."),
COMMAND_MOD_NOTADMIN("<b>You are not the faction admin."),
COMMAND_MOD_SELF("<b>The target player musn't be yourself."),
COMMAND_MOD_TARGETISADMIN("<b>The target player is a faction admin. Demote them first."),
COMMAND_MOD_REVOKES("<i>You have removed moderator status from %s<i>."),
COMMAND_MOD_REVOKED("%s<i> is no longer moderator in your faction."),
COMMAND_MOD_PROMOTES("%s<i> was promoted to moderator in your faction."),
COMMAND_MOD_PROMOTED("<i>You have promoted %s<i> to moderator."),
COMMAND_MODIFYPOWER_ADDED("<i>Added <a>%f <i>power to <a>%s. <i>New total rounded power: <a>%d"),
COMMAND_MONEY_SHORT("faction money commands"),
COMMAND_MONEY_LONG("<i>The faction money commands."),
COMMAND_MONEYBALANCE_SHORT("show faction balance"),
COMMAND_MONEYDEPOSIT_SHORT("deposit money"),
COMMAND_MONEYDEPOSIT_DEPOSITED("%s deposited %s in the faction bank: %s"),
COMMAND_MONEYTRANSFERFF_SHORT("transfer f -> f"),
COMMAND_MONEYTRANSFERFF_TRANSFER("%s transferred %s from the faction \"%s\" to the faction \"%s\""),
COMMAND_MONEYTRANSFERFP_SHORT("transfer f -> p"),
COMMAND_MONEYTRANSFERFP_TRANSFER("%s transferred %s from the faction \"%s\" to the player \"%s\""),
COMMAND_MONEYTRANSFERPF_SHORT("transfer p -> f"),
COMMAND_MONEYTRANSFERPF_TRANSFER("%s transferred %s from the player \"%s\" to the faction \"%s\""),
COMMAND_MONEYWITHDRAW_SHORT("withdraw money"),
COMMAND_MONEYWITHDRAW_WITHDRAW("%s withdrew %s from the faction bank: %s"),
COMMAND_OPEN_TOOPEN("to open or close the faction"),
COMMAND_OPEN_FOROPEN("for opening or closing the faction"),
COMMAND_OPEN_OPEN("open"),
COMMAND_OPEN_CLOSED("closed"),
COMMAND_OPEN_CHANGES("%s<i> changed the faction to <h>%s<i>."),
COMMAND_OPEN_CHANGED("<i>The faction %s<i> is now %s"),
COMMAND_OWNER_DISABLED("<b>Sorry, but owned areas are disabled on this server."),
COMMAND_OWNER_LIMIT("<b>Sorry, but you have reached the server's <h>limit of %d <b>owned areas per faction."),
COMMAND_OWNER_WRONGFACTION("<b>This land is not claimed by your faction, so you can't set ownership of it."),
COMMAND_OWNER_NOTCLAIMED("<b>This land is not claimed by a faction. Ownership is not possible."),
COMMAND_OWNER_NOTMEMBER("%s<i> is not a member of this faction."),
COMMAND_OWNER_CLEARED("<i>You have cleared ownership for this claimed area."),
COMMAND_OWNER_REMOVED("<i>You have removed ownership of this claimed land from %s<i>."),
COMMAND_OWNER_TOSET("to set ownership of claimed land"),
COMMAND_OWNER_FORSET("for setting ownership of claimed land"),
COMMAND_OWNER_ADDED("<i>You have added %s<i> to the owner list for this claimed land."),
COMMAND_OWNERLIST_DISABLED("<b>Sorry, but owned areas are disabled on this server."),//dup->
COMMAND_OWNERLIST_WRONGFACTION("<b>This land is not claimed by your faction."),//eq
COMMAND_OWNERLIST_NOTCLAIMED("<i>This land is not claimed by any faction, thus no owners."),//eq
COMMAND_OWNERLIST_NONE("<i>No owners are set here; everyone in the faction has access."),
COMMAND_OWNERLIST_OWNERS("<i>Current owner(s) of this land: %s"),
COMMAND_POWER_TOSHOW("to show player power info"),
COMMAND_POWER_FORSHOW("for showing player power info"),
COMMAND_POWER_POWER("%s<a> - Power / Maxpower: <i>%d / %d %s"),
COMMAND_POWER_BONUS(" (bonus: "),
COMMAND_POWER_PENALTY(" (penalty: "),
COMMAND_POWERBOOST_HELP_1("<b>You must specify \"p\" or \"player\" to target a player or \"f\" or \"faction\" to target a faction."),
COMMAND_POWERBOOST_HELP_2("<b>ex. /f powerboost p SomePlayer 0.5 -or- /f powerboost f SomeFaction -5"),
COMMAND_POWERBOOST_INVALIDNUM("<b>You must specify a valid numeric value for the power bonus/penalty amount."),
COMMAND_POWERBOOST_PLAYER("Player \"%s\""),
COMMAND_POWERBOOST_FACTION("Faction \"%s\""),
COMMAND_POWERBOOST_BOOST("<i>%s now has a power bonus/penalty of %d to min and max power levels."),
COMMAND_POWERBOOST_BOOSTLOG("%s has set the power bonus/penalty for %s to %d."),
COMMAND_RELOAD_TIME("<i>Reloaded <h>conf.json <i>from disk, took <h>%dms<i>."),
COMMAND_SAFEUNCLAIMALL_SHORT("Unclaim all safezone land"),
COMMAND_SAFEUNCLAIMALL_UNCLAIMED("<i>You unclaimed ALL safe zone land."),
COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG("%s unclaimed all safe zones."),
COMMAND_SAVEALL("<i>Factions saved to disk!"),
COMMAND_SETFWARP_NOTCLAIMED("<i>You can only set warps in your faction territory."),
COMMAND_SETFWARP_LIMIT("<i>Your Faction already has the max amount of warps set <a>(%d)."),
COMMAND_SETFWARP_SET("<i>Set warp <a>%s <i>to your location."),
COMMAND_SETFWARP_TOSET("to set warp"),
COMMAND_SETFWARP_FORSET("for setting warp"),
COMMAND_SETHOME_DISABLED("<b>Sorry, Faction homes are disabled on this server."),
COMMAND_SETHOME_NOTCLAIMED("<b>Sorry, your faction home can only be set inside your own claimed territory."),
COMMAND_SETHOME_TOSET("to set the faction home"),
COMMAND_SETHOME_FORSET("for setting the faction home"),
COMMAND_SETHOME_SET("%s<i> set the home for your faction. You can now use:"),
COMMAND_SETHOME_SETOTHER("<b>You have set the home for the %s<i> faction."),
COMMAND_SHOW_TOSHOW("to show faction information"),
COMMAND_SHOW_FORSHOW("for showing faction information"),
COMMAND_SHOW_DESCRIPTION("<a>Description: <i>%s"),
COMMAND_SHOW_PEACEFUL("This faction is Peaceful"),
COMMAND_SHOW_PERMANENT("<a>This faction is permanent, remaining even with no members."),
COMMAND_SHOW_JOINING("<a>Joining: <i>%s "),
COMMAND_SHOW_INVITATION("invitation is required"),
COMMAND_SHOW_UNINVITED("no invitation is needed"),
COMMAND_SHOW_POWER("<a>Land / Power / Maxpower: <i> %d/%d/%d %s"),
COMMAND_SHOW_BONUS(" (bonus: "),
COMMAND_SHOW_PENALTY(" (penalty: "),
COMMAND_SHOW_DEPRECIATED("(%s depreciated)"), //This is spelled correctly.
COMMAND_SHOW_LANDVALUE("<a>Total land value: <i>%s%s"),
COMMAND_SHOW_BANKCONTAINS("<a>Bank contains: <i>%s"),
COMMAND_SHOW_ALLIES("Allies: "),
COMMAND_SHOW_ENEMIES("Enemies: "),
COMMAND_SHOW_MEMBERSONLINE("Members online: "),
COMMAND_SHOW_MEMBERSOFFLINE("Members offline: "),
COMMAND_SHOWINVITES_PENDING("Players with pending invites: "),
COMMAND_SHOWINVITES_CLICKTOREVOKE("Click to revoke invite for %s"),
COMMAND_STATUS_FORMAT("%s Power: %s Last Seen: %s"),
COMMAND_STATUS_ONLINE("Online"),
COMMAND_STATUS_AGOSUFFIX(" ago."),
COMMAND_TAG_TAKEN("<b>That tag is already taken"),
COMMAND_TAG_TOCHANGE("to change the faction tag"),
COMMAND_TAG_FORCHANGE("for changing the faction tag"),
COMMAND_TAG_FACTION("%s<i> changed your faction tag to %s"),
COMMAND_TAG_CHANGED("<i>The faction %s<i> changed their name to %s."),
COMMAND_TITLE_TOCHANGE("to change a players title"),
COMMAND_TITLE_FORCHANGE("for changing a players title"),
COMMAND_TITLE_CHANGED("%s<i> changed a title: %s"),
COMMAND_UNCLAIM_SAFEZONE_SUCCESS("<i>Safe zone was unclaimed."),
COMMAND_UNCLAIM_SAFEZONE_NOPERM("<b>This is a safe zone. You lack permissions to unclaim."),
COMMAND_UNCLAIM_WARZONE_SUCCESS("<i>War zone was unclaimed."),
COMMAND_UNCLAIM_WARZONE_NOPERM("<b>This is a war zone. You lack permissions to unclaim."),
COMMAND_UNCLAIM_UNCLAIMED("%s<i> unclaimed some of your land."),
COMMAND_UNCLAIM_UNCLAIMS("<i>You unclaimed this land."),
COMMAND_UNCLAIM_LOG("%s unclaimed land at (%s) from the faction: %s"),
COMMAND_UNCLAIM_WRONGFACTION("<b>You don't own this land."),
COMMAND_UNCLAIM_TOUNCLAIM("to unclaim this land"),
COMMAND_UNCLAIM_FORUNCLAIM("for unclaiming this land"),
COMMAND_UNCLAIM_FACTIONUNCLAIMED("%s<i> unclaimed some land."),
COMMAND_UNCLAIMALL_TOUNCLAIM("to unclaim all faction land"),
COMMAND_UNCLAIMALL_FORUNCLAIM("for unclaiming all faction land"),
COMMAND_UNCLAIMALL_UNCLAIMED("%s<i> unclaimed ALL of your faction's land."),
COMMAND_UNCLAIMALL_LOG("%s unclaimed everything for the faction: %s"),
COMMAND_VERSION_VERSION("<i>You are running %s"),
COMMAND_WARUNCLAIMALL_SHORT("unclaim all warzone land"),
COMMAND_WARUNCLAIMALL_SUCCESS("<i>You unclaimed ALL war zone land."),
COMMAND_WARUNCLAIMALL_LOG("%s unclaimed all war zones."),
COMMAND_RELATIONS_ALLTHENOPE("<b>Nope! You can't."),
COMMAND_RELATIONS_MORENOPE("<b>Nope! You can't declare a relation to yourself :)"),
COMMAND_RELATIONS_ALREADYINRELATIONSHIP("<b>You already have that relation wish set with %s."),
COMMAND_RELATIONS_TOMARRY("to change a relation wish"),
COMMAND_RELATIONS_FORMARRY("for changing a relation wish"),
COMMAND_RELATIONS_MUTUAL("<i>Your faction is now %s<i> to %s"),
COMMAND_RELATIONS_PEACEFUL("<i>This will have no effect while your faction is peaceful."),
COMMAND_RELATIONS_PEACEFULOTHER("<i>This will have no effect while their faction is peaceful."),
COMMAND_RELATIONS_PROPOSAL_1("%s<i> wishes to be your %s"),
COMMAND_RELATIONS_PROPOSAL_2("<i>Type <c>/%s %s %s<i> to accept."),
COMMAND_RELATIONS_PROPOSAL_SENT("%s<i> were informed that you wish to be %s"),
/**
* More generic translations, which will apply to more than one class.
*/
GENERIC_SERVERADMIN("generic.serveradmin","A server admin"),
GENERIC_DISABLED("generic.disabled","disabled"),
GENERIC_ENABLED("generic.enabled","enabled"),
GENERIC_CONSOLEONLY("generic.consoleonly","This command cannot be run as a player."),
GENERIC_ASKYOURLEADER("<i> Ask your leader to:"),
GENERIC_YOUSHOULD("<i>You should:"),
GENERIC_YOUMAYWANT("<i>You may want to: "),
/**
* Relations
*/
RELATION_MEMBER("member"),
RELATION_ALLY("ally"),
RELATION_NEUTRAL("neutral"),
RELATION_ENEMY("enemy"),
/**
* Strings lying around in other bits of the plugins
*/
NOPAGES("<i>Sorry. No Pages available."),
INVALIDPAGE("<i>Invalid page. Must be between 1 and %d"),
/**
* The ones here before I started messing around with this
*/
TITLE("title", "&bFactions &0|&r"), TITLE("title", "&bFactions &0|&r"),
WILDERNESS("wilderness", "&2Wilderness"), WILDERNESS("wilderness", "&2Wilderness"),
WILDERNESS_DESCRIPTION("wilderness-description", ""), WILDERNESS_DESCRIPTION("wilderness-description", ""),
@ -48,6 +452,16 @@ public enum TL {
this.def = start; this.def = start;
} }
/**
* Lang enum constructor. Use this when your desired path simply exchanges '_' for '.'
* @param start The default string.
*/
TL(String start) {
this.path = this.name().replace('_', '.');
if(this.path.startsWith(".")) path="root"+path;
this.def = start;
}
/** /**
* Set the {@code YamlConfiguration} to use. * Set the {@code YamlConfiguration} to use.
* *
@ -62,6 +476,10 @@ public enum TL {
return this == TITLE ? ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def)) + " " : ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def)); return this == TITLE ? ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def)) + " " : ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def));
} }
public String format(Object... args){
return String.format(toString(), args);
}
/** /**
* Get the default value of the path. * Get the default value of the path.
* *

View File

@ -148,10 +148,10 @@ public class TextUtil {
ret.add(this.titleize(title + " " + pageHumanBased + "/" + pagecount)); ret.add(this.titleize(title + " " + pageHumanBased + "/" + pagecount));
if (pagecount == 0) { if (pagecount == 0) {
ret.add(this.parseTags("<i>Sorry. No Pages available.")); ret.add(this.parseTags(TL.NOPAGES.toString()));
return ret; return ret;
} else if (pageZeroBased < 0 || pageHumanBased > pagecount) { } else if (pageZeroBased < 0 || pageHumanBased > pagecount) {
ret.add(this.parseTags("<i>Invalid page. Must be between 1 and " + pagecount)); ret.add(this.parseTags(TL.INVALIDPAGE.format(pagecount)));
return ret; return ret;
} }