2013-02-01 19:41:26 +01:00
|
|
|
package com.gmail.nossr50.commands.player;
|
2012-02-29 18:20:58 +01:00
|
|
|
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2012-04-03 21:26:19 +02:00
|
|
|
import com.gmail.nossr50.commands.CommandHelper;
|
2012-07-07 19:39:22 +02:00
|
|
|
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
2012-02-29 18:20:58 +01:00
|
|
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
2012-04-27 11:47:11 +02:00
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
2013-01-30 17:53:51 +01:00
|
|
|
import com.gmail.nossr50.skills.utilities.SkillType;
|
2012-04-27 11:47:11 +02:00
|
|
|
import com.gmail.nossr50.util.Misc;
|
|
|
|
import com.gmail.nossr50.util.Permissions;
|
|
|
|
import com.gmail.nossr50.util.Users;
|
2012-02-29 18:20:58 +01:00
|
|
|
|
|
|
|
public class InspectCommand implements CommandExecutor {
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
2013-02-02 08:55:49 +01:00
|
|
|
String usage = LocaleLoader.getString("Commands.Usage.1", "inspect", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">");
|
2012-02-29 18:20:58 +01:00
|
|
|
|
2012-04-03 21:26:19 +02:00
|
|
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
|
2012-02-29 18:20:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
2012-04-03 21:26:19 +02:00
|
|
|
|
|
|
|
switch (args.length) {
|
|
|
|
case 1:
|
2012-07-07 19:39:22 +02:00
|
|
|
McMMOPlayer mcmmoPlayer = Users.getPlayer(args[0]);
|
2012-04-03 21:26:19 +02:00
|
|
|
|
2012-07-07 19:39:22 +02:00
|
|
|
if (mcmmoPlayer != null) {
|
2012-07-09 16:43:16 +02:00
|
|
|
Player target = mcmmoPlayer.getPlayer();
|
2012-04-03 21:26:19 +02:00
|
|
|
|
2013-01-31 15:00:17 +01:00
|
|
|
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.inspectFar((Player) sender)) {
|
2012-04-27 11:47:11 +02:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
2012-04-03 21:26:19 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-02-01 10:18:57 +01:00
|
|
|
PlayerProfile profile = mcmmoPlayer.getProfile();
|
|
|
|
|
2013-02-02 08:55:49 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
|
2013-02-01 10:18:57 +01:00
|
|
|
CommandHelper.printGatheringSkills(target, profile, sender);
|
|
|
|
CommandHelper.printCombatSkills(target, profile, sender);
|
|
|
|
CommandHelper.printMiscSkills(target, profile, sender);
|
2013-02-02 08:55:49 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcmmoPlayer.getPowerLevel()));
|
2012-04-04 16:34:35 +02:00
|
|
|
|
|
|
|
return true;
|
2012-02-29 21:33:33 +01:00
|
|
|
}
|
2012-04-03 21:26:19 +02:00
|
|
|
|
2013-01-31 15:00:17 +01:00
|
|
|
if (sender instanceof Player && !Permissions.inspectOffline((Player) sender)) {
|
2013-01-10 04:43:21 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
|
|
|
return true;
|
|
|
|
}
|
2012-07-06 07:13:52 +02:00
|
|
|
|
2013-01-10 04:43:21 +01:00
|
|
|
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
|
2012-04-03 21:26:19 +02:00
|
|
|
|
2013-01-10 04:43:21 +01:00
|
|
|
if (!profile.isLoaded()) {
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
|
|
|
return true;
|
|
|
|
}
|
2012-04-27 11:47:11 +02:00
|
|
|
|
2013-02-02 08:55:49 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", args[0]));
|
2012-04-27 11:47:11 +02:00
|
|
|
|
2013-01-10 04:43:21 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
2013-02-02 08:55:49 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING)));
|
2012-04-27 11:47:11 +02:00
|
|
|
|
2013-01-10 04:43:21 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
2013-02-02 08:55:49 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED)));
|
2012-02-29 18:20:58 +01:00
|
|
|
|
2013-01-10 04:43:21 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
2013-02-02 08:55:49 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS)));
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR)));
|
2013-01-10 04:43:21 +01:00
|
|
|
|
|
|
|
return true;
|
2012-04-03 22:13:16 +02:00
|
|
|
|
2012-04-03 21:26:19 +02:00
|
|
|
default:
|
|
|
|
sender.sendMessage(usage);
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-29 18:20:58 +01:00
|
|
|
}
|
|
|
|
}
|