use of com.sk89q.worldguard.util.report.ApplicableRegionsReport in project WorldGuard by EngineHub.
the class WorldGuardCommands method report.
@Command(aliases = { "report" }, desc = "Writes a report on WorldGuard", flags = "p", max = 0)
@CommandPermissions({ "worldguard.report" })
public void report(CommandContext args, final Actor sender) throws CommandException, AuthorizationException {
ReportList report = new ReportList("Report");
worldGuard.getPlatform().addPlatformReports(report);
report.add(new SystemInfoReport());
report.add(new ConfigReport());
if (sender instanceof LocalPlayer) {
report.add(new ApplicableRegionsReport((LocalPlayer) sender));
}
String result = report.toString();
try {
File dest = new File(worldGuard.getPlatform().getConfigDir().toFile(), "report.txt");
Files.write(result, dest, StandardCharsets.UTF_8);
sender.print("WorldGuard report written to " + dest.getAbsolutePath());
} catch (IOException e) {
throw new CommandException("Failed to write report: " + e.getMessage());
}
if (args.hasFlag('p')) {
sender.checkPermission("worldguard.report.pastebin");
ActorCallbackPaste.pastebin(worldGuard.getSupervisor(), sender, result, "WorldGuard report: %s.report");
}
}
Aggregations