Fixed grammar error in adding/choosing elements (#515)

Added checks to test which element is being chosen and then based on
that outputs a certain message.
This commit is contained in:
d0nwah 2016-07-17 15:47:50 +10:00 committed by OmniCypher
parent 4cca47ec10
commit 8b9d80d76a
4 changed files with 55 additions and 24 deletions

View file

@ -25,8 +25,10 @@ public class AddCommand extends PKCommand {
private String playerNotFound;
private String invalidElement;
private String addedOther;
private String added;
private String addedOtherCFW;
private String addedOtherAE;
private String addedCFW;
private String addedAE;
private String alreadyHasElementOther;
private String alreadyHasElement;
private String alreadyHasSubElementOther;
@ -37,8 +39,10 @@ public class AddCommand extends PKCommand {
this.playerNotFound = ConfigManager.languageConfig.get().getString("Commands.Add.PlayerNotFound");
this.invalidElement = ConfigManager.languageConfig.get().getString("Commands.Add.InvalidElement");
this.addedOther = ConfigManager.languageConfig.get().getString("Commands.Add.Other.SuccessfullyAdded");
this.added = ConfigManager.languageConfig.get().getString("Commands.Add.SuccessfullyAdded");
this.addedOtherCFW = ConfigManager.languageConfig.get().getString("Commands.Add.Other.SuccessfullyAddedCFW");
this.addedOtherAE = ConfigManager.languageConfig.get().getString("Commands.Add.Other.SuccessfullyAddedAE");
this.addedCFW = ConfigManager.languageConfig.get().getString("Commands.Add.SuccessfullyAddedCFW");
this.addedAE = ConfigManager.languageConfig.get().getString("Commands.Add.SuccessfullyAddedAE");
this.alreadyHasElementOther = ConfigManager.languageConfig.get().getString("Commands.Add.Other.AlreadyHasElement");
this.alreadyHasElement = ConfigManager.languageConfig.get().getString("Commands.Add.AlreadyHasElement");
this.alreadyHasSubElementOther = ConfigManager.languageConfig.get().getString("Commands.Add.Other.AlreadyHasSubElement");
@ -109,10 +113,18 @@ public class AddCommand extends PKCommand {
ChatColor color = e.getColor();
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
sender.sendMessage(color + addedOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender()));
target.sendMessage(color + added.replace("{element}", e.getName() + e.getType().getBender()));
if (e != Element.AIR && e != Element.EARTH) {
sender.sendMessage(color + addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender()));
target.sendMessage(color + addedCFW.replace("{element}", e.getName() + e.getType().getBender()));
} else {
target.sendMessage(color + added.replace("{element}", e.getName() + e.getType().getBender()));
sender.sendMessage(color + addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender()));
target.sendMessage(color + addedAE.replace("{element}", e.getName() + e.getType().getBender()));
}
} else {
if (e != Element.AIR && e != Element.EARTH)
target.sendMessage(color + addedCFW.replace("{element}", e.getName() + e.getType().getBender()));
else
target.sendMessage(color + addedAE.replace("{element}", e.getName() + e.getType().getBender()));
}
GeneralMethods.saveElements(bPlayer);
@ -133,10 +145,16 @@ public class AddCommand extends PKCommand {
ChatColor color = e.getColor();
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
sender.sendMessage(color + addedOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender()));
} else {
target.sendMessage(color + added.replace("{element}", sub.getName() + sub.getType().getBender()));
if (e != Element.AIR && e != Element.EARTH)
sender.sendMessage(color + addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender()));
else
sender.sendMessage(color + addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender()));
} else {
if (e != Element.AIR && e != Element.EARTH)
target.sendMessage(color + addedCFW.replace("{element}", sub.getName() + sub.getType().getBender()));
else
target.sendMessage(color + addedAE.replace("{element}", sub.getName() + sub.getType().getBender()));
}
GeneralMethods.saveSubElements(bPlayer);
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.ADD));

View file

