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

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

View File

@@ -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("<b>You cannot kick yourself.");
msg("<i>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<b> is not a member of %s", toKick.describeTo(fme, true), myFaction.describeTo(fme));
msg(TL.COMMAND_KICK_NOTMEMBER, toKick.describeTo(fme, true), myFaction.describeTo(fme));
return;
}
if (toKick.getRole().value >= fme.getRole().value) {
msg("<b>Your rank is too low to kick this player.");
msg(TL.COMMAND_KICK_INSUFFICIENTRANK);
return;
}
if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) {
msg("<b>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<i> kicked %s<i> from the faction! :O", fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
toKick.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(toKick, true), toKickFaction.describeTo(toKick));
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("<i>You kicked %s<i> from the faction %s<i>!", toKick.describeTo(fme), toKickFaction.describeTo(fme));
fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme));
}
if (Conf.logFactionKick) {
//TODO:TL
P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag());
}