modifiers = "status",
min = 1,
max = 1)
@CommandPermissions("quester.use.quests.status")
public static void viewCurrentQuestStatus(CommandContext args, Player player, HumanNPC npc) {
PlayerProfile profile = PlayerProfile.getProfile(player.getName());
if (!profile.hasQuest()) {
player.sendMessage(ChatColor.GRAY + "You don't have a quest at the moment.");
} else {
player.sendMessage(ChatColor.GREEN
+ "Currently in the middle of "
+ StringUtils.wrap(profile.getProgress().getQuestName())
+ ". You have been on this quest for "
+ StringUtils.wrap(TimeUnit.MINUTES.convert(System.currentTimeMillis()
- profile.getProgress().getStartTime(), TimeUnit.MILLISECONDS)) + " minutes.");
if (profile.getProgress().isFullyCompleted()) {
player.sendMessage(ChatColor.AQUA + "Quest is completed.");
} else {
player.sendMessage(ChatColor.GREEN + "-" + ChatColor.AQUA + " Progress report " + ChatColor.GREEN + "-");
boolean override = QuestManager.getQuest(profile.getQuest()).sendProgressText(player);
for (ObjectiveProgress progress : profile.getProgress().getProgress()) {
if (progress == null)
continue;
try {
String progressText = progress.getStatusText(override);
if (!progressText.isEmpty())
Messaging.send(player, StringUtils.wrap(" - ", ChatColor.WHITE) + progressText);
} catch (QuestCancelException ex) {
player.sendMessage(ChatColor.GRAY + "Cancelling quest. Reason: " + ex.getReason());
profile.setProgress(null);
}
}
}
}
}