From acc3d7610be898f6c1676af90b94c3d2126ad65c Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 3 Apr 2012 15:26:19 -0400 Subject: [PATCH] More command updates. --- src/main/java/com/gmail/nossr50/Users.java | 21 ++- .../gmail/nossr50/commands/CommandHelper.java | 138 ++++++++++++++++ .../commands/general/AddlevelsCommand.java | 41 ++--- .../commands/general/AddxpCommand.java | 35 ++-- .../commands/general/InspectCommand.java | 156 +++++++----------- .../java/com/gmail/nossr50/mcPermissions.java | 2 +- .../resources/locale/locale_en_us.properties | 13 +- 7 files changed, 246 insertions(+), 160 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/commands/CommandHelper.java diff --git a/src/main/java/com/gmail/nossr50/Users.java b/src/main/java/com/gmail/nossr50/Users.java index 2af94fc0d..c6b15abf6 100644 --- a/src/main/java/com/gmail/nossr50/Users.java +++ b/src/main/java/com/gmail/nossr50/Users.java @@ -5,6 +5,7 @@ import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; +import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import com.gmail.nossr50.datatypes.PlayerProfile; @@ -93,13 +94,7 @@ public class Users { * @return the player's profile */ public static PlayerProfile getProfile(Player player) { - if(players.get(player.getName().toLowerCase()) != null) { - return players.get(player.getName().toLowerCase()); - } - else { - players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName())); - return players.get(player.getName().toLowerCase()); - } + return getProfile(player.getName()); } /** @@ -109,7 +104,7 @@ public class Users { * @return the player's profile */ public static PlayerProfile getProfile(String playerName) { - if(players.get(playerName.toLowerCase()) != null) { + if (players.get(playerName.toLowerCase()) != null) { return players.get(playerName.toLowerCase()); } else { @@ -118,6 +113,16 @@ public class Users { } } + /** + * Get the profile of an offline player. + * + * @param player The player whose profile to retrieve + * @return the player's profile + */ + public static PlayerProfile getOfflineProfile(OfflinePlayer player) { + return getOfflineProfile(player.getName()); + } + /** * Get the profile of an offline player. * diff --git a/src/main/java/com/gmail/nossr50/commands/CommandHelper.java b/src/main/java/com/gmail/nossr50/commands/CommandHelper.java new file mode 100644 index 000000000..d14db507f --- /dev/null +++ b/src/main/java/com/gmail/nossr50/commands/CommandHelper.java @@ -0,0 +1,138 @@ +package com.gmail.nossr50.commands; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Skills; + +public class CommandHelper { + + /** + * Checks for command permissions. + * + * @param sender The command sender + * @param permission The permission to check + * @return true if the sender is a player without permissions, false otherwise + */ + public static boolean noCommandPermissions(CommandSender sender, String permission) { + if (sender instanceof Player) { + Player player = (Player) sender; + + if (player != null && !mcPermissions.getInstance().permission(player, permission)) { + player.sendMessage(mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + } + + return false; + } + + /** + * Print out details on Gathering skills. Only for online players. + * + * @param inspect The player to retrieve stats for + * @param display The sender to display stats to + * @param online true if the player to retrieve stats for is online, false otherwise + */ + public static void printGatheringSkills(Player inspect, CommandSender display) { + if (Skills.hasGatheringSkills(inspect)) { + PlayerProfile PP = Users.getProfile(inspect); + + display.sendMessage(mcLocale.getString("Stats.GatheringHeader")); + + if (mcPermissions.getInstance().excavation(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) })); + } + + if (mcPermissions.getInstance().fishing(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) })); + } + + if (mcPermissions.getInstance().herbalism(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) })); + } + + if (mcPermissions.getInstance().mining(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) })); + } + + if (mcPermissions.getInstance().woodcutting(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) })); + } + } + } + + public static void printGatheringSkills(Player player) { + printGatheringSkills(player, player); + } + + /** + * Print out details on Combat skills. Only for online players. + * + * @param inspect The player to retrieve stats for + * @param display The sender to display stats to + * @param online true if the player to retrieve stats for is online, false otherwise + */ + public static void printCombatSkills(Player inspect, CommandSender display) { + if (Skills.hasCombatSkills(inspect)) { + PlayerProfile PP = Users.getProfile(inspect); + + display.sendMessage(mcLocale.getString("Stats.CombatHeader")); + + if (mcPermissions.getInstance().axes(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) })); + } + + if (mcPermissions.getInstance().archery(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) })); + } + + if (mcPermissions.getInstance().swords(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) })); + } + + if (mcPermissions.getInstance().taming(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) })); + } + + if (mcPermissions.getInstance().unarmed(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) })); + } + } + } + + public static void printCombatSkills(Player player) { + printCombatSkills(player, player); + } + + /** + * Print out details on Misc skills. Only for online players. + * + * @param inspect The player to retrieve stats for + * @param display The sender to display stats to + * @param online true if the player to retrieve stats for is online, false otherwise + */ + public static void printMiscSkills(Player inspect, CommandSender display) { + if (Skills.hasMiscSkills(inspect)) { + PlayerProfile PP = Users.getProfile(inspect); + display.sendMessage(mcLocale.getString("Stats.MiscHeader")); + + if (mcPermissions.getInstance().acrobatics(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) })); + } + + if (mcPermissions.getInstance().repair(inspect)) { + display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) })); + } + } + } + + public static void printMiscSkills(Player player) { + printMiscSkills(player, player); + } +} diff --git a/src/main/java/com/gmail/nossr50/commands/general/AddlevelsCommand.java b/src/main/java/com/gmail/nossr50/commands/general/AddlevelsCommand.java index c5015889f..1102cc6df 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/AddlevelsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/AddlevelsCommand.java @@ -9,9 +9,8 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.datatypes.SkillType; -import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.skills.Skills; public class AddlevelsCommand implements CommandExecutor{ @@ -23,19 +22,14 @@ public class AddlevelsCommand implements CommandExecutor{ @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - Player sendingPlayer; Player modifiedPlayer; int levels; SkillType skill; String skillName; + String usage = ChatColor.RED + "Proper usage is /addlevels "; //TODO: Needs more locale. - if (sender instanceof Player) { - sendingPlayer = (Player) sender; - - if (sendingPlayer != null && !mcPermissions.getInstance().mmoedit(sendingPlayer)) { - sendingPlayer.sendMessage(mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } + if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) { + return true; } switch (args.length) { @@ -58,7 +52,7 @@ public class AddlevelsCommand implements CommandExecutor{ } } else { - System.out.println("Usage is /addlevels playername skillname levels"); //TODO: Needs more locale. + sender.sendMessage(usage); } return true; @@ -70,36 +64,27 @@ public class AddlevelsCommand implements CommandExecutor{ if (modifiedPlayer != null && m.isInt(args[2]) && Skills.isSkill(args[1])) { levels = Integer.valueOf(args[2]); skill = Skills.getSkillType(args[1]); - - if (skill.equals(SkillType.ALL)) { - skillName = "all skills"; - } - else { - skillName = m.getCapitalized(skill.toString()); - } + String message; Users.getProfile(modifiedPlayer).addLevels(skill, levels); - if (sender instanceof Player) { - sender.sendMessage(ChatColor.RED + skillName + " has been modified for " + playerName + "."); //TODO: Use locale + if (skill.equals(SkillType.ALL)) { + skillName = "all skills"; + message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale } else { - System.out.println(skillName + " has been modified for " + playerName + "."); //TODO: Use locale + skillName = m.getCapitalized(skill.toString()); + message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale } + sender.sendMessage(message); modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + levels + " levels in " + skillName + "!"); //TODO: Needs more locale. } return true; default: - if (sender instanceof Player) { - sender.sendMessage(ChatColor.RED + "Usage is /addlevels playername skillname levels"); //TODO: Needs more locale. - } - else { - System.out.println("Usage is /addlevels playername skillname levels"); //TODO: Needs more locale. - } - + sender.sendMessage(usage); return true; } } diff --git a/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java b/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java index 7928ad807..b9d38df32 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java @@ -9,9 +9,8 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.datatypes.SkillType; -import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.skills.Skills; public class AddxpCommand implements CommandExecutor { @@ -23,19 +22,14 @@ public class AddxpCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - Player sendingPlayer; Player modifiedPlayer; int xp; SkillType skill; String skillName; + String usage = ChatColor.RED + "Proper usage is /addxp "; //TODO: Needs more locale. - if (sender instanceof Player) { - sendingPlayer = (Player) sender; - - if (sendingPlayer != null && !mcPermissions.getInstance().mmoedit(sendingPlayer)) { - sendingPlayer.sendMessage(mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } + if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) { + return true; } switch (args.length) { @@ -66,7 +60,7 @@ public class AddxpCommand implements CommandExecutor { } } else { - System.out.println("Usage is /addxp playername skillname xp"); //TODO: Needs more locale. + sender.sendMessage(usage); } return true; @@ -78,23 +72,20 @@ public class AddxpCommand implements CommandExecutor { if (modifiedPlayer != null && m.isInt(args[2]) && Skills.isSkill(args[1])) { xp = Integer.valueOf(args[2]); skill = Skills.getSkillType(args[1]); + String message; Users.getProfile(modifiedPlayer).addXPOverride(skill, xp); if (skill.equals(SkillType.ALL)) { skillName = "all skills"; + message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale } else { skillName = m.getCapitalized(skill.toString()); + message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale } - if (sender instanceof Player) { - sender.sendMessage(ChatColor.RED + skillName + " has been modified for " + playerName + "."); //TODO: Use locale - } - else { - System.out.println(skillName + " has been modified for " + playerName + "."); //TODO: Use locale - } - + sender.sendMessage(message); modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale. if (skill.equals(SkillType.ALL)) { @@ -108,13 +99,7 @@ public class AddxpCommand implements CommandExecutor { return true; default: - if (sender instanceof Player) { - sender.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp"); //TODO: Needs more locale. - } - else { - System.out.println("Usage is /addxp playername skillname xp"); //TODO: Needs more locale. - } - + sender.sendMessage(usage); return true; } } diff --git a/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java b/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java index df448236b..d33cc6578 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.commands.general; -import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -9,11 +8,10 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; -import com.gmail.nossr50.skills.Skills; public class InspectCommand implements CommandExecutor { private final mcMMO plugin; @@ -24,103 +22,69 @@ public class InspectCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + Player target; + PlayerProfile PP; + String usage = "Proper usage is /inspect "; //TODO: Needs more locale. - Player player = null; - if (sender instanceof Player) { - player = (Player) sender; - } - - if (sender instanceof Player && !mcPermissions.getInstance().inspect(player)) { - sender.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) { return true; } - - if (args.length < 1) { - sender.sendMessage(ChatColor.RED + "Proper usage is /inspect "); //TODO: Needs more locale. + + switch (args.length) { + case 1: + target = plugin.getServer().getPlayer(args[0]); + + if (target != null) { + PP = Users.getProfile(target); + + if (sender instanceof Player && !sender.isOp() && !m.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0)) { + sender.sendMessage(mcLocale.getString("Inspect.TooFar")); + return true; + } + + sender.sendMessage(mcLocale.getString("Inspect.Stats", new Object[] { target.getName() })); + CommandHelper.printGatheringSkills(target, sender); + CommandHelper.printCombatSkills(target, sender); + CommandHelper.printMiscSkills(target, sender); + sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel", new Object[] { PP.getPowerLevel() })); + } + else { + PP = Users.getOfflineProfile(args[0]); + + if (sender instanceof Player && !sender.isOp()) { + sender.sendMessage(mcLocale.getString("Inspect.Offline")); + return true; + } + + if (!PP.isLoaded()) { + sender.sendMessage(mcLocale.getString("Inspect.DoesNotExist")); + return true; + } + + sender.sendMessage(mcLocale.getString("Inspect.OfflineStats", new Object[] { args[0] })); + + sender.sendMessage(mcLocale.getString("Stats.GatheringHeader")); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) })); + + sender.sendMessage(mcLocale.getString("Stats.CombatHeader")); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) })); + + sender.sendMessage(mcLocale.getString("Stats.MiscHeader")); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) })); + sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) })); + } + + default: + sender.sendMessage(usage); return true; } - - // if split[1] is an online player - if (plugin.getServer().getPlayer(args[0]) != null) - { - Player target = plugin.getServer().getPlayer(args[0]); - PlayerProfile PPt = Users.getProfile(target); - - //If they are not an Op they have to be close - if(sender instanceof Player && !player.isOp() && !m.isNear(player.getLocation(), target.getLocation(), 5.0)) - { - sender.sendMessage("You are too far away to inspect that player!"); //TODO: Needs more locale. - } - - sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for " + ChatColor.YELLOW + target.getName()); //TODO: Needs more locale. - - sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-"); //TODO: Needs more locale. - if (mcPermissions.getInstance().excavation(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION))); - if (mcPermissions.getInstance().fishing(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING))); - if (mcPermissions.getInstance().herbalism(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM))); - if (mcPermissions.getInstance().mining(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING))); - if (mcPermissions.getInstance().woodcutting(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING))); - - sender.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-"); //TODO: Needs more locale. - if (mcPermissions.getInstance().axes(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES))); - if (mcPermissions.getInstance().archery(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY))); - if (mcPermissions.getInstance().swords(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS))); - if (mcPermissions.getInstance().taming(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING))); - if (mcPermissions.getInstance().unarmed(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED))); - - sender.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-"); //TODO: Needs more locale. - if (mcPermissions.getInstance().acrobatics(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS))); - if (mcPermissions.getInstance().repair(target)) - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR))); - - sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (PPt.getPowerLevel())); - } else { - if(sender instanceof Player && !player.isOp()) - { - sender.sendMessage("That player is offline, inspecting offline players is limited to Ops!"); //TODO: Needs more locale. - return true; - } - - PlayerProfile PPt = Users.getOfflineProfile(args[0]); - - if(!PPt.isLoaded()) - { - sender.sendMessage("Player does not exist in the database!"); //TODO: Needs more locale. - return true; - } - - sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for Offline Player " + ChatColor.YELLOW + args[0]); //TODO: Needs more locale. - - sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-"); //TODO: Needs more locale. - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING))); - - sender.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-"); //TODO: Needs more locale. - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED))); - - sender.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-"); //TODO: Needs more locale. - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS))); - sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR))); - } - - return true; } } diff --git a/src/main/java/com/gmail/nossr50/mcPermissions.java b/src/main/java/com/gmail/nossr50/mcPermissions.java index c23a699f9..12f295936 100644 --- a/src/main/java/com/gmail/nossr50/mcPermissions.java +++ b/src/main/java/com/gmail/nossr50/mcPermissions.java @@ -30,7 +30,7 @@ public class mcPermissions { } public boolean arcaneBypass(Player player) { - return player.hasPermission(("mcmmo.repair.arcanebypass")); + return player.hasPermission(("mcmmo.bypass.arcanebypass")); } /* diff --git a/src/main/resources/locale/locale_en_us.properties b/src/main/resources/locale/locale_en_us.properties index a1e622ead..2a69c04c6 100644 --- a/src/main/resources/locale/locale_en_us.properties +++ b/src/main/resources/locale/locale_en_us.properties @@ -229,7 +229,7 @@ mcPlayerListener.AdminChatOn=Admin Chat only [[GREEN]]On mcPlayerListener.AdminChatOff=Admin Chat only [[RED]]Off mcPlayerListener.MOTD=[[BLUE]]This server is running mcMMO {0} type [[YELLOW]]/{1}[[BLUE]] for help. mcPlayerListener.WIKI=[[GREEN]]http://mcmmo.wikia.com[[BLUE]] - mcMMO Wiki -mcPlayerListener.PowerLevel=[[DARK_RED]]POWER LEVEL: +mcPlayerListener.PowerLevel=[[DARK_RED]]POWER LEVEL: [[GREEN]]{0} mcPlayerListener.PowerLevelLeaderboard=[[YELLOW]]--mcMMO[[BLUE]] Power Level [[YELLOW]]Leaderboard-- mcPlayerListener.SkillLeaderboard=[[YELLOW]]--mcMMO [[BLUE]]{0}[[YELLOW]] Leaderboard-- mcPlayerListener.RepairSkill=Repair: @@ -430,4 +430,13 @@ BlastMining.Boom = [[GRAY]]**BOOM** Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions) m.EffectsTaming7_1=Summon an animal to your side m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones/Fish in hand -m.EffectsTaming1_1=Bone-whacking inspects wolves/ocelots \ No newline at end of file +m.EffectsTaming1_1=Bone-whacking inspects wolves/ocelots +m.SkillStats=[[YELLOW]]{0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]] +Inspect.TooFar=[[RED]]You are too far away to inspect that player! +Inspect.Offline = [[RED]]That player is offline, inspecting offline players is limited to Ops! +Inspect.DoesNotExist = [[RED]]Player does not exist in the database! +Inspect.Stats=[[GREEN]]mcMMO Stats for [[YELLOW]]{0} +Inspect.OfflineStats=mcMMO Stats for Offline Player [[YELLOW]]{0} +Stats.GatheringHeader=[[GOLD]]-=GATHERING SKILLS=- +Stats.CombatHeader=[[GOLD]]-=COMBAT SKILLS=- +Stats.MiscHeader=[[GOLD]]-=MISC SKILLS=- \ No newline at end of file