@Command(aliases = {"report"}, desc = "Writes a report on CraftBook", flags = "pi", max = 0)
@CommandPermissions({"craftbook.report"})
public void report(CommandContext args, final CommandSender sender) throws CommandPermissionsException {
File dest = new File(CraftBookPlugin.inst().getDataFolder(), "report.txt");
ReportWriter report = new ReportWriter(CraftBookPlugin.inst());
if(args.hasFlag('i'))
report.appendFlags("i");
report.generate();
try {
report.write(dest);
sender.sendMessage(ChatColor.YELLOW + "CraftBook report written to "
+ dest.getAbsolutePath());
} catch (IOException e) {
throw new CommandException("Failed to write report: " + e.getMessage());
}
if (args.hasFlag('p')) {
CraftBookPlugin.inst().checkPermission(sender, "craftbook.report.pastebin");
sender.sendMessage(ChatColor.YELLOW + "Now uploading to Pastebin...");
PastebinPoster.paste(report.toString(), new PasteCallback() {
@Override
public void handleSuccess(String url) {
// Hope we don't have a thread safety issue here
sender.sendMessage(ChatColor.YELLOW + "CraftBook report (1 hour): " + url);