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;
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
|
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
2012-04-27 11:47:11 +02:00
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
2013-02-19 06:56:25 +01:00
|
|
|
import com.gmail.nossr50.util.Permissions;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
|
|
|
import com.gmail.nossr50.util.player.UserManager;
|
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) {
|
2012-04-03 21:26:19 +02:00
|
|
|
switch (args.length) {
|
2013-03-01 06:52:01 +01:00
|
|
|
case 1:
|
|
|
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
|
2012-04-03 21:26:19 +02:00
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
|
|
|
if (mcMMOPlayer == null) {
|
2013-03-12 21:25:42 +01:00
|
|
|
PlayerProfile profile = new PlayerProfile(args[0], false); // Temporary Profile
|
2012-04-04 16:34:35 +02:00
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (CommandUtils.inspectOffline(sender, profile, Permissions.inspectOffline(sender))) {
|
2013-02-04 22:43:37 +01:00
|
|
|
return true;
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", args[0]));
|
|
|
|
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
2013-03-12 21:25:42 +01:00
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.EXCAVATION);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.FISHING);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.HERBALISM);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.MINING);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.WOODCUTTING);
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
2013-03-12 21:25:42 +01:00
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.AXES);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.ARCHERY);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.SWORDS);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.TAMING);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.UNARMED);
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
2013-03-12 21:25:42 +01:00
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.ACROBATICS);
|
|
|
|
CommandUtils.displaySkill(sender, profile, SkillType.REPAIR);
|
2013-02-04 22:43:37 +01:00
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
else {
|
|
|
|
Player target = mcMMOPlayer.getPlayer();
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
|
|
|
return true;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
|
2013-03-12 21:25:42 +01:00
|
|
|
CommandUtils.printGatheringSkills(target, sender);
|
|
|
|
CommandUtils.printCombatSkills(target, sender);
|
|
|
|
CommandUtils.printMiscSkills(target, sender);
|
2013-03-01 06:52:01 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
|
|
|
|
}
|
2012-04-27 11:47:11 +02:00
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
return true;
|
2012-04-03 22:13:16 +02:00
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
default:
|
|
|
|
return false;
|
2012-04-03 21:26:19 +02:00
|
|
|
}
|
2012-02-29 18:20:58 +01:00
|
|
|
}
|
|
|
|
}
|