diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java index 73d62ad0..38de5837 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java @@ -6,6 +6,8 @@ import com.massivecraft.factions.Faction; import com.massivecraft.factions.event.FPlayerJoinEvent; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; public class CmdAdmin extends FCommand { @@ -37,17 +39,17 @@ public class CmdAdmin extends FCommand { Faction targetFaction = fyou.getFaction(); if (targetFaction != myFaction && !permAny) { - msg("%s is not a member in your faction.", fyou.describeTo(fme, true)); + msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(fme, true)); return; } if (fme != null && fme.getRole() != Role.ADMIN && !permAny) { - msg("You are not the faction admin."); + msg(TL.COMMAND_ADMIN_NOTADMIN); return; } if (fyou == fme && !permAny) { - msg("The target player musn't be yourself."); + msg(TL.COMMAND_ADMIN_TARGETSELF); return; } @@ -65,8 +67,8 @@ public class CmdAdmin extends FCommand { // if target player is currently admin, demote and replace him if (fyou == admin) { targetFaction.promoteNewLeader(); - msg("You have demoted %s from the position of faction admin.", fyou.describeTo(fme, true)); - fyou.msg("You have been demoted from the position of faction admin by %s.", senderIsConsole ? "a server admin" : fme.describeTo(fyou, true)); + msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(fme, true)); + fyou.msg(TL.COMMAND_ADMIN_DEMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fyou, true)); return; } @@ -75,11 +77,11 @@ public class CmdAdmin extends FCommand { admin.setRole(Role.MODERATOR); } fyou.setRole(Role.ADMIN); - msg("You have promoted %s to the position of faction admin.", fyou.describeTo(fme, true)); + msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(fme, true)); // Inform all players for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { - fplayer.msg("%s gave %s the leadership of %s.", 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)); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java index 5fe0d2b5..0e90eb1e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.util.TL; public class CmdAutoClaim extends FCommand { @@ -27,15 +28,15 @@ public class CmdAutoClaim extends FCommand { Faction forFaction = this.argAsFaction(0, myFaction); if (forFaction == null || forFaction == fme.getAutoClaimFor()) { fme.setAutoClaimFor(null); - msg("Auto-claiming of land disabled."); + msg(TL.COMMAND_AUTOCLAIM_DISABLED); return; } if (!fme.canClaimForFaction(forFaction)) { if (myFaction == forFaction) { - msg("You must be %s to claim land.", Role.MODERATOR.toString()); + msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.toString()); } else { - msg("You can't claim land for %s.", forFaction.describeTo(fme)); + msg(TL.COMMAND_AUTOCLAIM_OTHERFACTION, forFaction.describeTo(fme)); } return; @@ -43,7 +44,7 @@ public class CmdAutoClaim extends FCommand { fme.setAutoClaimFor(forFaction); - msg("Now auto-claiming land for %s.", forFaction.describeTo(fme)); + msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(fme)); fme.attemptClaim(forFaction, me.getLocation(), true); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java b/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java index ac77e296..77e294c6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.CommandVisibility; import com.massivecraft.factions.zcore.MCommand; +import com.massivecraft.factions.zcore.util.TL; import java.util.ArrayList; @@ -36,6 +37,6 @@ public class CmdAutoHelp extends MCommand

{ } } - 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) + "\"")); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java b/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java index 65c34424..03ef9f92 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdBoom extends FCommand { @@ -24,20 +25,20 @@ public class CmdBoom extends FCommand { @Override public void perform() { if (!myFaction.isPeaceful()) { - fme.msg("This command is only usable by factions which are specially designated as peaceful."); + fme.msg(TL.COMMAND_BOOM_PEACEFULONLY); return; } // 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; } 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 - myFaction.msg("%s has " + enabled + " explosions in your faction's territory.", fme.describeTo(myFaction)); + myFaction.msg(TL.COMMAND_BOOM_ENABLED, fme.describeTo(myFaction),enabled); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java index 1fa470da..2496cccc 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdBypass extends FCommand { @@ -27,11 +28,11 @@ public class CmdBypass extends FCommand { // TODO: Move this to a transient field in the model?? if (fme.isAdminBypassing()) { - fme.msg("You have enabled admin bypass mode. You will be able to build or destroy anywhere."); - P.p.log(fme.getName() + " has ENABLED admin bypass mode."); + fme.msg(TL.COMMAND_BYPASS_ENABLE.toString()); + P.p.log(fme.getName() + TL.COMMAND_BYPASS_ENABLELOG.toString()); } else { - fme.msg("You have disabled admin bypass mode."); - P.p.log(fme.getName() + " DISABLED admin bypass mode."); + fme.msg(TL.COMMAND_BYPASS_DISABLE.toString()); + P.p.log(fme.getName() + TL.COMMAND_BYPASS_DISABLELOG.toString()); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChat.java b/src/main/java/com/massivecraft/factions/cmd/CmdChat.java index 637d21b4..12504212 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChat.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChat.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdChat extends FCommand { @@ -26,7 +27,7 @@ public class CmdChat extends FCommand { @Override public void perform() { if (!Conf.factionOnlyChat) { - msg("The built in chat chat channels are disabled on this server."); + msg(TL.COMMAND_CHAT_DISABLED.toString()); return; } @@ -42,7 +43,7 @@ public class CmdChat extends FCommand { } else if (modeString.startsWith("f")) { modeTarget = ChatMode.FACTION; } else { - msg("Unrecognised chat mode. Please enter either 'a','f' or 'p'"); + msg(TL.COMMAND_CHAT_INVALIDMODE); return; } } @@ -50,11 +51,11 @@ public class CmdChat extends FCommand { fme.setChatMode(modeTarget); if (fme.getChatMode() == ChatMode.PUBLIC) { - msg("Public chat mode."); + msg(TL.COMMAND_CHAT_MODE_PUBLIC); } else if (fme.getChatMode() == ChatMode.ALLIANCE) { - msg("Alliance only chat mode."); + msg(TL.COMMAND_CHAT_MODE_ALLIANCE); } else { - msg("Faction only chat mode."); + msg(TL.COMMAND_CHAT_MODE_FACTION); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java index 12b97523..4776e8bb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdChatSpy extends FCommand { @@ -25,11 +26,11 @@ public class CmdChatSpy extends FCommand { fme.setSpyingChat(this.argAsBool(0, !fme.isSpyingChat())); if (fme.isSpyingChat()) { - fme.msg("You have enabled chat spying mode."); - P.p.log(fme.getName() + " has ENABLED chat spying mode."); + fme.msg(TL.COMMAND_CHATSPY_ENABLE); + P.p.log(fme.getName() + TL.COMMAND_CHATSPY_ENABLELOG.toString()); } else { - fme.msg("You have disabled chat spying mode."); - P.p.log(fme.getName() + " DISABLED chat spying mode."); + fme.msg(TL.COMMAND_CHATSPY_DISABLE); + P.p.log(fme.getName() + TL.COMMAND_CHATSPY_DISABLELOG.toString()); } } } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java index cc53f753..e3c98f9f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.util.SpiralTask; +import com.massivecraft.factions.zcore.util.TL; public class CmdClaim extends FCommand { @@ -33,7 +34,7 @@ public class CmdClaim extends FCommand { int radius = this.argAsInt(1, 1); if (radius < 1) { - msg("If you specify a radius, it must be at least 1."); + msg(TL.COMMAND_CLAIM_INVALIDRADIUS); return; } @@ -43,7 +44,7 @@ public class CmdClaim extends FCommand { } else { // radius claim if (!Permission.CLAIM_RADIUS.has(sender, false)) { - msg("You do not have permission to claim in a radius."); + msg(TL.COMMAND_CLAIM_DENIED); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java index 24050921..c035772e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java @@ -3,6 +3,8 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -52,7 +54,7 @@ public class CmdConfig extends FCommand { String fieldName = properFieldNames.get(field); if (fieldName == null || fieldName.isEmpty()) { - msg("No configuration setting \"%s\" exists.", field); + msg(TL.COMMAND_CONFIG_NOEXIST, field); return; } @@ -72,9 +74,9 @@ public class CmdConfig extends FCommand { target.setBoolean(null, targetValue); if (targetValue) { - success = "\"" + fieldName + "\" option set to true (enabled)."; + success = "\"" + fieldName + TL.COMMAND_CONFIG_SET_TRUE.toString(); } 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 { int intVal = Integer.parseInt(value); target.setInt(null, intVal); - success = "\"" + fieldName + "\" option set to " + intVal + "."; + success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + intVal + "."; } catch (NumberFormatException ex) { - sendMessage("Cannot set \"" + fieldName + "\": integer (whole number) value required."); + sendMessage(TL.COMMAND_CONFIG_INTREQUIRED.format(fieldName)); return; } } @@ -95,9 +97,9 @@ public class CmdConfig extends FCommand { try { long longVal = Long.parseLong(value); target.setLong(null, longVal); - success = "\"" + fieldName + "\" option set to " + longVal + "."; + success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + longVal + "."; } catch (NumberFormatException ex) { - sendMessage("Cannot set \"" + fieldName + "\": long integer (whole number) value required."); + sendMessage(TL.COMMAND_CONFIG_LONGREQUIRED.format(fieldName)); return; } } @@ -107,9 +109,9 @@ public class CmdConfig extends FCommand { try { double doubleVal = Double.parseDouble(value); target.setDouble(null, doubleVal); - success = "\"" + fieldName + "\" option set to " + doubleVal + "."; + success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + doubleVal + "."; } catch (NumberFormatException ex) { - sendMessage("Cannot set \"" + fieldName + "\": double (numeric) value required."); + sendMessage(TL.COMMAND_CONFIG_DOUBLEREQUIRED.format(fieldName)); return; } } @@ -119,9 +121,9 @@ public class CmdConfig extends FCommand { try { float floatVal = Float.parseFloat(value); target.setFloat(null, floatVal); - success = "\"" + fieldName + "\" option set to " + floatVal + "."; + success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + floatVal + "."; } catch (NumberFormatException ex) { - sendMessage("Cannot set \"" + fieldName + "\": float (numeric) value required."); + sendMessage(TL.COMMAND_CONFIG_FLOATREQUIRED.format(fieldName)); return; } } @@ -129,7 +131,7 @@ public class CmdConfig extends FCommand { // String else if (target.getType() == String.class) { target.set(null, value); - success = "\"" + fieldName + "\" option set to \"" + value + "\"."; + success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + value + "\"."; } // ChatColor @@ -141,11 +143,11 @@ public class CmdConfig extends FCommand { } 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; } 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 @@ -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 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; } @@ -168,7 +170,7 @@ public class CmdConfig extends FCommand { } 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; } @@ -178,13 +180,13 @@ public class CmdConfig extends FCommand { if (matSet.contains(newMat)) { matSet.remove(newMat); 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 else { matSet.add(newMat); 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)) { stringSet.remove(value); target.set(null, stringSet); - success = "\"" + fieldName + "\" set: \"" + value + "\" removed."; + success = TL.COMMAND_CONFIG_SET_REMOVED.format(fieldName,value); } // String not present yet, add it else { stringSet.add(value); target.set(null, stringSet); - success = "\"" + fieldName + "\" set: \"" + value + "\" added."; + success = TL.COMMAND_CONFIG_SET_ADDED.format(fieldName,value); } } // Set of unknown type 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; } } // unknown type 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; } } 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; } catch (IllegalAccessException ex) { - sendMessage("Error setting configuration setting \"" + fieldName + "\" to \"" + value + "\"."); + sendMessage(TL.COMMAND_CONFIG_ERROR_SETTING.format(fieldName,value)); return; } if (!success.isEmpty()) { if (sender instanceof Player) { 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 { P.p.log(success); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java b/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java index d98a277b..0b9145f5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java @@ -3,6 +3,8 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf.Backend; import com.massivecraft.factions.zcore.persist.json.FactionsJSON; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.command.ConsoleCommandSender; public class CmdConvert extends FCommand { @@ -16,11 +18,11 @@ public class CmdConvert extends FCommand { @Override public void perform() { 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()); if (nb == Conf.backEnd) { - this.sender.sendMessage("Already running that backend"); + this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_RUNNING.toString()); return; } switch (nb) { @@ -28,7 +30,7 @@ public class CmdConvert extends FCommand { FactionsJSON.convertTo(); break; default: - this.sender.sendMessage("Invalid backend"); + this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_INVALID.toString()); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java index 79c96c9b..5eba0853 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java @@ -6,6 +6,8 @@ import com.massivecraft.factions.event.FactionCreateEvent; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.MiscUtil; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; import java.util.ArrayList; @@ -34,12 +36,12 @@ public class CmdCreate extends FCommand { String tag = this.argAsString(0); if (fme.hasFaction()) { - msg("You must leave your current faction first."); + msg(TL.COMMAND_CREATE_MUSTLEAVE); return; } if (Factions.getInstance().isTagTaken(tag)) { - msg("That tag is already in use."); + msg(TL.COMMAND_CREATE_INUSE); 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 (!canAffordCommand(Conf.econCostCreate, "to create a new faction")) { + if (!canAffordCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) { return; } @@ -62,7 +64,7 @@ public class CmdCreate extends FCommand { } // 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; } @@ -70,7 +72,7 @@ public class CmdCreate extends FCommand { // TODO: Why would this even happen??? Auto increment clash?? if (faction == null) { - msg("There was an internal error while trying to create your faction. Please try again."); + msg(TL.COMMAND_CREATE_ERROR); return; } @@ -87,13 +89,13 @@ public class CmdCreate extends FCommand { fme.setFaction(faction); for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) { - follower.msg("%s 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("You should now: %s", p.cmdBase.cmdDescription.getUseageTemplate()); + msg(TL.COMMAND_CREATE_YOUSHOULD, p.cmdBase.cmdDescription.getUseageTemplate()); 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); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java index 70f588c4..4bf05fa7 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -3,7 +3,10 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import mkremins.fanciful.FancyMessage; + import org.bukkit.ChatColor; public class CmdDeinvite extends FCommand { @@ -29,27 +32,27 @@ public class CmdDeinvite extends FCommand { public void perform() { FPlayer you = this.argAsBestFPlayerMatch(0); 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()) { FPlayer fp = FPlayers.getInstance().getById(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); return; } if (you.getFaction() == myFaction) { - msg("%s is already a member of %s", you.getName(), myFaction.getTag()); - msg("You might want to: %s", p.cmdBase.cmdKick.getUseageTemplate(false)); + msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), myFaction.getTag()); + msg(TL.COMMAND_DEINVITE_MIGHTWANT, p.cmdBase.cmdKick.getUseageTemplate(false)); return; } myFaction.deinvite(you); - you.msg("%s revoked your invitation to %s.", fme.describeTo(you), myFaction.describeTo(you)); + you.msg(TL.COMMAND_DEINVITE_REVOKED, fme.describeTo(you), myFaction.describeTo(you)); - myFaction.msg("%s revoked %s's invitation.", fme.describeTo(myFaction), you.describeTo(myFaction)); + myFaction.msg(TL.COMMAND_DEINVITE_REVOKES, fme.describeTo(myFaction), you.describeTo(myFaction)); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java index a5dc7ef4..a5f4abeb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.P; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdDelFWarp extends FCommand { @@ -27,13 +28,13 @@ public class CmdDelFWarp extends FCommand { return; } myFaction.removeWarp(warp); - fme.msg("Deleted warp %s", warp); + fme.msg(TL.COMMAND_DELFWARP_DELETED, warp); } else { - fme.msg("Couldn't find warp %s", warp); + fme.msg(TL.COMMAND_DELFWARP_INVALID, warp); } } 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()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java b/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java index 65bd8871..ba8b1bd2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TextUtil; public class CmdDescription extends FCommand { @@ -28,21 +29,21 @@ public class CmdDescription extends FCommand { @Override 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 (!payForCommand(Conf.econCostDesc, "to change faction description", "for changing faction description")) { + if (!payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) { 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 if (!Conf.broadcastDescriptionChanges) { - fme.msg("You have changed the description for %s to:", myFaction.describeTo(fme)); + fme.msg(TL.COMMAND_DESCRIPTION_CHANGED, myFaction.describeTo(fme)); fme.sendMessage(myFaction.getDescription()); return; } // Broadcast the description to everyone for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { - fplayer.msg("The faction %s 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 "" or whatever in their description; &k is particularly interesting looking } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java index 010c20a2..61987205 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java @@ -7,6 +7,8 @@ import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.scoreboards.FTeamWrapper; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; @@ -49,11 +51,11 @@ public class CmdDisband extends FCommand { } if (!faction.isNormal()) { - msg("You cannot disband the Wilderness, SafeZone, or WarZone."); + msg(TL.COMMAND_DISBAND_IMMUTABLE.toString()); return; } if (faction.isPermanent()) { - msg("This faction is designated as permanent, so you cannot disband it."); + msg(TL.COMMAND_DISBAND_MARKEDPERMANENT.toString()); return; } @@ -70,14 +72,15 @@ public class CmdDisband extends FCommand { // Inform all players 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) { - fplayer.msg("%s disbanded your faction.", who); + fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, who); } else { - fplayer.msg("%s disbanded the faction %s.", who, faction.getTag(fplayer)); + fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, who, faction.getTag(fplayer)); } } 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()) + "."); } @@ -88,7 +91,8 @@ public class CmdDisband extends FCommand { if (amount > 0.0) { String amountString = Econ.moneyString(amount); - msg("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() + "."); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java index 1868e197..fc9a09fe 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java @@ -5,7 +5,11 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; 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 org.bukkit.ChatColor; import java.util.Map; @@ -27,14 +31,14 @@ public class CmdFWarp extends FCommand { public void perform() { //TODO: check if in combat. 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 warps = myFaction.getWarps(); 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); } else if (args.size() > 1) { - fme.msg("/f warp "); + fme.msg(TL.COMMAND_FWARP_COMMANDFORMAT); } else { String warpName = argAsString(0); if (myFaction.isWarp(argAsString(0))) { @@ -42,14 +46,14 @@ public class CmdFWarp extends FCommand { return; } fme.getPlayer().teleport(myFaction.getWarp(warpName).getLocation()); - fme.msg("Warped to %s", warpName); + fme.msg(TL.COMMAND_FWARP_WARPED, warpName); } else { - fme.msg("Couldn't find warp %s", warpName); + fme.msg(TL.COMMAND_FWARP_INVALID, warpName); } } } 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()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java b/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java index c305e770..15acc337 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.P; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; import java.util.ArrayList; @@ -41,7 +42,7 @@ public class CmdHelp extends FCommand { page -= 1; if (page < 0 || page >= helpPages.size()) { - msg("This page does not exist"); + msg(TL.COMMAND_HELP_404.toString()); return; } sendMessage(helpPages.get(page)); @@ -66,27 +67,27 @@ public class CmdHelp extends FCommand { pageLines.add(p.cmdBase.cmdLeave.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdChat.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdHome.getUseageTemplate(true)); - pageLines.add(p.txt.parse("Learn how to create a faction on the next page.")); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_NEXTCREATE.toString())); helpPages.add(pageLines); pageLines = new ArrayList(); pageLines.add(p.cmdBase.cmdCreate.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdDescription.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdTag.getUseageTemplate(true)); - pageLines.add(p.txt.parse("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.cmdInvite.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdDeinvite.getUseageTemplate(true)); - pageLines.add(p.txt.parse("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)); helpPages.add(pageLines); if (Econ.isSetup() && Conf.econEnabled && Conf.bankEnabled) { pageLines = new ArrayList(); pageLines.add(""); - pageLines.add(p.txt.parse("Your faction has a bank which is used to pay for certain")); - pageLines.add(p.txt.parse("things, so it will need to have money deposited into it.")); - pageLines.add(p.txt.parse("To learn more, use the money command.")); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_1.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_2.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_3.toString())); pageLines.add(""); pageLines.add(p.cmdBase.cmdMoney.getUseageTemplate(true)); pageLines.add(""); @@ -107,7 +108,7 @@ public class CmdHelp extends FCommand { pageLines.add(p.cmdBase.cmdSB.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdSeeChunk.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdStatus.getUseageTemplate(true)); - pageLines.add(p.txt.parse("Player titles are just for fun. No rules connected to them.")); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PLAYERTITLES.toString())); helpPages.add(pageLines); pageLines = new ArrayList(); @@ -115,9 +116,9 @@ public class CmdHelp extends FCommand { pageLines.add(p.cmdBase.cmdBoom.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdOwner.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdOwnerList.getUseageTemplate(true)); - pageLines.add(p.txt.parse("Claimed land with ownership set is further protected so")); - pageLines.add(p.txt.parse("that only the owner(s), faction admin, and possibly the")); - pageLines.add(p.txt.parse("faction moderators have full access.")); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_1.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_2.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_3.toString())); helpPages.add(pageLines); pageLines = new ArrayList(); @@ -126,50 +127,51 @@ public class CmdHelp extends FCommand { pageLines.add(p.cmdBase.cmdRelationAlly.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdRelationNeutral.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdRelationEnemy.getUseageTemplate(true)); - pageLines.add(p.txt.parse("Set the relation you WISH to have with another faction.")); - pageLines.add(p.txt.parse("Your default relation with other factions will be neutral.")); - pageLines.add(p.txt.parse("If BOTH factions choose \"ally\" you will be allies.")); - pageLines.add(p.txt.parse("If ONE faction chooses \"enemy\" you will be enemies.")); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_1.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_2.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_3.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_4.toString())); helpPages.add(pageLines); pageLines = new ArrayList(); - pageLines.add(p.txt.parse("You can never hurt members or allies.")); - pageLines.add(p.txt.parse("You can not hurt neutrals in their own territory.")); - pageLines.add(p.txt.parse("You can always hurt enemies and players without faction.")); - pageLines.add(""); - pageLines.add(p.txt.parse("Damage from enemies is reduced in your own territory.")); - pageLines.add(p.txt.parse("When you die you lose power. It is restored over time.")); - pageLines.add(p.txt.parse("The power of a faction is the sum of all member power.")); - pageLines.add(p.txt.parse("The power of a faction determines how much land it can hold.")); - pageLines.add(p.txt.parse("You can claim land from factions with too little power.")); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_5.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_6.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_7.toString())); + pageLines.add(TL.COMMAND_HELP_RELATIONS_8.toString()); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_9.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_10.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_11.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_12.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_13.toString())); helpPages.add(pageLines); pageLines = new ArrayList(); - pageLines.add(p.txt.parse("Only faction members can build and destroy in their own")); - pageLines.add(p.txt.parse("territory. Usage of the following items is also restricted:")); - pageLines.add(p.txt.parse("Door, Chest, Furnace, Dispenser, Diode.")); - pageLines.add(""); - pageLines.add(p.txt.parse("Make sure to put pressure plates in front of doors for your")); - pageLines.add(p.txt.parse("guest visitors. Otherwise they can't get through. You can")); - pageLines.add(p.txt.parse("also use this to create member only areas.")); - pageLines.add(p.txt.parse("As dispensers are protected, you can create traps without")); - pageLines.add(p.txt.parse("worrying about those arrows getting stolen.")); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_1.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_2.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_3.toString())); + pageLines.add(TL.COMMAND_HELP_PERMISSIONS_4.toString()); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_5.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_6.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_7.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_8.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_9.toString())); helpPages.add(pageLines); pageLines = new ArrayList(); - 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.txt.parse("/f claim safezone claim land for the Safe Zone")); - pageLines.add(p.txt.parse("/f claim warzone claim land for the War Zone")); - pageLines.add(p.txt.parse("/f autoclaim [safezone|warzone] take a guess")); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_1.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_2.toString())); + pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_3.toString())); pageLines.add(p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdWarunclaimall.getUseageTemplate(true)); + //TODO:TL pageLines.add(p.txt.parse("Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("") + " works on safe/war zones as well.")); pageLines.add(p.cmdBase.cmdPeaceful.getUseageTemplate(true)); helpPages.add(pageLines); pageLines = new ArrayList(); - pageLines.add(p.txt.parse("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.cmdPermanent.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdPermanentPower.getUseageTemplate(true)); @@ -178,7 +180,7 @@ public class CmdHelp extends FCommand { helpPages.add(pageLines); pageLines = new ArrayList(); - pageLines.add(p.txt.parse("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.cmdReload.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdSaveAll.getUseageTemplate(true)); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java index 59b0c911..20d5388f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java @@ -6,6 +6,8 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.util.SmokeUtil; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; @@ -36,28 +38,28 @@ public class CmdHome extends FCommand { public void perform() { // TODO: Hide this command on help also. if (!Conf.homesEnabled) { - fme.msg("Sorry, Faction homes are disabled on this server."); + fme.msg(TL.COMMAND_HOME_DISABLED); return; } if (!Conf.homesTeleportCommandEnabled) { - fme.msg("Sorry, the ability to teleport to Faction homes is disabled on this server."); + fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED); return; } if (!myFaction.hasHome()) { - fme.msg("Your faction does not have a home. " + (fme.getRole().value < Role.MODERATOR.value ? " Ask your leader to:" : "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()); return; } if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) { - fme.msg("You cannot teleport to your faction home while in the territory of an enemy faction."); + fme.msg(TL.COMMAND_HOME_INENEMY); return; } if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) { - fme.msg("You cannot teleport to your faction home while in a different world."); + fme.msg(TL.COMMAND_HOME_WRONGWORLD); return; } @@ -94,7 +96,7 @@ public class CmdHome extends FCommand { continue; } - fme.msg("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; } } @@ -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 (!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; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java index 06b2b58c..f317fa23 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java @@ -3,7 +3,10 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import mkremins.fanciful.FancyMessage; + import org.bukkit.ChatColor; public class CmdInvite extends FCommand { @@ -33,13 +36,13 @@ public class CmdInvite extends FCommand { } if (you.getFaction() == myFaction) { - msg("%s is already a member of %s", you.getName(), myFaction.getTag()); - msg("You might want to: " + p.cmdBase.cmdKick.getUseageTemplate(false)); + msg(TL.COMMAND_INVITE_ALREADYMEMBER, you.getName(), myFaction.getTag()); + msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdKick.getUseageTemplate(false)); return; } // 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; } @@ -49,12 +52,12 @@ public class CmdInvite extends FCommand { } // 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()); //you.msg("%s invited you to %s", fme.describeTo(you, true), myFaction.describeTo(you)); - myFaction.msg("%s invited %s to your faction.", fme.describeTo(myFaction, true), you.describeTo(myFaction)); + myFaction.msg(TL.COMMAND_INVITE_INVITED, fme.describeTo(myFaction, true), you.describeTo(myFaction)); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java index b86574f2..5f707135 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java @@ -3,6 +3,8 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.*; import com.massivecraft.factions.event.FPlayerJoinEvent; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; public class CmdJoin extends FCommand { @@ -34,45 +36,47 @@ public class CmdJoin extends FCommand { boolean samePlayer = fplayer == fme; if (!samePlayer && !Permission.JOIN_OTHERS.has(sender, false)) { - msg("You do not have permission to move other players into a faction."); + msg(TL.COMMAND_JOIN_CANNOTFORCE); return; } if (!faction.isNormal()) { - msg("Players may only join normal factions. This is a system faction."); + msg(TL.COMMAND_JOIN_SYSTEMFACTION); return; } if (faction == fplayer.getFaction()) { - msg("%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; } if (Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= Conf.factionMemberLimit) { - msg(" ! 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; } if (fplayer.hasFaction()) { - msg("%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; } if (!Conf.canLeaveWithNegativePower && fplayer.getPower() < 0) { - msg("%s cannot join a faction with a negative power level.", fplayer.describeTo(fme, true)); + msg(TL.COMMAND_JOIN_NEGATIVEPOWER, fplayer.describeTo(fme, true)); return; } if (!(faction.getOpen() || faction.isInvited(fplayer) || fme.isAdminBypassing() || Permission.JOIN_ANY.has(sender, false))) { - msg("This faction requires invitation."); + msg(TL.COMMAND_JOIN_REQUIRESINVITATION); if (samePlayer) { - faction.msg("%s tried to join your faction.", fplayer.describeTo(faction, true)); + faction.msg(TL.COMMAND_JOIN_ATTEMPTEDJOIN, fplayer.describeTo(faction, true)); } 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 (samePlayer && !canAffordCommand(Conf.econCostJoin, "to join a faction")) { + if (samePlayer && !canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) { return; } @@ -84,16 +88,16 @@ public class CmdJoin extends FCommand { } // 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; } - fme.msg("%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) { - fplayer.msg("%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("%s joined your faction.", fplayer.describeTo(faction, true)); + faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true)); fplayer.resetFactionData(); fplayer.setFaction(faction); @@ -101,9 +105,9 @@ public class CmdJoin extends FCommand { if (Conf.logFactionJoin) { 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 { - 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()); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java index 74d3053d..54934454 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java @@ -34,15 +34,15 @@ public class CmdKick extends FCommand { public void perform() { FPlayer toKick = this.argAsBestFPlayerMatch(0); 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)) { 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) { for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) { 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) { - msg("You cannot kick yourself."); - msg("You might want to: %s", p.cmdBase.cmdLeave.getUseageTemplate(false)); + msg(TL.COMMAND_KICK_SELF); + msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdLeave.getUseageTemplate(false)); return; } @@ -60,30 +60,30 @@ public class CmdKick extends FCommand { // The PlayerEntityCollection only holds online players, this was a specific issue that kept happening. 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; } // players with admin-level "disband" permission can bypass these requirements if (!Permission.KICK_ANY.has(sender)) { if (toKickFaction != myFaction) { - msg("%s 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; } if (toKick.getRole().value >= fme.getRole().value) { - msg("Your rank is too low to kick this player."); + msg(TL.COMMAND_KICK_INSUFFICIENTRANK); return; } if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) { - msg("You cannot kick that member until their power is positive."); + msg(TL.COMMAND_KICK_NEGATIVEPOWER); 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 (!canAffordCommand(Conf.econCostKick, "to kick someone from the faction")) { + if (!canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) { return; } @@ -95,17 +95,18 @@ public class CmdKick extends FCommand { } // 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; } - toKickFaction.msg("%s kicked %s from the faction! :O", fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true)); - toKick.msg("%s kicked you from %s! :O", fme.describeTo(toKick, true), toKickFaction.describeTo(toKick)); + toKickFaction.msg(TL.COMMAND_KICK_FACTION, fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true)); + toKick.msg(TL.COMMAND_KICK_KICKED, fme.describeTo(toKick, true), toKickFaction.describeTo(toKick)); if (toKickFaction != myFaction) { - fme.msg("You kicked %s from the faction %s!", toKick.describeTo(fme), toKickFaction.describeTo(fme)); + fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme)); } if (Conf.logFactionKick) { + //TODO:TL P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag()); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdList.java b/src/main/java/com/massivecraft/factions/cmd/CmdList.java index 82f2f46c..f355301d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdList.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdList.java @@ -4,7 +4,10 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import mkremins.fanciful.FancyMessage; + import org.bukkit.ChatColor; import java.util.ArrayList; @@ -34,7 +37,7 @@ public class CmdList extends FCommand { @Override 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 (!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; } @@ -91,12 +94,12 @@ public class CmdList extends FCommand { 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)) { if (faction.isNone()) { 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); continue; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdLock.java b/src/main/java/com/massivecraft/factions/cmd/CmdLock.java index b015e823..ceae6be9 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdLock.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdLock.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdLock extends FCommand { @@ -30,12 +31,7 @@ public class CmdLock extends FCommand { @Override public void perform() { p.setLocked(this.argAsBool(0, !p.getLocked())); - - if (p.getLocked()) { - msg("Factions is now locked"); - } else { - msg("Factions in now unlocked"); - } + msg(p.getLocked()?TL.COMMAND_LOCK_LOCKED:TL.COMMAND_LOCK_UNLOCKED); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMap.java b/src/main/java/com/massivecraft/factions/cmd/CmdMap.java index afb9c37f..7f927b3d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMap.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMap.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdMap extends FCommand { @@ -36,18 +37,18 @@ public class CmdMap extends FCommand { } fme.setMapAutoUpdating(true); - msg("Map auto update ENABLED."); + msg(TL.COMMAND_MAP_UPDATE_ENABLED); // And show the map once showMap(); } else { // Turn off fme.setMapAutoUpdating(false); - msg("Map auto update DISABLED."); + msg(TL.COMMAND_MAP_UPDATE_DISABLED); } } else { // 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; } @@ -55,7 +56,7 @@ public class CmdMap extends FCommand { } } - public void showMap() { + public void showMap() { sendMessage(Board.getInstance().getMap(myFaction, new FLocation(fme), fme.getPlayer().getLocation().getYaw())); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMod.java b/src/main/java/com/massivecraft/factions/cmd/CmdMod.java index d12fda1d..32d32d14 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMod.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMod.java @@ -4,7 +4,10 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.util.TL; + import mkremins.fanciful.FancyMessage; + import org.bukkit.ChatColor; public class CmdMod extends FCommand { @@ -29,10 +32,10 @@ public class CmdMod extends FCommand { public void perform() { FPlayer you = this.argAsBestFPlayerMatch(0); 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)) { 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); @@ -42,35 +45,35 @@ public class CmdMod extends FCommand { Faction targetFaction = you.getFaction(); if (targetFaction != myFaction && !permAny) { - msg("%s is not a member in your faction.", you.describeTo(fme, true)); + msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true)); return; } if (fme != null && fme.getRole() != Role.ADMIN && !permAny) { - msg("You are not the faction admin."); + msg(TL.COMMAND_MOD_NOTADMIN); return; } if (you == fme && !permAny) { - msg("The target player musn't be yourself."); + msg(TL.COMMAND_MOD_SELF); return; } if (you.getRole() == Role.ADMIN) { - msg("The target player is a faction admin. Demote them first."); + msg(TL.COMMAND_MOD_TARGETISADMIN); return; } if (you.getRole() == Role.MODERATOR) { // Revoke you.setRole(Role.NORMAL); - targetFaction.msg("%s is no longer moderator in your faction.", you.describeTo(targetFaction, true)); - msg("You have removed moderator status from %s.", you.describeTo(fme, true)); + targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true)); + msg(TL.COMMAND_MOD_REVOKES, you.describeTo(fme, true)); } else { // Give you.setRole(Role.MODERATOR); - targetFaction.msg("%s was promoted to moderator in your faction.", you.describeTo(targetFaction, true)); - msg("You have promoted %s to moderator.", you.describeTo(fme, true)); + targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true)); + msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(fme, true)); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdModifyPower.java b/src/main/java/com/massivecraft/factions/cmd/CmdModifyPower.java index 09c849d9..8f7e8767 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdModifyPower.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdModifyPower.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdModifyPower extends FCommand { @@ -38,6 +39,6 @@ public class CmdModifyPower extends FCommand { player.alterPower(number); int newPower = player.getPowerRounded(); // int so we don't have super long doubles. - msg("Added %f power to %s. New total rounded power: %d", number, player.getName(), newPower); + msg(TL.COMMAND_MODIFYPOWER_ADDED, number, player.getName(), newPower); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java index ff01663f..b9b2303f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.P; +import com.massivecraft.factions.zcore.util.TL; public class CmdMoney extends FCommand { @@ -25,8 +26,8 @@ public class CmdMoney extends FCommand { senderMustBeModerator = false; senderMustBeAdmin = false; - this.setHelpShort("faction money commands"); - this.helpLong.add(p.txt.parseTags("The faction money commands.")); + this.setHelpShort(TL.COMMAND_MONEY_SHORT.toString()); + this.helpLong.add(p.txt.parseTags(TL.COMMAND_MONEY_LONG.toString())); this.addSubCommand(this.cmdMoneyBalance); this.addSubCommand(this.cmdMoneyDeposit); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java index a3f5b4d2..6b826c37 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Faction; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdMoneyBalance extends FCommand { @@ -15,7 +16,7 @@ public class CmdMoneyBalance extends FCommand { this.optionalArgs.put("faction", "yours"); this.permission = Permission.MONEY_BALANCE.node; - this.setHelpShort("show faction balance"); + this.setHelpShort(TL.COMMAND_MONEYBALANCE_SHORT.toString()); senderMustBePlayer = false; senderMustBeMember = false; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java index 725b7f69..5ca90212 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java @@ -5,6 +5,8 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.ChatColor; @@ -19,7 +21,7 @@ public class CmdMoneyDeposit extends FCommand { this.optionalArgs.put("faction", "yours"); this.permission = Permission.MONEY_DEPOSIT.node; - this.setHelpShort("deposit money"); + this.setHelpShort(TL.COMMAND_MONEYDEPOSIT_SHORT.toString()); senderMustBePlayer = true; senderMustBeMember = false; @@ -37,7 +39,7 @@ public class CmdMoneyDeposit extends FCommand { boolean success = Econ.transferMoney(fme, fme, faction, amount); 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)))); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java index 8ff5b046..d9f76976 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java @@ -5,6 +5,8 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.ChatColor; @@ -20,7 +22,7 @@ public class CmdMoneyTransferFf extends FCommand { //this.optionalArgs.put("", ""); this.permission = Permission.MONEY_F2F.node; - this.setHelpShort("transfer f -> f"); + this.setHelpShort(TL.COMMAND_MONEYTRANSFERFF_SHORT.toString()); senderMustBePlayer = false; senderMustBeMember = false; @@ -43,7 +45,7 @@ public class CmdMoneyTransferFf extends FCommand { boolean success = Econ.transferMoney(fme, from, to, amount); 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)))); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java index 66bfb540..9a8f0f50 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java @@ -5,6 +5,8 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.ChatColor; @@ -20,7 +22,7 @@ public class CmdMoneyTransferFp extends FCommand { //this.optionalArgs.put("", ""); this.permission = Permission.MONEY_F2P.node; - this.setHelpShort("transfer f -> p"); + this.setHelpShort(TL.COMMAND_MONEYTRANSFERFP_SHORT.toString()); senderMustBePlayer = false; senderMustBeMember = false; @@ -43,7 +45,7 @@ public class CmdMoneyTransferFp extends FCommand { boolean success = Econ.transferMoney(fme, from, to, amount); 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)))); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java index fc9e856a..1190d3b2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java @@ -5,6 +5,8 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.ChatColor; @@ -20,7 +22,7 @@ public class CmdMoneyTransferPf extends FCommand { //this.optionalArgs.put("", ""); this.permission = Permission.MONEY_P2F.node; - this.setHelpShort("transfer p -> f"); + this.setHelpShort(TL.COMMAND_MONEYTRANSFERPF_SHORT.toString()); senderMustBePlayer = false; senderMustBeMember = false; @@ -43,7 +45,7 @@ public class CmdMoneyTransferPf extends FCommand { boolean success = Econ.transferMoney(fme, from, to, amount); 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)))); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java index f1816a27..1433dccb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java @@ -5,6 +5,8 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.ChatColor; @@ -18,7 +20,7 @@ public class CmdMoneyWithdraw extends FCommand { this.optionalArgs.put("faction", "yours"); this.permission = Permission.MONEY_WITHDRAW.node; - this.setHelpShort("withdraw money"); + this.setHelpShort(TL.COMMAND_MONEYWITHDRAW_SHORT.toString()); senderMustBePlayer = true; senderMustBeMember = false; @@ -36,7 +38,7 @@ public class CmdMoneyWithdraw extends FCommand { boolean success = Econ.transferMoney(fme, faction, fme, amount); 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)))); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java index 4054e83a..c8b41083 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdOpen extends FCommand { @@ -26,21 +27,21 @@ public class CmdOpen extends FCommand { @Override 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 (!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; } 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 for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { if (fplayer.getFactionId().equals(myFaction.getId())) { - fplayer.msg("%s changed the faction to %s.", fme.getName(), open); + fplayer.msg(TL.COMMAND_OPEN_CHANGES, fme.getName(), open); continue; } - fplayer.msg("The faction %s is now %s", myFaction.getTag(fplayer.getFaction()), open); + fplayer.msg(TL.COMMAND_OPEN_CHANGED, myFaction.getTag(fplayer.getFaction()), open); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java b/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java index 93da81bd..b3997bbe 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.*; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.util.TL; public class CmdOwner extends FCommand { @@ -34,12 +35,12 @@ public class CmdOwner extends FCommand { } if (!Conf.ownedAreasEnabled) { - fme.msg("Sorry, but owned areas are disabled on this server."); + fme.msg(TL.COMMAND_OWNER_DISABLED); return; } if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) { - fme.msg("Sorry, but you have reached the server's limit of %d owned areas per faction.", Conf.ownedAreasLimitPerFaction); + fme.msg(TL.COMMAND_OWNER_LIMIT, Conf.ownedAreasLimitPerFaction); return; } @@ -51,15 +52,16 @@ public class CmdOwner extends FCommand { Faction factionHere = Board.getInstance().getFactionAt(flocation); if (factionHere != myFaction) { - if (!hasBypass) { - fme.msg("This land is not claimed by your faction, so you can't set ownership of it."); + if (!factionHere.isNormal()) { + fme.msg(TL.COMMAND_OWNER_NOTCLAIMED); + return; + } + + if (!hasBypass) { + fme.msg(TL.COMMAND_OWNER_WRONGFACTION); return; } - if (!factionHere.isNormal()) { - fme.msg("This land is not claimed by a faction. Ownership is not possible."); - return; - } } FPlayer target = this.argAsBestFPlayerMatch(0, fme); @@ -70,30 +72,30 @@ public class CmdOwner extends FCommand { String playerName = target.getName(); if (target.getFaction() != myFaction) { - fme.msg("%s is not a member of this faction.", playerName); + fme.msg(TL.COMMAND_OWNER_NOTMEMBER, playerName); return; } // if no player name was passed, and this claim does already have owners set, clear them if (args.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation)) { myFaction.clearClaimOwnership(flocation); - fme.msg("You have cleared ownership for this claimed area."); + fme.msg(TL.COMMAND_OWNER_CLEARED); return; } if (myFaction.isPlayerInOwnerList(target, flocation)) { myFaction.removePlayerAsOwner(target, flocation); - fme.msg("You have removed ownership of this claimed land from %s.", playerName); + fme.msg(TL.COMMAND_OWNER_REMOVED, playerName); return; } // 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; } myFaction.setPlayerAsOwner(target, flocation); - fme.msg("You have added %s to the owner list for this claimed land.", playerName); + fme.msg(TL.COMMAND_OWNER_ADDED, playerName); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java b/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java index b5c88fca..c69183a5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdOwnerList extends FCommand { @@ -33,7 +34,7 @@ public class CmdOwnerList extends FCommand { } if (!Conf.ownedAreasEnabled) { - fme.msg("Owned areas are disabled on this server."); + fme.msg(TL.COMMAND_OWNERLIST_DISABLED); return; } @@ -41,13 +42,13 @@ public class CmdOwnerList extends FCommand { if (Board.getInstance().getFactionAt(flocation) != myFaction) { if (!hasBypass) { - fme.msg("This land is not claimed by your faction."); + fme.msg(TL.COMMAND_OWNERLIST_WRONGFACTION); return; } - + //TODO: This code won't ever be called. myFaction = Board.getInstance().getFactionAt(flocation); if (!myFaction.isNormal()) { - fme.msg("This land is not claimed by any faction, thus no owners."); + fme.msg(TL.COMMAND_OWNERLIST_NOTCLAIMED); return; } } @@ -55,10 +56,10 @@ public class CmdOwnerList extends FCommand { String owners = myFaction.getOwnerListString(flocation); if (owners == null || owners.isEmpty()) { - fme.msg("No owners are set here; everyone in the faction has access."); + fme.msg(TL.COMMAND_OWNERLIST_NONE); return; } - fme.msg("Current owner(s) of this land: %s", owners); + fme.msg(TL.COMMAND_OWNERLIST_OWNERS, owners); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPeaceful.java b/src/main/java/com/massivecraft/factions/cmd/CmdPeaceful.java index 9a8a538b..f82fafd6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPeaceful.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPeaceful.java @@ -23,6 +23,7 @@ public class CmdPeaceful extends FCommand { senderMustBeAdmin = false; } + //TODO: TL @Override public void perform() { Faction faction = this.argAsFaction(0); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java index a61e0dd6..513b8aa8 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java @@ -25,6 +25,7 @@ public class CmdPermanent extends FCommand { senderMustBeAdmin = false; } + //TODO: TL @Override public void perform() { Faction faction = this.argAsFaction(0); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPermanentPower.java b/src/main/java/com/massivecraft/factions/cmd/CmdPermanentPower.java index 232c56e1..26287387 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPermanentPower.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPermanentPower.java @@ -21,6 +21,7 @@ public class CmdPermanentPower extends FCommand { senderMustBeAdmin = false; } + //TODO: TL @Override public void perform() { Faction targetFaction = this.argAsFaction(0); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPower.java b/src/main/java/com/massivecraft/factions/cmd/CmdPower.java index bdfd255e..71eb41b0 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPower.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPower.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; 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 (!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; } double powerBoost = target.getPowerBoost(); - String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")"; - msg("%s - Power / Maxpower: %d / %d %s", target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost); + String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_POWER_BONUS.toString() : TL.COMMAND_POWER_PENALTY.toString()) + powerBoost + ")"; + msg(TL.COMMAND_POWER_POWER, target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java index 19c8211c..cc72db02 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdPowerBoost extends FCommand { @@ -31,14 +32,14 @@ public class CmdPowerBoost extends FCommand { if (type.equals("f") || type.equals("faction")) { doPlayer = false; } else if (!type.equals("p") && !type.equals("player")) { - msg("You must specify \"p\" or \"player\" to target a player or \"f\" or \"faction\" to target a faction."); - msg("ex. /f powerboost p SomePlayer 0.5 -or- /f powerboost f SomeFaction -5"); + msg(TL.COMMAND_POWERBOOST_HELP_1); + msg(TL.COMMAND_POWERBOOST_HELP_2); return; } Double targetPower = this.argAsDouble(2); if (targetPower == null) { - msg("You must specify a valid numeric value for the power bonus/penalty amount."); + msg(TL.COMMAND_POWERBOOST_INVALIDNUM); return; } @@ -50,19 +51,19 @@ public class CmdPowerBoost extends FCommand { return; } targetPlayer.setPowerBoost(targetPower); - target = "Player \"" + targetPlayer.getName() + "\""; + target = TL.COMMAND_POWERBOOST_PLAYER.format(targetPlayer.getName()); } else { Faction targetFaction = this.argAsFaction(1); if (targetFaction == null) { return; } targetFaction.setPowerBoost(targetPower); - target = "Faction \"" + targetFaction.getTag() + "\""; + target = TL.COMMAND_POWERBOOST_FACTION.format(targetFaction.getTag()); } - msg("" + target + " now has a power bonus/penalty of " + targetPower + " to min and max power levels."); + msg(TL.COMMAND_POWERBOOST_BOOST,target,targetPower); 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); } } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java index e9943475..ba20833c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdReload extends FCommand { @@ -30,6 +31,6 @@ public class CmdReload extends FCommand { long timeReload = (System.currentTimeMillis() - timeInitStart); - msg("Reloaded conf.json from disk, took %dms.", timeReload); + msg(TL.COMMAND_RELOAD_TIME, timeReload); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java b/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java index 32624344..069d5436 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.Factions; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdSafeunclaimall extends FCommand { @@ -23,16 +24,16 @@ public class CmdSafeunclaimall extends FCommand { senderMustBeModerator = false; senderMustBeAdmin = false; - this.setHelpShort("Unclaim all safezone land"); + this.setHelpShort(TL.COMMAND_SAFEUNCLAIMALL_SHORT.toString()); } @Override public void perform() { Board.getInstance().unclaimAll(Factions.getInstance().getSafeZone().getId()); - msg("You unclaimed ALL safe zone land."); + msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED); if (Conf.logLandUnclaims) { - P.p.log(fme.getName() + " unclaimed all safe zones."); + P.p.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSaveAll.java b/src/main/java/com/massivecraft/factions/cmd/CmdSaveAll.java index b5fe6026..66e523ed 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSaveAll.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSaveAll.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdSaveAll extends FCommand { @@ -31,7 +32,7 @@ public class CmdSaveAll extends FCommand { Factions.getInstance().forceSave(); Board.getInstance().forceSave(); Conf.save(); - msg("Factions saved to disk!"); + msg(TL.COMMAND_SAVEALL); } } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java index 13921eec..a8a238d8 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.util.LazyLocation; +import com.massivecraft.factions.zcore.util.TL; public class CmdSetFWarp extends FCommand { @@ -23,13 +24,13 @@ public class CmdSetFWarp extends FCommand { @Override public void perform() { if (!(fme.getRelationToLocation() == Relation.MEMBER)) { - fme.msg("You can only set warps in your faction territory."); + fme.msg(TL.COMMAND_SETFWARP_NOTCLAIMED); return; } int maxWarps = P.p.getConfig().getInt("max-warps", 5); if (maxWarps <= myFaction.getWarps().size()) { - fme.msg("Your Faction already has the max amount of warps set (%d).", maxWarps); + fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps); return; } @@ -40,10 +41,10 @@ public class CmdSetFWarp extends FCommand { String warp = argAsString(0); LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation()); myFaction.setWarp(warp, loc); - fme.msg("Set warp %s to your location.", warp); + fme.msg(TL.COMMAND_SETFWARP_SET, warp); } 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()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java index 066157c0..51ad07de 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.util.TL; public class CmdSethome extends FCommand { @@ -27,7 +28,7 @@ public class CmdSethome extends FCommand { @Override public void perform() { if (!Conf.homesEnabled) { - fme.msg("Sorry, Faction homes are disabled on this server."); + fme.msg(TL.COMMAND_SETHOME_DISABLED); return; } @@ -51,21 +52,21 @@ public class CmdSethome extends FCommand { if (!Permission.BYPASS.has(me) && Conf.homesMustBeInClaimedTerritory && Board.getInstance().getFactionAt(new FLocation(me)) != faction) { - fme.msg("Sorry, your faction home can only be set inside your own claimed territory."); + fme.msg(TL.COMMAND_SETHOME_NOTCLAIMED); return; } // 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; } faction.setHome(me.getLocation()); - faction.msg("%s 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()); if (faction != myFaction) { - fme.msg("You have set the home for the " + faction.getTag(fme) + " faction."); + fme.msg(TL.COMMAND_SETHOME_SETOTHER,faction.getTag(fme)); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java index a3414cd5..efcd2835 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java @@ -8,7 +8,10 @@ import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.util.MiscUtil; +import com.massivecraft.factions.zcore.util.TL; + import mkremins.fanciful.FancyMessage; + import org.bukkit.ChatColor; 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 (!payForCommand(Conf.econCostShow, "to show faction information", "for showing faction information")) { + if (!payForCommand(Conf.econCostShow, TL.COMMAND_SHOW_TOSHOW, TL.COMMAND_SHOW_FORSHOW)) { return; } msg(p.txt.titleize(faction.getTag(fme))); - msg("Description: %s", faction.getDescription()); + msg(TL.COMMAND_SHOW_DESCRIPTION, faction.getDescription()); if (!faction.isNormal()) { return; } String peaceStatus = ""; if (faction.isPeaceful()) { - peaceStatus = " " + Conf.colorNeutral + "This faction is Peaceful"; + peaceStatus = " " + Conf.colorNeutral + TL.COMMAND_SHOW_PEACEFUL.toString(); } - msg("Joining: " + (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(); - String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")"; - msg("Land / Power / Maxpower: %d/%d/%d %s", faction.getLandRounded(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost); + String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_SHOW_BONUS.toString():TL.COMMAND_SHOW_PENALTY.toString() + powerBoost + ")"); + msg(TL.COMMAND_SHOW_POWER, faction.getLandRounded(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost); if (faction.isPermanent()) { - msg("This faction is permanent, remaining even with no members."); + msg(TL.COMMAND_SHOW_PERMANENT); } // show the land value @@ -73,20 +76,20 @@ public class CmdShow extends FCommand { double refund = value * Conf.econClaimRefundMultiplier; if (value > 0) { String stringValue = Econ.moneyString(value); - String stringRefund = (refund > 0.0) ? (" (" + Econ.moneyString(refund) + " depreciated)") : ""; - msg("Total land value: " + stringValue + stringRefund); + String stringRefund = (refund > 0.0) ? (TL.COMMAND_SHOW_DEPRECIATED.format(Econ.moneyString(refund))) : ""; + msg(TL.COMMAND_SHOW_LANDVALUE,stringValue,stringRefund); } //Show bank contents if (Conf.bankEnabled) { - msg("Bank contains: " + Econ.moneyString(Econ.getBalance(faction.getAccountId()))); + msg(TL.COMMAND_SHOW_BANKCONTAINS,Econ.moneyString(Econ.getBalance(faction.getAccountId()))); } } ArrayList allies = new ArrayList(); ArrayList enemies = new ArrayList(); - FancyMessage currentAllies = new FancyMessage("Allies: ").color(ChatColor.GOLD); - FancyMessage currentEnemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD); + FancyMessage currentAllies = new FancyMessage(TL.COMMAND_SHOW_ALLIES.toString()).color(ChatColor.GOLD); + FancyMessage currentEnemies = new FancyMessage(TL.COMMAND_SHOW_ENEMIES.toString()).color(ChatColor.GOLD); boolean firstAlly = true; boolean firstEnemy = true; @@ -126,8 +129,8 @@ public class CmdShow extends FCommand { allies.add(currentAllies); enemies.add(currentEnemies); - FancyMessage online = new FancyMessage("Members online: ").color(ChatColor.GOLD); - FancyMessage offline = new FancyMessage("Members offline: ").color(ChatColor.GOLD); + FancyMessage online = new FancyMessage(TL.COMMAND_SHOW_MEMBERSONLINE.toString()).color(ChatColor.GOLD); + FancyMessage offline = new FancyMessage(TL.COMMAND_SHOW_MEMBERSOFFLINE.toString()).color(ChatColor.GOLD); boolean firstOnline = true; boolean firstOffline = true; for (FPlayer p : MiscUtil.rankOrder(faction.getFPlayers())) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java b/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java index c730bcd6..f258b164 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java @@ -3,7 +3,10 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import mkremins.fanciful.FancyMessage; + import org.bukkit.ChatColor; public class CmdShowInvites extends FCommand { @@ -19,11 +22,11 @@ public class CmdShowInvites extends FCommand { @Override 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()) { FPlayer fp = FPlayers.getInstance().getById(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); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdStatus.java b/src/main/java/com/massivecraft/factions/cmd/CmdStatus.java index 570fb68c..5d78f501 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdStatus.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdStatus.java @@ -2,6 +2,8 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.apache.commons.lang.time.DurationFormatUtils; import org.bukkit.ChatColor; @@ -26,10 +28,10 @@ public class CmdStatus extends FCommand { public void perform() { ArrayList ret = new ArrayList(); for (FPlayer fp : myFaction.getFPlayers()) { - String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + " ago"; - String last = fp.isOnline() ? ChatColor.GREEN + "Online" : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized); + String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX; + 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; - 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); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTag.java b/src/main/java/com/massivecraft/factions/cmd/CmdTag.java index d4a3a010..11a82292 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTag.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTag.java @@ -5,6 +5,8 @@ import com.massivecraft.factions.event.FactionRenameEvent; import com.massivecraft.factions.scoreboards.FTeamWrapper; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.util.MiscUtil; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; import java.util.ArrayList; @@ -32,7 +34,7 @@ public class CmdTag extends FCommand { // TODO does not first test cover selfcase? if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) { - msg("That tag is already taken"); + msg(TL.COMMAND_TAG_TAKEN); 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 (!canAffordCommand(Conf.econCostTag, "to change the faction tag")) { + if (!canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) { return; } @@ -55,7 +57,7 @@ public class CmdTag extends FCommand { } // 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; } @@ -65,11 +67,11 @@ public class CmdTag extends FCommand { // Inform for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { if (fplayer.getFactionId() == myFaction.getId()) { - fplayer.msg("%s 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; } Faction faction = fplayer.getFaction(); - fplayer.msg("The faction %s 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); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java b/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java index 0d43492c..2f5925ff 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TextUtil; 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 (!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; } you.setTitle(title); // Inform - myFaction.msg("%s 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)); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java index 2dd224f1..3bf16d1b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java @@ -5,6 +5,8 @@ import com.massivecraft.factions.event.LandUnclaimEvent; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; public class CmdUnclaim extends FCommand { @@ -33,25 +35,25 @@ public class CmdUnclaim extends FCommand { if (otherFaction.isSafeZone()) { if (Permission.MANAGE_SAFE_ZONE.has(sender)) { Board.getInstance().removeAt(flocation); - msg("Safe zone was unclaimed."); + msg(TL.COMMAND_UNCLAIM_SAFEZONE_SUCCESS); 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 { - msg("This is a safe zone. You lack permissions to unclaim."); + msg(TL.COMMAND_UNCLAIM_SAFEZONE_NOPERM); } return; } else if (otherFaction.isWarZone()) { if (Permission.MANAGE_WAR_ZONE.has(sender)) { Board.getInstance().removeAt(flocation); - msg("War zone was unclaimed."); + msg(TL.COMMAND_UNCLAIM_WARZONE_SUCCESS); 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 { - msg("This is a war zone. You lack permissions to unclaim."); + msg(TL.COMMAND_UNCLAIM_WARZONE_NOPERM); } return; } @@ -59,11 +61,11 @@ public class CmdUnclaim extends FCommand { if (fme.isAdminBypassing()) { Board.getInstance().removeAt(flocation); - otherFaction.msg("%s unclaimed some of your land.", fme.describeTo(otherFaction, true)); - msg("You unclaimed this land."); + otherFaction.msg(TL.COMMAND_UNCLAIM_UNCLAIMED, fme.describeTo(otherFaction, true)); + msg(TL.COMMAND_UNCLAIM_UNCLAIMS); 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; @@ -79,7 +81,7 @@ public class CmdUnclaim extends FCommand { if (myFaction != otherFaction) { - msg("You don't own this land."); + msg(TL.COMMAND_UNCLAIM_WRONGFACTION); return; } @@ -93,21 +95,21 @@ public class CmdUnclaim extends FCommand { double refund = Econ.calculateClaimRefund(myFaction.getLandRounded()); 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; } } 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; } } } Board.getInstance().removeAt(flocation); - myFaction.msg("%s unclaimed some land.", fme.describeTo(myFaction, true)); + myFaction.msg(TL.COMMAND_UNCLAIM_FACTIONUNCLAIMED, fme.describeTo(myFaction, true)); 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())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java index 61d95604..70b2515e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java @@ -6,6 +6,8 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.event.LandUnclaimAllEvent; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; public class CmdUnclaimall extends FCommand { @@ -31,11 +33,11 @@ public class CmdUnclaimall extends FCommand { if (Econ.shouldBeUsed()) { double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded()); 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; } } 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; } } @@ -46,10 +48,10 @@ public class CmdUnclaimall extends FCommand { // this event cannot be cancelled Board.getInstance().unclaimAll(myFaction.getId()); - myFaction.msg("%s unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true)); + myFaction.msg(TL.COMMAND_UNCLAIMALL_UNCLAIMED, fme.describeTo(myFaction, true)); 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())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java b/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java index ffa6e77b..9f5463cb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdVersion extends FCommand { @@ -23,6 +24,6 @@ public class CmdVersion extends FCommand { @Override public void perform() { - msg("You are running " + P.p.getDescription().getFullName()); + msg(TL.COMMAND_VERSION_VERSION,P.p.getDescription().getFullName()); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdWarunclaimall.java b/src/main/java/com/massivecraft/factions/cmd/CmdWarunclaimall.java index 1d70a12e..8199df71 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdWarunclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdWarunclaimall.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.Factions; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; public class CmdWarunclaimall extends FCommand { @@ -23,16 +24,16 @@ public class CmdWarunclaimall extends FCommand { senderMustBeModerator = false; senderMustBeAdmin = false; - this.setHelpShort("unclaim all warzone land"); + this.setHelpShort(TL.COMMAND_WARUNCLAIMALL_SHORT.toString()); } @Override public void perform() { Board.getInstance().unclaimAll(Factions.getInstance().getWarZone().getId()); - msg("You unclaimed ALL war zone land."); + msg(TL.COMMAND_WARUNCLAIMALL_SUCCESS); if (Conf.logLandUnclaims) { - P.p.log(fme.getName() + " unclaimed all war zones."); + P.p.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName())); } } diff --git a/src/main/java/com/massivecraft/factions/cmd/FCommand.java b/src/main/java/com/massivecraft/factions/cmd/FCommand.java index 91a3809e..fbda0959 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCommand.java @@ -4,6 +4,8 @@ import com.massivecraft.factions.*; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.MCommand; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; @@ -274,6 +276,10 @@ public abstract class FCommand extends MCommand

{ return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis); } } + + 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 public boolean canAffordCommand(double cost, String toDoThis) { diff --git a/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java b/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java index d757aa2c..576652e5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java @@ -6,6 +6,8 @@ import com.massivecraft.factions.event.FactionRelationEvent; import com.massivecraft.factions.scoreboards.FTeamWrapper; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -35,22 +37,22 @@ public abstract class FRelationCommand extends FCommand { } if (!them.isNormal()) { - msg("Nope! You can't."); + msg(TL.COMMAND_RELATIONS_ALLTHENOPE); return; } if (them == myFaction) { - msg("Nope! You can't declare a relation to yourself :)"); + msg(TL.COMMAND_RELATIONS_MORENOPE); return; } if (myFaction.getRelationWish(them) == targetRelation) { - msg("You already have that relation wish set with %s.", them.getTag()); + msg(TL.COMMAND_RELATIONS_ALREADYINRELATIONSHIP, them.getTag()); return; } // 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; } @@ -66,24 +68,25 @@ public abstract class FRelationCommand extends FCommand { FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation); Bukkit.getServer().getPluginManager().callEvent(relationEvent); - them.msg("Your faction is now " + currentRelationColor + targetRelation.toString() + " to " + currentRelationColor + myFaction.getTag()); - myFaction.msg("Your faction is now " + currentRelationColor + targetRelation.toString() + " to " + currentRelationColor + them.getTag()); + them.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation() ,currentRelationColor + myFaction.getTag()); + myFaction.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation() ,currentRelationColor + myFaction.getTag()); } // inform the other faction of your request else { - them.msg(currentRelationColor + myFaction.getTag() + " wishes to be your " + targetRelation.getColor() + targetRelation.toString()); - them.msg("Type /" + Conf.baseCommandAliases.get(0) + " " + targetRelation + " " + myFaction.getTag() + " to accept."); - myFaction.msg(currentRelationColor + them.getTag() + " were informed that you wish to be " + targetRelation.getColor() + targetRelation); + + them.msg(TL.COMMAND_RELATIONS_PROPOSAL_1,currentRelationColor + myFaction.getTag(),targetRelation.getColor() + targetRelation.getTranslation()); + 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()) { - them.msg("This will have no effect while your faction is peaceful."); - myFaction.msg("This will have no effect while their faction is peaceful."); + them.msg(TL.COMMAND_RELATIONS_PEACEFUL); + myFaction.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER); } if (!targetRelation.isNeutral() && myFaction.isPeaceful()) { - them.msg("This will have no effect while their faction is peaceful."); - myFaction.msg("This will have no effect while your faction is peaceful."); + them.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER); + myFaction.msg(TL.COMMAND_RELATIONS_PEACEFUL); } FTeamWrapper.updatePrefixes(myFaction); diff --git a/src/main/java/com/massivecraft/factions/iface/EconomyParticipator.java b/src/main/java/com/massivecraft/factions/iface/EconomyParticipator.java index ed8e7cf9..214aa860 100644 --- a/src/main/java/com/massivecraft/factions/iface/EconomyParticipator.java +++ b/src/main/java/com/massivecraft/factions/iface/EconomyParticipator.java @@ -1,8 +1,12 @@ package com.massivecraft.factions.iface; +import com.massivecraft.factions.zcore.util.TL; + public interface EconomyParticipator extends RelationParticipator { public String getAccountId(); public void msg(String str, Object... args); + + public void msg(TL translation,Object... args); } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/struct/Relation.java b/src/main/java/com/massivecraft/factions/struct/Relation.java index 9c68fdd5..a1c7a4e2 100644 --- a/src/main/java/com/massivecraft/factions/struct/Relation.java +++ b/src/main/java/com/massivecraft/factions/struct/Relation.java @@ -1,6 +1,8 @@ package com.massivecraft.factions.struct; import com.massivecraft.factions.Conf; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.ChatColor; @@ -22,6 +24,13 @@ public enum Relation { public String toString() { 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() { return this == MEMBER; diff --git a/src/main/java/com/massivecraft/factions/zcore/MCommand.java b/src/main/java/com/massivecraft/factions/zcore/MCommand.java index cb10dc1b..e9dc3fc1 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MCommand.java +++ b/src/main/java/com/massivecraft/factions/zcore/MCommand.java @@ -4,8 +4,11 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import com.massivecraft.factions.P; import com.massivecraft.factions.integration.Econ; +import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TextUtil; + import mkremins.fanciful.FancyMessage; + import org.apache.commons.lang.time.DurationFormatUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -253,6 +256,10 @@ public abstract class MCommand { public void msg(String str, Object... 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) { sender.sendMessage(msg); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index e0a8eba5..47ee1d77 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -15,6 +15,8 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.RelationUtil; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -764,6 +766,10 @@ public abstract class MemoryFPlayer implements FPlayer { public void msg(String str, Object... args) { this.sendMessage(P.p.txt.parse(str, args)); } + + public void msg(TL translation,Object... args){ + this.msg(translation.toString(), args); + } public Player getPlayer() { for (Player player : Bukkit.getServer().getOnlinePlayers()) { diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java index ee9e88e3..5ee3ba82 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -10,6 +10,8 @@ import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.LazyLocation; import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.RelationUtil; +import com.massivecraft.factions.zcore.util.TL; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -601,6 +603,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { fplayer.sendMessage(message); } } + + public void msg(TL translation, Object... args){ + msg(translation.toString(),args); + } public void sendMessage(String message) { for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) { diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 8f8825d0..db7356c3 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -21,8 +21,412 @@ import org.bukkit.configuration.file.YamlConfiguration; /** * An enum for requesting strings from the language file. + * The contents of this enum file may be subject to frequent changes. */ public enum TL { + /** + * Translation meta + */ + _AUTHOR("misc"), + _LANGUAGE("English"), + _ENCODING("UTF-8"), + _REQUIRESUNICODE("false"), + _DEFAULT("true"), + /** + * Command translations + */ + COMMAND_ADMIN_NOTMEMBER("%s is not a member in your faction."), + COMMAND_ADMIN_NOTADMIN("You are not the faction admin."), + COMMAND_ADMIN_TARGETSELF("The target player musn't be yourself."), + COMMAND_ADMIN_DEMOTES("You have demoted %s from the position of faction admin."), + COMMAND_ADMIN_DEMOTED("You have been demoted from the position of faction admin by %s."), + COMMAND_ADMIN_PROMOTES("You have promoted %s to the position of faction admin."), + COMMAND_ADMIN_PROMOTED("%s gave %s the leadership of %s."), + + COMMAND_AUTOCLAIM_ENABLED("Now auto-claiming land for %s."), + COMMAND_AUTOCLAIM_DISABLED("Auto-claiming of land disabled."), + COMMAND_AUTOCLAIM_REQUIREDRANK("You must be %s to claim land."), + COMMAND_AUTOCLAIM_OTHERFACTION("You can't claim land for %s."), + + COMMAND_AUTOHELP_HELPFOR("Help for command \""), + + COMMAND_BOOM_PEACEFULONLY("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 has %s explosions in your faction's territory."), + + COMMAND_BYPASS_ENABLE("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("You have disabled admin bypass mode."), + COMMAND_BYPASS_DISABLELOG(" has DISABLED admin bypass mode."), + + COMMAND_CHAT_DISABLED("The built in chat chat channels are disabled on this server."), + COMMAND_CHAT_INVALIDMODE("Unrecognised chat mode. Please enter either 'a','f' or 'p'"), + + COMMAND_CHAT_MODE_PUBLIC("Public chat mode."), + COMMAND_CHAT_MODE_ALLIANCE("Alliance only chat mode."), + COMMAND_CHAT_MODE_FACTION("Faction only chat mode."), + + COMMAND_CHATSPY_ENABLE("You have enabled chat spying mode."), + COMMAND_CHATSPY_ENABLELOG(" has ENABLED chat spying mode."), + COMMAND_CHATSPY_DISABLE("You have disabled chat spying mode."), + COMMAND_CHATSPY_DISABLELOG(" has DISABLED chat spying mode."), + + COMMAND_CLAIM_INVALIDRADIUS("If you specify a radius, it must be at least 1."), + COMMAND_CLAIM_DENIED("You do not have permission to claim in a radius."), + + COMMAND_CONFIG_NOEXIST("No configuration setting \"%s\" 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("You must leave your current faction first."), + COMMAND_CREATE_INUSE("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("There was an internal error while trying to create your faction. Please try again."), + COMMAND_CREATE_CREATED("%s created a new faction %s"), + COMMAND_CREATE_YOUSHOULD("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 is already a member of %s"), + COMMAND_DEINVITE_MIGHTWANT("You might want to: %s"), + COMMAND_DEINVITE_REVOKED("%s revoked your invitation to %s."), + COMMAND_DEINVITE_REVOKES("%s revoked %s's invitation."), + + COMMAND_DELFWARP_DELETED("Deleted warp %s"), + COMMAND_DELFWARP_INVALID("Couldn't find warp %s"), + COMMAND_DELFWARP_TODELETE("to delete warp"), + COMMAND_DELFWARP_FORDELETE("for deleting warp"), + + COMMAND_DESCRIPTION_CHANGES("You have changed the description for %s to:"), + COMMAND_DESCRIPTION_CHANGED("The faction %s changed their description to:"), + COMMAND_DESCRIPTION_TOCHANGE("to change faction description"), + COMMAND_DESCRIPTION_FORCHANGE("for changing faction description"), + + COMMAND_DISBAND_IMMUTABLE("You cannot disband the Wilderness, SafeZone, or WarZone."), + COMMAND_DISBAND_MARKEDPERMANENT("This faction is designated as permanent, so you cannot disband it."), + COMMAND_DISBAND_BROADCAST_YOURS("%s disbanded your faction."), + COMMAND_DISBAND_BROADCAST_NOTYOURS("%s disbanded the faction %s."), + COMMAND_DISBAND_HOLDINGS("You have been given the disbanded faction's bank, totaling %s."), + + COMMAND_FWARP_CLICKTOWARP("Click to warp!"), + COMMAND_FWARP_COMMANDFORMAT("/f warp "), + COMMAND_FWARP_WARPED("Warped to %s"), + COMMAND_FWARP_INVALID("Couldn't find warp %s"), + COMMAND_FWARP_TOWARP("to warp"), + COMMAND_FWARP_FORWARPING("for warping"), + COMMAND_FWARP_WARPS("Warps: "), + + COMMAND_HELP_404("This page does not exist"), + COMMAND_HELP_NEXTCREATE("Learn how to create a faction on the next page."), + COMMAND_HELP_INVITATIONS("command.help.invitations","You might want to close it and use invitations:"), + COMMAND_HELP_HOME("And don't forget to set your home:"), + COMMAND_HELP_BANK_1("Your faction has a bank which is used to pay for certain"), + COMMAND_HELP_BANK_2("things, so it will need to have money deposited into it."), + COMMAND_HELP_BANK_3("To learn more, use the money command."), + COMMAND_HELP_PLAYERTITLES("Player titles are just for fun. No rules connected to them."), + COMMAND_HELP_OWNERSHIP_1("Claimed land with ownership set is further protected so"), + COMMAND_HELP_OWNERSHIP_2("that only the owner(s), faction admin, and possibly the"), + COMMAND_HELP_OWNERSHIP_3("faction moderators have full access."), + COMMAND_HELP_RELATIONS_1("Set the relation you WISH to have with another faction."), + COMMAND_HELP_RELATIONS_2("Your default relation with other factions will be neutral."), + COMMAND_HELP_RELATIONS_3("If BOTH factions choose \"ally\" you will be allies."), + COMMAND_HELP_RELATIONS_4("If ONE faction chooses \"enemy\" you will be enemies."), + COMMAND_HELP_RELATIONS_5("You can never hurt members or allies."), + COMMAND_HELP_RELATIONS_6("You can not hurt neutrals in their own territory."), + COMMAND_HELP_RELATIONS_7("You can always hurt enemies and players without faction."), + COMMAND_HELP_RELATIONS_8(""), + COMMAND_HELP_RELATIONS_9("Damage from enemies is reduced in your own territory."), + COMMAND_HELP_RELATIONS_10("When you die you lose power. It is restored over time."), + COMMAND_HELP_RELATIONS_11("The power of a faction is the sum of all member power."), + COMMAND_HELP_RELATIONS_12("The power of a faction determines how much land it can hold."), + COMMAND_HELP_RELATIONS_13("You can claim land from factions with too little power."), + COMMAND_HELP_PERMISSIONS_1("Only faction members can build and destroy in their own"), + COMMAND_HELP_PERMISSIONS_2("territory. Usage of the following items is also restricted:"), + COMMAND_HELP_PERMISSIONS_3("Door, Chest, Furnace, Dispenser, Diode."), + COMMAND_HELP_PERMISSIONS_4(""), + COMMAND_HELP_PERMISSIONS_5("Make sure to put pressure plates in front of doors for your"), + COMMAND_HELP_PERMISSIONS_6("guest visitors. Otherwise they can't get through. You can"), + COMMAND_HELP_PERMISSIONS_7("also use this to create member only areas."), + COMMAND_HELP_PERMISSIONS_8("As dispensers are protected, you can create traps without"), + COMMAND_HELP_PERMISSIONS_9("worrying about those arrows getting stolen."), + COMMAND_HELP_ADMIN_1("/f claim safezone claim land for the Safe Zone"), + COMMAND_HELP_ADMIN_2("/f claim warzone claim land for the War Zone"), + COMMAND_HELP_ADMIN_3("/f autoclaim [safezone|warzone] take a guess"), + COMMAND_HELP_MOAR_1("Finally some commands for the server admins:"), + COMMAND_HELP_MOAR_2("More commands for server admins:"), + COMMAND_HELP_MOAR_3("Even more commands for server admins:"), + + COMMAND_HOME_DISABLED("Sorry, Faction homes are disabled on this server."), + COMMAND_HOME_TELEPORTDISABLED("Sorry, the ability to teleport to Faction homes is disabled on this server."), + COMMAND_HOME_NOHOME("Your faction does not have a home. "), + COMMAND_HOME_INENEMY("You cannot teleport to your faction home while in the territory of an enemy faction."), + COMMAND_HOME_WRONGWORLD("You cannot teleport to your faction home while in a different world."), + COMMAND_HOME_ENEMYNEAR("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 invited %s to your faction."), + COMMAND_INVITE_ALREADYMEMBER("%s is already a member of %s"), + + COMMAND_JOIN_CANNOTFORCE("You do not have permission to move other players into a faction."), + COMMAND_JOIN_SYSTEMFACTION("Players may only join normal factions. This is a system faction."), + COMMAND_JOIN_ALREADYMEMBER("%s %s already a member of %s"), + COMMAND_JOIN_ATLIMIT(" ! The faction %s is at the limit of %d members, so %s cannot currently join."), + COMMAND_JOIN_INOTHERFACTION("%s must leave %s current faction first."), + COMMAND_JOIN_NEGATIVEPOWER("%s cannot join a faction with a negative power level."), + COMMAND_JOIN_REQUIRESINVITATION("This faction requires invitation."), + COMMAND_JOIN_ATTEMPTEDJOIN("%s tried to join your faction."), + COMMAND_JOIN_TOJOIN("to join a faction"), + COMMAND_JOIN_FORJOIN("for joining a faction"), + COMMAND_JOIN_SUCCESS("%s successfully joined %s."), + COMMAND_JOIN_MOVED("%s moved you into the faction %s."), + COMMAND_JOIN_JOINED("%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("You cannot kick yourself."), + COMMAND_KICK_OFFLINE("Something went wrong with getting the offline player's faction."), + COMMAND_KICK_NOTMEMBER("%s is not a member of %s"), + COMMAND_KICK_INSUFFICIENTRANK("Your rank is too low to kick this player."), + COMMAND_KICK_NEGATIVEPOWER("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 kicked %s from the faction! :O"), //message given to faction members + COMMAND_KICK_KICKS("You kicked %s from the faction %s!"), //kicker perspective + COMMAND_KICK_KICKED("%s kicked you from %s! :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("Factions is now locked"), + COMMAND_LOCK_UNLOCKED("Factions in now unlocked"), + + COMMAND_MAP_TOSHOW("to show the map"), + COMMAND_MAP_FORSHOW("for showing the map"), + COMMAND_MAP_UPDATE_ENABLED("Map auto update ENABLED."), + COMMAND_MAP_UPDATE_DISABLED("Map auto update DISABLED."), + + COMMAND_MOD_CANDIDATES("Players you can promote: "), + COMMAND_MOD_CLICKTOPROMOTE("Click to promote "), + COMMAND_MOD_NOTMEMBER("%s is not a member in your faction."), + COMMAND_MOD_NOTADMIN("You are not the faction admin."), + COMMAND_MOD_SELF("The target player musn't be yourself."), + COMMAND_MOD_TARGETISADMIN("The target player is a faction admin. Demote them first."), + COMMAND_MOD_REVOKES("You have removed moderator status from %s."), + COMMAND_MOD_REVOKED("%s is no longer moderator in your faction."), + COMMAND_MOD_PROMOTES("%s was promoted to moderator in your faction."), + COMMAND_MOD_PROMOTED("You have promoted %s to moderator."), + + COMMAND_MODIFYPOWER_ADDED("Added %f power to %s. New total rounded power: %d"), + + COMMAND_MONEY_SHORT("faction money commands"), + COMMAND_MONEY_LONG("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 changed the faction to %s."), + COMMAND_OPEN_CHANGED("The faction %s is now %s"), + + COMMAND_OWNER_DISABLED("Sorry, but owned areas are disabled on this server."), + COMMAND_OWNER_LIMIT("Sorry, but you have reached the server's limit of %d owned areas per faction."), + COMMAND_OWNER_WRONGFACTION("This land is not claimed by your faction, so you can't set ownership of it."), + COMMAND_OWNER_NOTCLAIMED("This land is not claimed by a faction. Ownership is not possible."), + COMMAND_OWNER_NOTMEMBER("%s is not a member of this faction."), + COMMAND_OWNER_CLEARED("You have cleared ownership for this claimed area."), + COMMAND_OWNER_REMOVED("You have removed ownership of this claimed land from %s."), + COMMAND_OWNER_TOSET("to set ownership of claimed land"), + COMMAND_OWNER_FORSET("for setting ownership of claimed land"), + COMMAND_OWNER_ADDED("You have added %s to the owner list for this claimed land."), + + COMMAND_OWNERLIST_DISABLED("Sorry, but owned areas are disabled on this server."),//dup-> + COMMAND_OWNERLIST_WRONGFACTION("This land is not claimed by your faction."),//eq + COMMAND_OWNERLIST_NOTCLAIMED("This land is not claimed by any faction, thus no owners."),//eq + COMMAND_OWNERLIST_NONE("No owners are set here; everyone in the faction has access."), + COMMAND_OWNERLIST_OWNERS("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 - Power / Maxpower: %d / %d %s"), + COMMAND_POWER_BONUS(" (bonus: "), + COMMAND_POWER_PENALTY(" (penalty: "), + + COMMAND_POWERBOOST_HELP_1("You must specify \"p\" or \"player\" to target a player or \"f\" or \"faction\" to target a faction."), + COMMAND_POWERBOOST_HELP_2("ex. /f powerboost p SomePlayer 0.5 -or- /f powerboost f SomeFaction -5"), + COMMAND_POWERBOOST_INVALIDNUM("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("%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("Reloaded conf.json from disk, took %dms."), + + COMMAND_SAFEUNCLAIMALL_SHORT("Unclaim all safezone land"), + COMMAND_SAFEUNCLAIMALL_UNCLAIMED("You unclaimed ALL safe zone land."), + COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG("%s unclaimed all safe zones."), + + COMMAND_SAVEALL("Factions saved to disk!"), + + COMMAND_SETFWARP_NOTCLAIMED("You can only set warps in your faction territory."), + COMMAND_SETFWARP_LIMIT("Your Faction already has the max amount of warps set (%d)."), + COMMAND_SETFWARP_SET("Set warp %s to your location."), + COMMAND_SETFWARP_TOSET("to set warp"), + COMMAND_SETFWARP_FORSET("for setting warp"), + + COMMAND_SETHOME_DISABLED("Sorry, Faction homes are disabled on this server."), + COMMAND_SETHOME_NOTCLAIMED("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 set the home for your faction. You can now use:"), + COMMAND_SETHOME_SETOTHER("You have set the home for the %s faction."), + + COMMAND_SHOW_TOSHOW("to show faction information"), + COMMAND_SHOW_FORSHOW("for showing faction information"), + COMMAND_SHOW_DESCRIPTION("Description: %s"), + COMMAND_SHOW_PEACEFUL("This faction is Peaceful"), + COMMAND_SHOW_PERMANENT("This faction is permanent, remaining even with no members."), + COMMAND_SHOW_JOINING("Joining: %s "), + COMMAND_SHOW_INVITATION("invitation is required"), + COMMAND_SHOW_UNINVITED("no invitation is needed"), + COMMAND_SHOW_POWER("Land / Power / Maxpower: %d/%d/%d %s"), + COMMAND_SHOW_BONUS(" (bonus: "), + COMMAND_SHOW_PENALTY(" (penalty: "), + COMMAND_SHOW_DEPRECIATED("(%s depreciated)"), //This is spelled correctly. + COMMAND_SHOW_LANDVALUE("Total land value: %s%s"), + COMMAND_SHOW_BANKCONTAINS("Bank contains: %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("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 changed your faction tag to %s"), + COMMAND_TAG_CHANGED("The faction %s 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 changed a title: %s"), + + COMMAND_UNCLAIM_SAFEZONE_SUCCESS("Safe zone was unclaimed."), + COMMAND_UNCLAIM_SAFEZONE_NOPERM("This is a safe zone. You lack permissions to unclaim."), + COMMAND_UNCLAIM_WARZONE_SUCCESS("War zone was unclaimed."), + COMMAND_UNCLAIM_WARZONE_NOPERM("This is a war zone. You lack permissions to unclaim."), + COMMAND_UNCLAIM_UNCLAIMED("%s unclaimed some of your land."), + COMMAND_UNCLAIM_UNCLAIMS("You unclaimed this land."), + COMMAND_UNCLAIM_LOG("%s unclaimed land at (%s) from the faction: %s"), + COMMAND_UNCLAIM_WRONGFACTION("You don't own this land."), + COMMAND_UNCLAIM_TOUNCLAIM("to unclaim this land"), + COMMAND_UNCLAIM_FORUNCLAIM("for unclaiming this land"), + COMMAND_UNCLAIM_FACTIONUNCLAIMED("%s unclaimed some land."), + + COMMAND_UNCLAIMALL_TOUNCLAIM("to unclaim all faction land"), + COMMAND_UNCLAIMALL_FORUNCLAIM("for unclaiming all faction land"), + COMMAND_UNCLAIMALL_UNCLAIMED("%s unclaimed ALL of your faction's land."), + COMMAND_UNCLAIMALL_LOG("%s unclaimed everything for the faction: %s"), + + COMMAND_VERSION_VERSION("You are running %s"), + + COMMAND_WARUNCLAIMALL_SHORT("unclaim all warzone land"), + COMMAND_WARUNCLAIMALL_SUCCESS("You unclaimed ALL war zone land."), + COMMAND_WARUNCLAIMALL_LOG("%s unclaimed all war zones."), + + COMMAND_RELATIONS_ALLTHENOPE("Nope! You can't."), + COMMAND_RELATIONS_MORENOPE("Nope! You can't declare a relation to yourself :)"), + COMMAND_RELATIONS_ALREADYINRELATIONSHIP("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("Your faction is now %s to %s"), + COMMAND_RELATIONS_PEACEFUL("This will have no effect while your faction is peaceful."), + COMMAND_RELATIONS_PEACEFULOTHER("This will have no effect while their faction is peaceful."), + + COMMAND_RELATIONS_PROPOSAL_1("%s wishes to be your %s"), + COMMAND_RELATIONS_PROPOSAL_2("Type /%s %s %s to accept."), + COMMAND_RELATIONS_PROPOSAL_SENT("%s 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(" Ask your leader to:"), + GENERIC_YOUSHOULD("You should:"), + GENERIC_YOUMAYWANT("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("Sorry. No Pages available."), + INVALIDPAGE("Invalid page. Must be between 1 and %d"), + /** + * The ones here before I started messing around with this + */ TITLE("title", "&bFactions &0|&r"), WILDERNESS("wilderness", "&2Wilderness"), WILDERNESS_DESCRIPTION("wilderness-description", ""), @@ -47,6 +451,16 @@ public enum TL { this.path = path; 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. @@ -61,6 +475,10 @@ public enum TL { public String toString() { 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. diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java index 2338e27b..483d1684 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java @@ -148,10 +148,10 @@ public class TextUtil { ret.add(this.titleize(title + " " + pageHumanBased + "/" + pagecount)); if (pagecount == 0) { - ret.add(this.parseTags("Sorry. No Pages available.")); + ret.add(this.parseTags(TL.NOPAGES.toString())); return ret; } else if (pageZeroBased < 0 || pageHumanBased > pagecount) { - ret.add(this.parseTags("Invalid page. Must be between 1 and " + pagecount)); + ret.add(this.parseTags(TL.INVALIDPAGE.format(pagecount))); return ret; }