mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Make our commands respect localized skill names.
This commit is contained in:
parent
0419dca385
commit
1ef1d53fd9
@ -19,6 +19,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
PlayerProfile profile;
|
PlayerProfile profile;
|
||||||
int levels;
|
int levels;
|
||||||
boolean allSkills = false;
|
boolean allSkills = false;
|
||||||
|
SkillType skill = null;
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -56,14 +57,15 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.addLevels(SkillType.getSkill(args[0]), levels);
|
skill = SkillType.getSkill(args[0]);
|
||||||
|
profile.addLevels(skill, levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allSkills) {
|
if (allSkills) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, StringUtils.getCapitalized(args[0])));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, SkillTools.getSkillName(skill)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -108,7 +110,8 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.addLevels(SkillType.getSkill(args[1]), levels);
|
skill = SkillType.getSkill(args[1]);
|
||||||
|
profile.addLevels(skill, levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save(); // Since this is a temporary profile, we save it here.
|
profile.save(); // Since this is a temporary profile, we save it here.
|
||||||
@ -128,8 +131,9 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", levels));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.addLevels(SkillType.getSkill(args[1]), levels);
|
skill = SkillType.getSkill(args[1]);
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, StringUtils.getCapitalized(args[1])));
|
profile.addLevels(skill, levels);
|
||||||
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", levels, SkillTools.getSkillName(skill)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +141,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", StringUtils.getCapitalized(args[1]), args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", SkillTools.getSkillName(skill), args[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,6 +19,7 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
McMMOPlayer mcMMOPlayer;
|
McMMOPlayer mcMMOPlayer;
|
||||||
PlayerProfile profile;
|
PlayerProfile profile;
|
||||||
boolean allSkills = false;
|
boolean allSkills = false;
|
||||||
|
SkillType skill = null;
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -59,8 +60,10 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mcMMOPlayer.applyXpGain(SkillType.getSkill(args[0]), xp);
|
skill = SkillType.getSkill(args[0]);
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, StringUtils.getCapitalized(args[0])));
|
|
||||||
|
mcMMOPlayer.applyXpGain(skill, xp);
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, SkillTools.getSkillName(skill)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -106,7 +109,8 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.setSkillXpLevel(SkillType.getSkill(args[1]), xp);
|
skill = SkillType.getSkill(args[1]);
|
||||||
|
profile.setSkillXpLevel(skill, xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save(); // Since this is a temporary profile, we save it here.
|
profile.save(); // Since this is a temporary profile, we save it here.
|
||||||
@ -124,8 +128,9 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mcMMOPlayer.applyXpGain(SkillType.getSkill(args[1]), xp);
|
skill = SkillType.getSkill(args[1]);
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, StringUtils.getCapitalized(args[1])));
|
mcMMOPlayer.applyXpGain(skill, xp);
|
||||||
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, SkillTools.getSkillName(skill)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +138,7 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", StringUtils.getCapitalized(args[1]), args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", SkillTools.getSkillName(skill), args[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,6 +19,7 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
PlayerProfile profile;
|
PlayerProfile profile;
|
||||||
int newValue;
|
int newValue;
|
||||||
boolean allSkills = false;
|
boolean allSkills = false;
|
||||||
|
SkillType skill = null;
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -58,8 +59,9 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillType.getSkill(args[0]), newValue);
|
skill = SkillType.getSkill(args[0]);
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", StringUtils.getCapitalized(args[0]), newValue));
|
profile.modifySkill(skill, newValue);
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", SkillTools.getSkillName(skill), newValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -104,7 +106,8 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillType.getSkill(args[1]), newValue);
|
skill = SkillType.getSkill(args[1]);
|
||||||
|
profile.modifySkill(skill, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save(); // Since this is a temporary profile, we save it here.
|
profile.save(); // Since this is a temporary profile, we save it here.
|
||||||
@ -124,8 +127,9 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", newValue));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillType.getSkill(args[1]), newValue);
|
skill = SkillType.getSkill(args[1]);
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", StringUtils.getCapitalized(args[1]), newValue));
|
profile.modifySkill(skill, newValue);
|
||||||
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", SkillTools.getSkillName(skill), newValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +137,7 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", StringUtils.getCapitalized(args[1]), args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", SkillTools.getSkillName(skill), args[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -18,6 +18,8 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
PlayerProfile profile;
|
PlayerProfile profile;
|
||||||
boolean allSkills = false;
|
boolean allSkills = false;
|
||||||
|
SkillType skill = null;
|
||||||
|
String skillName = "";
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -38,30 +40,16 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profile = Users.getPlayer((Player) sender).getProfile();
|
||||||
|
|
||||||
if (allSkills) {
|
if (allSkills) {
|
||||||
for (SkillType skillType : SkillType.values()) {
|
for (SkillType skillType : SkillType.values()) {
|
||||||
if (skillType.isChildSkill()) {
|
if (skillType.isChildSkill()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sender.hasPermission("mcmmo.commands.skillreset." + args[0].toLowerCase())) {
|
if (!sender.hasPermission("mcmmo.commands.skillreset." + SkillTools.getSkillName(skillType).toLowerCase())) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!sender.hasPermission("mcmmo.commands.skillreset." + args[0].toLowerCase())) {
|
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
profile = Users.getPlayer((Player) sender).getProfile();
|
|
||||||
|
|
||||||
if (allSkills) {
|
|
||||||
for (SkillType skillType : SkillType.values()) {
|
|
||||||
if (skillType.isChildSkill()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,8 +59,16 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillType.getSkill(args[0]), 0);
|
skill = SkillType.getSkill(args[0]);
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Reset.Single", StringUtils.getCapitalized(args[0])));
|
skillName = SkillTools.getSkillName(skill);
|
||||||
|
|
||||||
|
if (!sender.hasPermission("mcmmo.commands.skillreset." + skillName.toLowerCase())) {
|
||||||
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.modifySkill(skill, 0);
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.Reset.Single", StringUtils.getCapitalized(skillName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -91,20 +87,11 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allSkills) {
|
if (!allSkills) {
|
||||||
for (SkillType skillType : SkillType.values()) {
|
skill = SkillType.getSkill(args[1]);
|
||||||
if (skillType.isChildSkill()) {
|
skillName = SkillTools.getSkillName(skill);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + args[1].toLowerCase())) {
|
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skillName.toLowerCase())) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + args[1].toLowerCase())) {
|
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -127,11 +114,16 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + SkillTools.getSkillName(skillType).toLowerCase())) {
|
||||||
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
profile.modifySkill(skillType, 0);
|
profile.modifySkill(skillType, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillType.getSkill(args[1]), 0);
|
profile.modifySkill(skill, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save(); // Since this is a temporary profile, we save it here.
|
profile.save(); // Since this is a temporary profile, we save it here.
|
||||||
@ -145,14 +137,19 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + SkillTools.getSkillName(skillType).toLowerCase())) {
|
||||||
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
profile.modifySkill(skillType, 0);
|
profile.modifySkill(skillType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.modifySkill(SkillType.getSkill(args[1]), 0);
|
profile.modifySkill(skill, 0);
|
||||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.Single", StringUtils.getCapitalized(args[1])));
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Reset.Single", StringUtils.getCapitalized(skillName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +157,7 @@ public class SkillresetCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", args[0]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", StringUtils.getCapitalized(args[1]), args[0]));
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.2", StringUtils.getCapitalized(skillName), args[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -99,10 +99,10 @@ public class McrankCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rankInts[1] == 0) {
|
if (rankInts[1] == 0) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.localizeSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked"))); // Don't bother showing ranking for players without skills
|
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.getSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked"))); // Don't bother showing ranking for players without skills
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.localizeSkillName(skillType), String.valueOf(rankInts[0])));
|
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.getSkillName(skillType), String.valueOf(rankInts[0])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import com.gmail.nossr50.database.Database;
|
|||||||
import com.gmail.nossr50.database.Leaderboard;
|
import com.gmail.nossr50.database.Leaderboard;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||||
|
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
public class MctopCommand implements CommandExecutor {
|
public class MctopCommand implements CommandExecutor {
|
||||||
@ -30,10 +31,7 @@ public class MctopCommand implements CommandExecutor {
|
|||||||
display(Integer.parseInt(args[0]), "ALL", sender, useMySQL, command);
|
display(Integer.parseInt(args[0]), "ALL", sender, useMySQL, command);
|
||||||
}
|
}
|
||||||
else if (SkillTools.isSkill(args[0])) {
|
else if (SkillTools.isSkill(args[0])) {
|
||||||
display(1, args[0], sender, useMySQL, command);
|
display(1, SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
|
||||||
}
|
|
||||||
else if (SkillTools.isLocalizedSkill(args[0])) {
|
|
||||||
display(1, SkillTools.translateLocalizedSkill(args[0]), sender, useMySQL, command);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||||
@ -47,10 +45,7 @@ public class MctopCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SkillTools.isSkill(args[0])) {
|
if (SkillTools.isSkill(args[0])) {
|
||||||
display(Integer.parseInt(args[1]), args[0], sender, useMySQL, command);
|
display(Integer.parseInt(args[1]), SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
|
||||||
}
|
|
||||||
else if (SkillTools.isLocalizedSkill(args[0])) {
|
|
||||||
display(Integer.parseInt(args[1]), SkillTools.translateLocalizedSkill(args[0]), sender, useMySQL, command);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||||
|
@ -36,10 +36,10 @@ public class McRankAsync implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (skills.get(skillType.name()) == null) {
|
if (skills.get(skillType.name()) == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.localizeSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked")));
|
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.getSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked")));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.localizeSkillName(skillType), skills.get(skillType.name())));
|
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillTools.getSkillName(skillType), skills.get(skillType.name())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ public abstract class SkillCommand implements CommandExecutor {
|
|||||||
protected void luckyEffectsDisplay() {
|
protected void luckyEffectsDisplay() {
|
||||||
if (isLucky) {
|
if (isLucky) {
|
||||||
String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
|
String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
|
||||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", SkillTools.localizeSkillName(skill))));
|
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", SkillTools.getSkillName(skill))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public final class SkillGuide {
|
|||||||
public static boolean grabGuidePageForSkill(SkillType skilltype, Player player, String[] args) {
|
public static boolean grabGuidePageForSkill(SkillType skilltype, Player player, String[] args) {
|
||||||
String skillName = skilltype.toString();
|
String skillName = skilltype.toString();
|
||||||
String capitalized = StringUtils.getCapitalized(skillName);
|
String capitalized = StringUtils.getCapitalized(skillName);
|
||||||
String localized = SkillTools.localizeSkillName(skilltype);
|
String localized = SkillTools.getSkillName(skilltype);
|
||||||
player.sendMessage(LocaleLoader.getString("Guides.Available", localized, localized.toLowerCase()));
|
player.sendMessage(LocaleLoader.getString("Guides.Available", localized, localized.toLowerCase()));
|
||||||
|
|
||||||
String address = "Guides." + capitalized;
|
String address = "Guides." + capitalized;
|
||||||
|
@ -289,6 +289,10 @@ public class SkillTools {
|
|||||||
* @return true if this is a valid skill, false otherwise
|
* @return true if this is a valid skill, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isSkill(String skillName) {
|
public static boolean isSkill(String skillName) {
|
||||||
|
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||||
|
return isLocalizedSkill(skillName);
|
||||||
|
}
|
||||||
|
|
||||||
if (SkillType.getSkill(skillName) != null) {
|
if (SkillType.getSkill(skillName) != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -296,9 +300,9 @@ public class SkillTools {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLocalizedSkill(String skillName) {
|
private static boolean isLocalizedSkill(String skillName) {
|
||||||
for (SkillType skill : SkillType.values()) {
|
for (SkillType skill : SkillType.values()) {
|
||||||
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(skill.toString() + ".SkillName")))) {
|
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".SkillName"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,20 +310,14 @@ public class SkillTools {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String translateLocalizedSkill(String skillName) {
|
public static String getSkillName(SkillType skill) {
|
||||||
for (SkillType skill : SkillType.values()) {
|
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||||
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(skill.toString() + ".SkillName")))) {
|
|
||||||
return skill.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String localizeSkillName(SkillType skill) {
|
|
||||||
return StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".SkillName"));
|
return StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".SkillName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return StringUtils.getCapitalized(skill.toString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the player has any combat skill permissions.
|
* Check if the player has any combat skill permissions.
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,9 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
public enum SkillType {
|
public enum SkillType {
|
||||||
ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()),
|
ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()),
|
||||||
@ -119,6 +121,14 @@ public enum SkillType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SkillType getSkill(String skillName) {
|
public static SkillType getSkill(String skillName) {
|
||||||
|
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||||
|
for (SkillType type : values()) {
|
||||||
|
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (SkillType type : values()) {
|
for (SkillType type : values()) {
|
||||||
if (type.name().equalsIgnoreCase(skillName)) {
|
if (type.name().equalsIgnoreCase(skillName)) {
|
||||||
return type;
|
return type;
|
||||||
|
@ -554,7 +554,7 @@ public class SpoutTools {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.LevelUp.1"), LocaleLoader.getString("Spout.LevelUp.2", SkillTools.localizeSkillName(skillType), profile.getSkillLevel(skillType)), mat);
|
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.LevelUp.1"), LocaleLoader.getString("Spout.LevelUp.2", SkillTools.getSkillName(skillType), profile.getSkillLevel(skillType)), mat);
|
||||||
SpoutSounds.playLevelUpNoise(spoutPlayer, plugin);
|
SpoutSounds.playLevelUpNoise(spoutPlayer, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user