@ -26,16 +26,20 @@ public class ChooseCommand extends PKCommand {
private String invalidElement;
private String playerNotFound;
private String chosen;
private String chosenOther;
private String chosenCFW;
private String chosenAE;
private String chosenOtherCFW;
private String chosenOtherAE;
public ChooseCommand() {
super("choose", "/bending choose <Element> [Player]", ConfigManager.languageConfig.get().getString("Commands.Choose.Description"), new String[] { "choose", "ch" });
this.playerNotFound = ConfigManager.languageConfig.get().getString("Commands.Choose.PlayerNotFound");
this.invalidElement = ConfigManager.languageConfig.get().getString("Commands.Choose.InvalidElement");
this.chosen = ConfigManager.languageConfig.get().getString("Commands.Choose.SuccessfullyChosen");
this.chosenOther = ConfigManager.languageConfig.get().getString("Commands.Choose.Other.SuccessfullyChosen");
this.chosenCFW = ConfigManager.languageConfig.get().getString("Commands.Choose.SuccessfullyChosenCFW");
this.chosenAE = ConfigManager.languageConfig.get().getString("Commands.Choose.SuccessfullyChosenAE");
this.chosenOtherCFW = ConfigManager.languageConfig.get().getString("Commands.Choose.Other.SuccessfullyChosenCFW");
this.chosenOtherAE = ConfigManager.languageConfig.get().getString("Commands.Choose.Other.SuccessfullyChosenAE");
}
@Override
@ -117,9 +121,9 @@ public class ChooseCommand extends PKCommand {
bPlayer.addSubElement(sub);
ChatColor color = sub != null ? sub.getColor() : ChatColor.WHITE;
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
sender.sendMessage(color + chosenOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender()));
sender.sendMessage(color + chosenOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender()));
} else {
target.sendMessage(color + chosen.replace("{element}", sub.getName() + sub.getType().getBender()));
target.sendMessage(color + chosenCFW.replace("{element}", sub.getName() + sub.getType().getBender()));
}
GeneralMethods.saveSubElements(bPlayer);
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.CHOOSE));
@ -134,9 +138,15 @@ public class ChooseCommand extends PKCommand {
ChatColor color = element != null ? element.getColor() : ChatColor.WHITE;
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
sender.sendMessage(color + chosenOther.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", element.getName() + element.getType().getBender()));
if (element != Element.AIR && element != Element.EARTH)
sender.sendMessage(color + chosenOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", element.getName() + element.getType().getBender()));
else
sender.sendMessage(color + chosenOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", element.getName() + element.getType().getBender()));
} else {
target.sendMessage(color + chosen.replace("{element}", element.getName() + element.getType().getBender()));
if (element != Element.AIR && element != Element.EARTH)
target.sendMessage(color + chosenCFW.replace("{element}", element.getName() + element.getType().getBender()));
else
target.sendMessage(color + chosenAE.replace("{element}", element.getName() + element.getType().getBender()));
}
GeneralMethods.saveElements(bPlayer);
GeneralMethods.saveSubElements(bPlayer);

View file

@ -53,13 +53,12 @@ public class WhoCommand extends PKCommand {
staff.put("96f40c81-dd5d-46b6-9afe-365114d4a082", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Coolade
staff.put("833a7132-a9ec-4f0a-ad9c-c3d6b8a1c7eb", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Jacklin213
staff.put("4eb6315e-9dd1-49f7-b582-c1170e497ab0", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // jedk1
staff.put("d7757be8-86de-4898-ab4f-2b1b2fbc3dfa", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // StrangeOne101
staff.put("3b5bdfab-8ae1-4794-b160-4f33f31fde99", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // kingbirdy
staff.put("dedf335b-d282-47ab-8ffc-a80121661cd1", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // grasshopperMatt
staff.put("679a6396-6a31-4898-8130-044f34bef743", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // savior67
staff.put("7bb267eb-cf0b-4fb9-a697-27c2a913ed92", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Finn
staff.put("1c30007f-f8ef-4b4e-aff0-787aa1bc09a3", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Sorin
staff.put("dd578a4f-d35e-4fed-94db-9d5a627ff962", ChatColor.DARK_PURPLE + "ProjectKorra Developer"); // Sobki
staff.put("623df34e-9cd4-438d-b07c-1905e1fc46b6", ChatColor.GREEN + "ProjectKorra Concept Designer"); // Loony
staff.put("3c484e61-7876-46c0-98c9-88c7834dc96c", ChatColor.GREEN + "ProjectKorra Concept Designer"); // SamuraiSnowman (Zmeduna)

View file

@ -182,8 +182,10 @@ public class ConfigManager {
config.addDefault("Commands.Choose.Description", "This command will allow the user to choose a player either for himself or <Player> if specified. This command can only be used once per player unless they have permission to rechoose their element.");
config.addDefault("Commands.Choose.InvalidElement", "That is not a valid element.");
config.addDefault("Commands.Choose.PlayerNotFound", "Could not find player.");
config.addDefault("Commands.Choose.SuccessfullyChosen", "You are now a {element}.");
config.addDefault("Commands.Choose.Other.SuccessfullyChosen", "{target} is now a {element}.");
config.addDefault("Commands.Choose.SuccessfullyChosenCFW", "You are now a {element}.");
config.addDefault("Commands.Choose.SuccessfullyChosenAE", "You are now an {element}.");
config.addDefault("Commands.Choose.Other.SuccessfullyChosenCFW", "{target} is now a {element}.");
config.addDefault("Commands.Choose.Other.SuccessfullyChosenAE", "{target} is now an {element}.");
config.addDefault("Commands.Check.Description", "Checks if ProjectKorra is up to date.");
config.addDefault("Commands.Check.NewVersionAvailable", "There's a new version of ProjectKorra available!");
@ -198,12 +200,14 @@ public class ConfigManager {
config.addDefault("Commands.Bind.SuccessfullyBound", "Succesfully bound {ability} to slot {slot}.");
config.addDefault("Commands.Add.Description", "This command will allow the user to add an element to the targeted <Player>, or themselves if the target is not specified. This command is typically reserved for server administrators.");
config.addDefault("Commands.Add.SuccessfullyAdded", "You are now also a {element}.");
config.addDefault("Commands.Add.SuccessfullyAddedCFW", "You are now also a {element}.");
config.addDefault("Commands.Add.SuccessfullyAddedAE", "You are now also an {element}.");
config.addDefault("Commands.Add.PlayerNotFound", "That player could not be found.");
config.addDefault("Commands.Add.InvalidElement", "You must specify a valid element.");
config.addDefault("Commands.Add.AlreadyHasElement", "You already have that element!");
config.addDefault("Commands.Add.AlreadyHasSubElement", "You already have that subelement!");
config.addDefault("Commands.Add.Other.SuccessfullyAdded", "{target} is now also a {element}.");
config.addDefault("Commands.Add.Other.SuccessfullyAddedCFW", "{target} is now also a {element}.");
config.addDefault("Commands.Add.Other.SuccessfullyAddedAE", "{target} is now also an {element}.");
config.addDefault("Commands.Add.Other.AlreadyHasElement", "{target} already has that element!");
config.addDefault("Commands.Add.Other.AlreadyHasSubElement", "{target} already has that subelement!");