mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Added translation keys for the /racelist command
This commit is contained in:
parent
84f5b9d347
commit
f47ad82999
3 changed files with 40 additions and 7 deletions
|
@ -13,7 +13,9 @@ import net.minecraft.command.WrongUsageException;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
class CommandRacelist extends CommandBase {
|
||||
|
||||
|
@ -39,17 +41,37 @@ class CommandRacelist extends CommandBase {
|
|||
Race race = Race.fromName(args[1], Race.HUMAN);
|
||||
|
||||
TextComponentTranslation formattedName = new TextComponentTranslation(race.name().toLowerCase());
|
||||
formattedName.getStyle().setColor(TextFormatting.GOLD);
|
||||
|
||||
if (race == Race.HUMAN) {
|
||||
if (race.isDefault()) {
|
||||
player.sendMessage(new TextComponentTranslation("commands.racelist.illegal", formattedName));
|
||||
} else if (args[0].contentEquals("allow")) {
|
||||
PlayerSpeciesList.instance().whiteListRace(race);
|
||||
String translationKey = "commands.racelist.allowed";
|
||||
|
||||
if (!PlayerSpeciesList.instance().whiteListRace(race)) {
|
||||
translationKey += ".failed";
|
||||
}
|
||||
|
||||
if (sender == player) {
|
||||
ITextComponent comp = new TextComponentTranslation(translationKey, formattedName);
|
||||
comp.getStyle().setColor(TextFormatting.GREEN);
|
||||
player.sendMessage(comp);
|
||||
}
|
||||
notifyCommandListener(sender, this, 1, translationKey + ".other", player.getName(), formattedName);
|
||||
|
||||
player.sendMessage(new TextComponentTranslation("commands.racelist.allowed", formattedName));
|
||||
} else if (args[0].contentEquals("disallow")) {
|
||||
PlayerSpeciesList.instance().unwhiteListRace(race);
|
||||
String translationKey = "commands.racelist.disallowed";
|
||||
|
||||
player.sendMessage(new TextComponentTranslation("commands.racelist.disallowed", formattedName));
|
||||
if (!PlayerSpeciesList.instance().unwhiteListRace(race)) {
|
||||
translationKey += ".failed";
|
||||
}
|
||||
|
||||
if (sender == player) {
|
||||
ITextComponent comp = new TextComponentTranslation(translationKey, formattedName);
|
||||
comp.getStyle().setColor(TextFormatting.GREEN);
|
||||
player.sendMessage(comp);
|
||||
}
|
||||
notifyCommandListener(sender, this, 1, translationKey + ".other", player.getName(), formattedName);
|
||||
} else {
|
||||
throw new WrongUsageException(getUsage(sender));
|
||||
}
|
||||
|
|
|
@ -73,10 +73,10 @@ class CommandSpecies extends CommandBase {
|
|||
TextComponentTranslation formattedName = new TextComponentTranslation(species.name().toLowerCase());
|
||||
|
||||
if (player != sender) {
|
||||
notifyCommandListener(sender, this, 1, "commands.race.success.other", player.getName(), formattedName);
|
||||
notifyCommandListener(sender, this, 1, "commands.race.success.other", formattedName, player.getName());
|
||||
} else {
|
||||
player.sendMessage(new TextComponentTranslation("commands.race.success.self"));
|
||||
notifyCommandListener(sender, this, 1, "commands.race.success.otherself", player.getName(), formattedName);
|
||||
notifyCommandListener(sender, this, 1, "commands.race.success.otherself", formattedName, player.getName());
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(new TextComponentTranslation("commands.race.permission"));
|
||||
|
|
|
@ -121,6 +121,17 @@ commands.race.describe.changeling.1=Beware the changeling, for they can appear w
|
|||
commands.race.describe.changeling.2=Changelings can fly but but do not interact with clouds.
|
||||
commands.race.describe.changeling.3=They have to feed on mobs and other players to eat.
|
||||
|
||||
commands.racelist.usage=/racelist <allow|disallow> <species>
|
||||
commands.racelist.illegal=The default race %s cannot be used with this command.
|
||||
commands.racelist.allowed=Added %1$s to the whitelist.
|
||||
commands.racelist.allowed.failed=%1$s is already whitelisted.
|
||||
commands.race.success.other=%1$s was added to the whitelist by %2$s.
|
||||
commands.racelist.allowed.failed.other=%2$s tried to whitelist %1$s but it was already whitelisted.
|
||||
commands.racelist.disallowed=Removed %1$s from the whitelist.
|
||||
commands.racelist.disallowed.failed=%1$s is not on the whitelist.
|
||||
commands.racelist.disallowed.other=%1$s was removed from the whitelist by %2$s.
|
||||
commands.racelist.disallowed.failed.other=%2$s tried to remove %1$s from the whitelist but it has not been added yet.
|
||||
|
||||
commands.decloud.success=%s clouds removed
|
||||
commands.decloud.usage=/decloud <all>
|
||||
|
||||
|
|
Loading…
Reference in a new issue