Search in sources :

Example 1 with TableGenerator

use of mc.dragons.core.util.TableGenerator in project DragonsOnline by UniverseCraft.

the class ReportsCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!requirePermission(sender, SystemProfileFlag.MODERATION))
        return true;
    if (args.length == 0) {
        sender.sendMessage(ChatColor.RED + "/reports <all|all-open|escalation|chat|internal|regular|hold|watchlist|by <player>|on <player>> [-page <#>]");
        sender.sendMessage(ChatColor.GRAY + "Note: Moderators can only use /reports <watchlist|by|on>");
        return true;
    }
    int pageFlagIndex = StringUtil.getFlagIndex(args, "-page", 0);
    Integer page = 1;
    if (pageFlagIndex != -1) {
        page = parseInt(sender, args[++pageFlagIndex]);
        if (page == null)
            return true;
    }
    SystemProfileFlag req = SystemProfileFlag.APPEALS_TEAM;
    PaginatedResult<Report> results = null;
    if (args[0].equalsIgnoreCase("all-open")) {
        results = reportLoader.getReportsByStatus(ReportStatus.OPEN, page);
    } else if (args[0].equalsIgnoreCase("all")) {
        results = reportLoader.getAllReports(page);
    } else if (args[0].equalsIgnoreCase("escalation")) {
        results = reportLoader.getReportsByType(ReportType.STAFF_ESCALATION, page);
    } else if (args[0].equalsIgnoreCase("chat")) {
        results = reportLoader.getReportsByType(ReportType.CHAT, page);
    } else if (args[0].equalsIgnoreCase("internal")) {
        results = reportLoader.getReportsByType(ReportType.AUTOMATED, page);
    } else if (args[0].equalsIgnoreCase("regular")) {
        results = reportLoader.getReportsByType(ReportType.REGULAR, page);
    } else if (args[0].equalsIgnoreCase("hold")) {
        results = reportLoader.getReportsByType(ReportType.HOLD, page);
    } else if (args[0].equalsIgnoreCase("watchlist")) {
        req = SystemProfileFlag.MODERATION;
        results = reportLoader.getReportsByTypeAndStatus(ReportType.WATCHLIST, ReportStatus.OPEN, page);
    } else if (args[0].equalsIgnoreCase("by")) {
        if (args.length == 1) {
            sender.sendMessage(ChatColor.RED + "/reports by <player>");
            return true;
        }
        User filter = lookupUser(sender, args[1]);
        if (filter == null)
            return true;
        results = reportLoader.getReportsByFiler(filter, page);
    } else if (args[0].equalsIgnoreCase("on")) {
        req = SystemProfileFlag.MODERATION;
        if (args.length == 1) {
            sender.sendMessage(ChatColor.RED + "/reports on <player>");
            return true;
        }
        User filter = lookupUser(sender, args[1]);
        if (filter == null)
            return true;
        if (filter.equals(user(sender)) && !hasPermission(sender, PermissionLevel.ADMIN)) {
            sender.sendMessage(ChatColor.RED + "You cannot look up reports on yourself!");
            return true;
        }
        results = reportLoader.getReportsByTarget(filter, page);
    } else {
        sender.sendMessage(ChatColor.RED + "Invalid usage!");
        return true;
    }
    if (!hasPermission(sender, PermissionLevel.ADMIN) && !requirePermission(sender, req))
        return true;
    if (results.getTotal() == 0) {
        sender.sendMessage(ChatColor.RED + "No results returned for this query!");
        return true;
    }
    TableGenerator tg = new TableGenerator(Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT);
    tg.addRow(COL_ID, COL_TARGET, COL_PREVIEW, COL_TYPE, COL_STATUS, COL_FILER);
    String idPrefix = ChatColor.AQUA + "";
    String dataPrefix = ChatColor.GRAY + "";
    for (Report report : results.getPage()) {
        String targets = report.getTargets().get(0).getName();
        if (report.getTargets().size() > 1) {
            targets += " +" + (report.getTargets().size() - 1);
        }
        String by = "";
        if (report.getFiledBy().size() > 0) {
            by = report.getFiledBy().get(0).getName();
        }
        if (report.getFiledBy().size() > 1) {
            by += " +" + (report.getFiledBy().size() - 1);
        }
        tg.addRowEx("/viewreport " + report.getId(), ChatColor.GRAY + "Click to view report #" + report.getId(), idPrefix + "#" + report.getId(), dataPrefix + targets, dataPrefix + StringUtil.truncateWithEllipsis(report.getPreview(), 30), dataPrefix + report.getType(), dataPrefix + report.getStatus(), dataPrefix + by);
    }
    sender.sendMessage(ChatColor.GREEN + "Page " + page + " of " + results.getPages() + " (" + results.getTotal() + " results)");
    tg.display(sender);
    return true;
}
Also used : SystemProfileFlag(mc.dragons.core.gameobject.user.permission.SystemProfile.SystemProfileFlags.SystemProfileFlag) User(mc.dragons.core.gameobject.user.User) Report(mc.dragons.tools.moderation.report.ReportLoader.Report) TableGenerator(mc.dragons.core.util.TableGenerator)

Example 2 with TableGenerator

use of mc.dragons.core.util.TableGenerator in project DragonsOnline by UniverseCraft.

the class ViewReportCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!requirePermission(sender, SystemProfileFlag.HELPER))
        return true;
    if (args.length == 0) {
        sender.sendMessage(ChatColor.RED + "/viewreport <ID>");
        return true;
    }
    Integer id = parseInt(sender, args[0]);
    if (id == null)
        return true;
    Report report = reportLoader.getReportById(id);
    if (report == null) {
        sender.sendMessage(ChatColor.RED + "No report with ID " + args[0] + " was found!");
        return true;
    }
    PermissionLevel req = report.getType() == ReportType.CHAT ? PermissionLevel.HELPER : PermissionLevel.MODERATOR;
    if (report.getData().containsKey("permissionReq")) {
        req = PermissionLevel.valueOf(report.getData().getString("permissionReq"));
    }
    boolean canEdit = hasPermission(sender, req) && (hasPermission(sender, PermissionLevel.ADMIN) || !report.getTargets().contains(user(sender)));
    boolean closed = report.getStatus() != ReportStatus.OPEN;
    // Helpers can only view open chat reports, or chat reports that they've reviewed
    // Moderators can only view open reports, or reports that they've reviewed
    // Appeals team and admins can view all reports
    boolean canView = hasPermission(sender, SystemProfileFlag.APPEALS_TEAM) || hasPermission(sender, PermissionLevel.ADMIN) || hasPermission(sender, SystemProfileFlag.MODERATION) && (!closed || report.getReviewedBy().equals(user(sender))) || hasPermission(sender, SystemProfileFlag.HELPER) && report.getType() == ReportType.CHAT && (!closed || report.getReviewedBy().equals(user(sender)));
    TextComponent nextReport = StringUtil.clickableHoverableText(ChatColor.GRAY + " [Next Report]", "/modqueue", "Click to handle next report in queue");
    if (!canView) {
        sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to view this report! (#" + report.getId() + ")");
        sender.spigot().sendMessage(nextReport);
        return true;
    }
    if (args.length == 1) {
        sender.sendMessage(ChatColor.DARK_GREEN + "Report #" + report.getId() + ": " + report.getType() + "/" + report.getStatus());
        TextComponent snapshots = null;
        if (report.getData().containsKey("states") && report.getData().getList("states", String.class).size() > 0) {
            snapshots = StringUtil.clickableHoverableText(ChatColor.AQUA + "[User Snapshots]", "/viewreport " + id + " snapshots", "Click to view snapshots of the reported player(s)");
        }
        if (canEdit) {
            if (closed) {
                sender.spigot().sendMessage(StringUtil.clickableHoverableText(ChatColor.YELLOW + "[Re-Open] ", "/viewreport " + id + " status OPEN", "Re-open this report for further action or review"), snapshots == null ? StringUtil.plainText("") : snapshots);
            } else {
                TextComponent confirm = StringUtil.clickableHoverableText(ChatColor.GREEN + "[Confirm] ", "/viewreport " + id + " confirm", "Confirm report and apply punishment(s)", "Closes the report");
                TextComponent insufficient = StringUtil.clickableHoverableText(ChatColor.YELLOW + "[Insufficient] ", "/viewreport " + id + " insufficient", "Insufficient evidence to confirm report", "Closes the report");
                TextComponent watchlist = report.getType() == ReportType.WATCHLIST ? StringUtil.plainText("") : StringUtil.clickableHoverableText(ChatColor.YELLOW + "[Watchlist] ", "/viewreport " + id + " watch", "Insufficient evidence to confirm report, but high suspicion", "Closes the report and places the user on a watchlist for further monitoring");
                TextComponent escalate = StringUtil.clickableHoverableText(ChatColor.GOLD + "[Escalate] ", "/viewreport " + id + " escalate", "Escalate report for review by a senior staff member", "Does not close the report");
                TextComponent duplicate = StringUtil.clickableHoverableText(ChatColor.GRAY + "[Duplicated] ", "/viewreport " + id + " duplicate", "This report is a duplicate of another report", "Closes the report");
                TextComponent cancel = report.getStatus() != ReportStatus.OPEN || !report.getFiledBy().contains(user(sender)) ? StringUtil.plainText("") : StringUtil.clickableHoverableText(ChatColor.GRAY + "[Cancel] ", "/viewreport " + id + " cancel", "Cancel this report", "Closes the report");
                TextComponent skip = StringUtil.clickableHoverableText(ChatColor.GRAY + "[Skip] ", "/viewreport " + id + " skip", "Skip this report and go to the next one in the queue", "Does not close the report");
                TextComponent addNote = StringUtil.clickableHoverableText(ChatColor.WHITE + "" + ChatColor.ITALIC + "  [+Add Note]", "/viewreport " + id + " note ", true, "Add a note to this report", "Does not close the report");
                sender.spigot().sendMessage(confirm, insufficient, watchlist, escalate, duplicate, cancel, skip, addNote);
                if (snapshots != null) {
                    sender.spigot().sendMessage(snapshots);
                }
            }
        } else {
            sender.sendMessage(ChatColor.GRAY + "- You do not have sufficient permission to modify this report -");
            if (snapshots != null) {
                sender.spigot().sendMessage(snapshots);
            }
        }
        sender.sendMessage(ChatColor.GRAY + "Filed Against: " + ChatColor.RESET + StringUtil.parseList(report.getTargets().stream().map(u -> u.getName()).collect(Collectors.toList())));
        if (report.getFiledBy() != null) {
            sender.sendMessage(ChatColor.GRAY + "Filed By: " + ChatColor.RESET + StringUtil.parseList(report.getFiledBy().stream().map(u -> u.getName()).collect(Collectors.toList())));
        }
        sender.sendMessage(ChatColor.GRAY + "Filing Date: " + ChatColor.RESET + StringUtil.DATE_FORMAT.format(report.getFiledOn()));
        if (!hasPermission(sender, SystemProfileFlag.DEVELOPMENT)) {
            if (report.getData().containsKey("message")) {
                sender.sendMessage(ChatColor.GRAY + "Message: " + ChatColor.RESET + report.getData().getString("message"));
            } else if (report.getData().containsKey("reason")) {
                sender.sendMessage(ChatColor.GRAY + "Reason: " + ChatColor.RESET + report.getData().getString("reason"));
            }
        }
        if (report.getReviewedBy() != null) {
            sender.sendMessage(ChatColor.GRAY + "Primary Reviewer: " + ChatColor.RESET + report.getReviewedBy().getName());
        } else {
            sender.sendMessage(ChatColor.GRAY + "Unreviewed.");
        }
        if (report.getData().size() > 0 && hasPermission(sender, SystemProfileFlag.DEVELOPMENT)) {
            sender.sendMessage(ChatColor.GRAY + "Internal Data: ");
            for (Entry<String, Object> entry : report.getData().entrySet()) {
                sender.sendMessage(ChatColor.GRAY + "- " + entry.getKey() + ChatColor.GRAY + ": " + ChatColor.RESET + entry.getValue());
            }
        }
        if (report.getNotes().size() > 0) {
            sender.sendMessage(ChatColor.GRAY + "Notes:");
            for (String note : report.getNotes()) {
                sender.sendMessage(ChatColor.GRAY + "- " + ChatColor.RESET + note);
            }
        }
        PaginatedResult<Report> linked = reportLoader.getRecentReportsByTargets(report.getTargets(), report.getFiledOn().toInstant().getEpochSecond(), report.getId(), 1);
        if (linked.getTotal() > 0) {
            sender.spigot().sendMessage(StringUtil.clickableHoverableText(ChatColor.YELLOW + "[Possible Duplicates]", "/viewreport " + report.getId() + " linked", "Click to view possible duplicate reports"));
        }
        return true;
    } else if (args[1].equalsIgnoreCase("linked")) {
        Integer page = 1;
        if (args.length > 2) {
            page = parseInt(sender, args[2]);
            if (page == null)
                return true;
        }
        PaginatedResult<Report> linked = reportLoader.getRecentReportsByTargets(report.getTargets(), report.getFiledOn().toInstant().getEpochSecond(), report.getId(), 1);
        TableGenerator tg = new TableGenerator(Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT);
        tg.addRow(ChatColor.YELLOW + "ID", ChatColor.YELLOW + "Status", ChatColor.YELLOW + "Targets");
        for (Report r : linked.getPage()) {
            String targets = r.getTargets().get(0).getName();
            if (r.getTargets().size() > 1) {
                targets += " +" + (r.getTargets().size() - 1);
            }
            tg.addRowEx("/viewreport " + r.getId(), "Click to view report #" + r.getId(), ChatColor.GRAY + "" + r.getId(), ChatColor.RESET + r.getStatus().toString(), targets);
        }
        tg.display(sender);
    } else if (args[1].equalsIgnoreCase("duplicate")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        report.addNote("Marked as a duplicate by " + sender.getName());
        report.setStatus(ReportStatus.NO_ACTION);
        if (report.getData().containsKey("holdId")) {
            holdLoader.getHoldById(report.getData().getInteger("holdId")).setStatus(HoldStatus.CLOSED_ACTION);
        }
        report.setReviewedBy(user(sender));
        sender.sendMessage(ChatColor.GREEN + "Marked this report as a duplicate.");
        sender.spigot().sendMessage(nextReport);
    } else if (args[1].equalsIgnoreCase("cancel")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        report.addNote("Cancelled by " + sender.getName());
        report.setStatus(ReportStatus.NO_ACTION);
        if (report.getData().containsKey("holdId")) {
            holdLoader.getHoldById(report.getData().getInteger("holdId")).setStatus(HoldStatus.CLOSED_ACTION);
        }
        report.setReviewedBy(user(sender));
        sender.sendMessage(ChatColor.GREEN + "Cancelled this report.");
        sender.spigot().sendMessage(nextReport);
    } else if (args[1].equalsIgnoreCase("skip")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        report.addSkippedBy(user(sender));
        sender.sendMessage(ChatColor.GREEN + "Skipped this report.");
        Bukkit.dispatchCommand(sender, "modqueue");
    } else if (args[1].equalsIgnoreCase("snapshots")) {
        sender.sendMessage(ChatColor.GRAY + "User Snapshots:");
        for (String token : report.getData().getList("states", String.class)) {
            UUID uuid = UUID.fromString(token);
            Document data = stateLoader.getState(uuid);
            if (data == null) {
                sender.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + "Could not load snapshot " + uuid);
                continue;
            }
            sender.spigot().sendMessage(StringUtil.clickableHoverableText(ChatColor.GRAY + "- " + ChatColor.RESET + userLoader.loadObject(UUID.fromString(data.getString("originalUser"))).getName() + ChatColor.GRAY + " (" + data.getString("originalTime") + ")", "/setstate " + uuid, true, "Click to go to this snapshot"));
        }
    } else if (args[1].equalsIgnoreCase("confirm")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed && !report.getReviewedBy().equals(user(sender))) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        if (!closed && report.getData().containsKey("confirmCommand") && !report.getData().getString("confirmCommand").isEmpty()) {
            report.setStatus(ReportStatus.ACTION_TAKEN);
            if (report.getData().containsKey("holdId")) {
                holdLoader.getHoldById(report.getData().getInteger("holdId")).setStatus(HoldStatus.CLOSED_ACTION);
            }
            player(sender).performCommand(report.getData().getString("confirmCommand"));
            sender.sendMessage(ChatColor.GREEN + "Report closed successfully.");
            sender.spigot().sendMessage(nextReport);
        } else {
            sender.sendMessage(ChatColor.DARK_GREEN + "Select a punishment code to apply:");
            for (PunishmentCode code : PunishmentCode.values()) {
                if (code.isHidden())
                    continue;
                sender.spigot().sendMessage(StringUtil.clickableHoverableText(" " + code.getCode() + ChatColor.GRAY + " - " + code.getName(), "/viewreport " + id + " apply " + code.getCode() + " ", true, new String[] { ChatColor.YELLOW + "" + ChatColor.BOLD + code.getName(), ChatColor.GRAY + code.getDescription(), "", ChatColor.DARK_GRAY + "Level " + code.getStandingLevel() + " - " + code.getType() }));
            }
        }
    } else if (args[1].equalsIgnoreCase("escalate")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        report.addNote("Escalated for further action (by " + sender.getName() + ")");
        PermissionLevel permissionReq = null;
        for (PermissionLevel level : PermissionLevel.values()) {
            if (level.ordinal() == user(sender).getActivePermissionLevel().ordinal() + 1) {
                permissionReq = level;
                break;
            }
        }
        if (permissionReq == null) {
            sender.sendMessage(ChatColor.RED + "You don't have anyone to escalate this report to!");
            return true;
        }
        report.getData().append("permissionReq", permissionReq.toString());
        sender.sendMessage(ChatColor.GREEN + "Escalated this report for further action by a senior staff member.");
        sender.spigot().sendMessage(nextReport);
    } else if (args[1].equalsIgnoreCase("insufficient")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        report.addNote("Marked as insufficient evidence (by " + sender.getName() + ")");
        report.setStatus(ReportStatus.NO_ACTION);
        if (report.getData().containsKey("holdId")) {
            holdLoader.getHoldById(report.getData().getInteger("holdId")).setStatus(HoldStatus.CLOSED_NOACTION);
        }
        report.setReviewedBy(user(sender));
        sender.sendMessage(ChatColor.GREEN + "Marked report as insufficient evidence.");
        sender.spigot().sendMessage(nextReport);
    } else if (args[1].equalsIgnoreCase("watch")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        report.addNote("Marked as insufficient evidence and watchlisted (by " + sender.getName() + ")");
        report.setStatus(ReportStatus.NO_ACTION);
        if (report.getData().containsKey("holdId")) {
            holdLoader.getHoldById(report.getData().getInteger("holdId")).setStatus(HoldStatus.CLOSED_NOACTION);
        }
        report.setReviewedBy(user(sender));
        for (User target : report.getTargets()) {
            reportLoader.fileWatchlistReport(target, user(sender), "Moved to watchlist from report #" + report.getId());
        }
        sender.sendMessage(ChatColor.GREEN + "Marked report as insufficient evidence and placed users on the watchlist.");
        sender.spigot().sendMessage(nextReport);
    } else if (args[1].equalsIgnoreCase("apply")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed && !report.getReviewedBy().equals(user(sender))) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        PunishmentCode code = PunishmentCode.parseCode(sender, args[2]);
        if (code == null)
            return true;
        String extraInfo = StringUtil.concatArgs(args, 3);
        sender.sendMessage(ChatColor.GREEN + "This report has been marked as closed. The following actions were taken:");
        for (User target : report.getTargets()) {
            AppliedPunishmentData result = WrappedUser.of(target).autoPunish(code, "Report #" + report.getId() + (extraInfo.isBlank() ? "" : " - " + extraInfo), user(sender));
            sender.sendMessage(ChatColor.GRAY + "- " + result.type + " applied to " + target.getName() + " (" + StringUtil.parseSecondsToTimespan(result.duration) + ")");
        }
        report.setStatus(ReportStatus.ACTION_TAKEN);
        report.setReviewedBy(user(sender));
        if (report.getData().containsKey("holdId")) {
            int holdId = report.getData().getInteger("holdId");
            holdLoader.getHoldById(holdId).setStatus(HoldStatus.CLOSED_ACTION);
        }
        report.getFiledBy().forEach(u -> WrappedUser.of(u).setReportHandled(true));
        sender.spigot().sendMessage(StringUtil.clickableHoverableText(ChatColor.GRAY + " [+Punishment]", "/viewreport " + report.getId() + " confirm", "Apply another punishment to this report"), nextReport);
    } else if (args[1].equalsIgnoreCase("note")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (closed) {
            sender.sendMessage(ChatColor.RED + "This report is closed!");
            return true;
        }
        if (args.length == 2) {
            sender.sendMessage(ChatColor.RED + "/vrep <ID> note <Note>");
            return true;
        }
        report.addNote(StringUtil.concatArgs(args, 2) + " (by " + sender.getName() + ")");
        sender.sendMessage(ChatColor.GREEN + "Note added successfully.");
        return true;
    } else if (args[1].equalsIgnoreCase("status")) {
        if (!canEdit) {
            sender.sendMessage(ChatColor.RED + "You do not have sufficient permission to edit this report");
            return true;
        }
        if (args.length == 2) {
            sender.sendMessage(ChatColor.RED + "/vrep <ID> status <OPEN|NO_ACTION|ACTION_TAKEN>");
            return true;
        }
        ReportStatus status = StringUtil.parseEnum(sender, ReportStatus.class, args[2]);
        if (status == null)
            return true;
        report.setStatus(status);
        report.addNote("Status set to " + status + " by " + sender.getName());
        if (status != ReportStatus.OPEN) {
            report.setReviewedBy(user(sender));
        }
        if (report.getData().containsKey("holdId")) {
            HoldEntry hold = holdLoader.getHoldById(report.getData().getInteger("holdId"));
            if (status == ReportStatus.NO_ACTION) {
                hold.setStatus(HoldStatus.CLOSED_NOACTION);
            } else if (status == ReportStatus.ACTION_TAKEN) {
                hold.setStatus(HoldStatus.CLOSED_ACTION);
            } else if (status == ReportStatus.OPEN) {
                hold.setStatus(HoldStatus.PENDING);
            }
        }
        sender.sendMessage(ChatColor.GREEN + "Status changed successfully.");
        sender.spigot().sendMessage(nextReport);
        return true;
    }
    return true;
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) User(mc.dragons.core.gameobject.user.User) WrappedUser(mc.dragons.tools.moderation.WrappedUser) Report(mc.dragons.tools.moderation.report.ReportLoader.Report) PaginatedResult(mc.dragons.core.storage.mongo.pagination.PaginatedResult) TableGenerator(mc.dragons.core.util.TableGenerator) PunishmentCode(mc.dragons.tools.moderation.punishment.PunishmentCode) PermissionLevel(mc.dragons.core.gameobject.user.permission.PermissionLevel) Document(org.bson.Document) AppliedPunishmentData(mc.dragons.tools.moderation.WrappedUser.AppliedPunishmentData) HoldEntry(mc.dragons.tools.moderation.hold.HoldLoader.HoldEntry) UUID(java.util.UUID) ReportStatus(mc.dragons.tools.moderation.report.ReportLoader.ReportStatus)

Example 3 with TableGenerator

use of mc.dragons.core.util.TableGenerator in project DragonsOnline by UniverseCraft.

the class PerformanceCommands method onCommand.

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!requirePermission(sender, PermissionLevel.DEVELOPER))
        return true;
    if (label.equalsIgnoreCase("worldperformance")) {
        sender.sendMessage(ChatColor.DARK_GREEN + "World performance statistics for " + dragons.getServerName() + " @ " + StringUtil.dateFormatNow());
        TableGenerator tg = new TableGenerator(Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT);
        tg.addRow(COL_FLOOR, COL_ENTITIES, COL_LIVING, COL_PLAYERS, COL_CHUNKS, COL_POPULATED, COL_RATIO);
        String floorPrefix = ChatColor.YELLOW + "";
        String dataPrefix = ChatColor.GRAY + "";
        for (World w : Bukkit.getWorlds()) {
            long populatedChunks = Arrays.stream(w.getLoadedChunks()).filter(ch -> Arrays.stream(ch.getEntities()).filter(e -> e.getType() == EntityType.PLAYER).count() > 0).count();
            tg.addRowEx("/worldmanager " + w.getName(), "Click to manage performance of " + w.getName(), floorPrefix + w.getName(), dataPrefix + w.getEntities().size(), dataPrefix + w.getLivingEntities().size(), dataPrefix + w.getPlayers().size(), dataPrefix + w.getLoadedChunks().length, dataPrefix + populatedChunks, dataPrefix + MathUtil.round(100 * (double) populatedChunks / w.getLoadedChunks().length) + "%");
        }
        tg.display(sender);
    } else if (label.equalsIgnoreCase("worldmanager")) {
        World w = args.length == 0 ? player(sender).getWorld() : Bukkit.getWorld(args[0]);
        if (w == null) {
            sender.sendMessage(ChatColor.RED + "No world named '" + args[0] + "'");
            return true;
        }
        sender.sendMessage(ChatColor.GREEN + "Manage world " + w.getName());
        sender.spigot().sendMessage(StringUtil.clickableHoverableText(ChatColor.GRAY + " [Manage Floor]", "/floor " + FloorLoader.fromWorld(w).getFloorName(), "Click to manage associated floor"), StringUtil.clickableHoverableText(ChatColor.GRAY + " [Unload Chunks]", "/unloadchunks " + w.getName(), "Click to unload all chunks from this world"), StringUtil.clickableHoverableText(ChatColor.GRAY + " [Reload Chunks]", "/reloadchunks " + w.getName(), "Click to reload all chunks from this world"), StringUtil.clickableHoverableText(ChatColor.GRAY + " [Clear Drops]", "/cleardrops " + w.getName(), "Click to remove all dropped items from this world"), StringUtil.clickableHoverableText(ChatColor.GRAY + " [Clear Mobs]", "/clearmobs " + w.getName(), "Click to remove all non-persistent mobs from this world"));
    } else if (label.equalsIgnoreCase("unloadchunks")) {
        World w = args.length == 0 ? player(sender).getWorld() : Bukkit.getWorld(args[0]);
        if (w == null) {
            sender.sendMessage(ChatColor.RED + "No world named '" + args[0] + "'");
            return true;
        }
        int success = 0;
        int total = 0;
        for (Chunk c : w.getLoadedChunks()) {
            if (c.unload(true))
                success++;
            total++;
        }
        sender.sendMessage(ChatColor.GREEN + "" + success + "/" + total + " chunks unloaded in " + w.getName());
    } else if (label.equalsIgnoreCase("reloadchunks")) {
        World w = args.length == 0 ? player(sender).getWorld() : Bukkit.getWorld(args[0]);
        if (w == null) {
            sender.sendMessage(ChatColor.RED + "No world named '" + args[0] + "'");
            return true;
        }
        int success = 0, total = 0;
        for (Chunk c : w.getLoadedChunks()) {
            if (c.unload(true))
                success++;
            c.load(false);
            total++;
        }
        sender.sendMessage(ChatColor.GREEN + "" + success + "/" + total + " chunks reloaded in " + w.getName());
    } else if (label.equalsIgnoreCase("cleardrops")) {
        World w = args.length == 0 ? player(sender).getWorld() : Bukkit.getWorld(args[0]);
        if (w == null) {
            sender.sendMessage(ChatColor.RED + "No world named '" + args[0] + "'");
            return true;
        }
        int total = 0;
        for (Entity e : w.getEntities()) {
            if (e.getType() == EntityType.DROPPED_ITEM) {
                e.remove();
                total++;
            }
        }
        sender.sendMessage(ChatColor.GREEN + "" + total + " drops cleared in " + w.getName());
    } else if (label.equalsIgnoreCase("clearmobs")) {
        World w = args.length == 0 ? player(sender).getWorld() : Bukkit.getWorld(args[0]);
        if (w == null) {
            sender.sendMessage(ChatColor.RED + "No world named '" + args[0] + "'");
            return true;
        }
        int total = 0;
        for (Entity e : w.getEntities()) {
            if (e instanceof Player || e instanceof Item || e instanceof ItemFrame)
                continue;
            if (e.getPersistentDataContainer().has(Dragons.FIXED_ENTITY_KEY, PersistentDataType.SHORT))
                continue;
            if (e.hasMetadata("allow"))
                continue;
            NPC npc = NPCLoader.fromBukkit(e);
            if (npc == null) {
                e.remove();
                total++;
            } else if (!npc.getNPCType().isPersistent()) {
                npc.remove();
                total++;
            }
        }
        sender.sendMessage(ChatColor.GREEN + "" + total + " mobs cleared in " + w.getName());
    } else if (label.equalsIgnoreCase("getsystemproperties")) {
        sender.sendMessage(ChatColor.GREEN + "Listing all system properties:");
        System.getProperties().forEach((key, value) -> {
            sender.sendMessage(ChatColor.GRAY + "" + key + " = " + value);
        });
    } else if (label.equalsIgnoreCase("serverperformance")) {
        new // some OperatingSystemMXBean operations lag the thread, so run asynchronously
        BukkitRunnable() {

            @Override
            public void run() {
                Properties props = System.getProperties();
                sender.sendMessage(ChatColor.DARK_GREEN + "Server performance statistics generated at " + StringUtil.dateFormatNow());
                sender.sendMessage(ChatColor.GREEN + "Bukkit Version: " + ChatColor.GRAY + Bukkit.getVersion());
                sender.sendMessage(ChatColor.GREEN + "Uptime: " + ChatColor.GRAY + StringUtil.parseSecondsToTimespan(dragons.getUptime() / 1000));
                sender.sendMessage(ChatColor.GREEN + "Estimated Current TPS: " + ChatColor.GRAY + LagMeter.getRoundedTPS());
                sender.sendMessage(ChatColor.GREEN + "Server Architecture: " + ChatColor.GRAY + props.getProperty("os.arch", "Unknown"));
                sender.sendMessage(ChatColor.GREEN + "Operating System: " + ChatColor.GRAY + props.getProperty("os.name", "Unknown") + " v" + props.getProperty("os.version", "Unknown") + " (" + props.getProperty("os.arch", "Unknown Architecture") + ")");
                sender.sendMessage(ChatColor.GREEN + "Java Version: " + ChatColor.GRAY + props.getProperty("java.version", "Unknown") + " (" + props.getProperty("java.vendor", "Unknown Vendor") + ")");
                sender.sendMessage(ChatColor.GREEN + "JVM Version: " + ChatColor.GRAY + props.getProperty("java.vm.name", "Unknown Name") + props.getProperty("java.vm.version", "Unknown") + " (" + props.getProperty("java.vm.vendor", "Unknown Vendor") + ")");
                try {
                    OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
                    sender.sendMessage(ChatColor.GREEN + "Available Processors: " + ChatColor.GRAY + osBean.getAvailableProcessors());
                    sender.sendMessage(ChatColor.GREEN + "Process Committed Virtual Memory: " + ChatColor.GRAY + (osBean.getCommittedVirtualMemorySize() / BYTES_IN_MB) + "MB");
                    // sender.sendMessage(ChatColor.GREEN + "Process Free Physical Memory: " + ChatColor.GRAY + (osBean.getFreePhysicalMemorySize() / BYTES_IN_MB) + "MB");
                    sender.sendMessage(ChatColor.GREEN + "Process CPU Load: " + ChatColor.GRAY + Math.round(100 * osBean.getProcessCpuLoad()) + "%");
                    sender.sendMessage(ChatColor.GREEN + "Process CPU Time: " + ChatColor.GRAY + (osBean.getProcessCpuTime() / NS_IN_MS) + "ms");
                    sender.sendMessage(ChatColor.GREEN + "Free Swap Space: " + ChatColor.GRAY + (osBean.getFreeSwapSpaceSize() / BYTES_IN_MB) + "MB");
                    // sender.sendMessage(ChatColor.GREEN + "Total Physical Memory: " + ChatColor.GRAY + (osBean.getTotalPhysicalMemorySize() / BYTES_IN_MB) + "MB");
                    // sender.sendMessage(ChatColor.GREEN + "System CPU Load: " + ChatColor.GRAY + Math.round(100 * osBean.getSystemCpuLoad()) + "%");
                    sender.sendMessage(ChatColor.GREEN + "System Load Average: " + ChatColor.GRAY + Math.round(100 * osBean.getSystemLoadAverage()) + "%");
                    ThreadMXBean threadBean = ManagementFactory.getPlatformMXBean(ThreadMXBean.class);
                    sender.sendMessage(ChatColor.GREEN + "Thread Count: " + ChatColor.GRAY + threadBean.getThreadCount());
                    sender.sendMessage(ChatColor.GREEN + "Daemon Thread Count: " + ChatColor.GRAY + threadBean.getDaemonThreadCount());
                    sender.sendMessage(ChatColor.GREEN + "Peak Thread Count: " + ChatColor.GRAY + threadBean.getPeakThreadCount());
                } catch (Exception e) {
                    sender.sendMessage(ChatColor.GRAY + "Some server statistics are unavailable for this platform: Unsupported MXBean(s)");
                }
            }
        }.runTaskAsynchronously(dragons);
    } else if (label.equalsIgnoreCase("tickperformance") || label.equalsIgnoreCase("tickperf")) {
        if (args.length == 0) {
            sender.sendMessage(ChatColor.RED + "/tickperformance start <recPeriodInSeconds>");
            sender.sendMessage(ChatColor.RED + "/tickperformance clear");
            sender.sendMessage(ChatColor.RED + "/tickperformance view [-verbose]" + ChatColor.GRAY + " (after data has been collected)");
        } else if (args[0].equalsIgnoreCase("start")) {
            if (args.length == 1) {
                sender.sendMessage(ChatColor.RED + "/tickperformance start <recPeriodInSeconds>");
                return true;
            }
            if (tickTimings.size() > 0) {
                sender.sendMessage(ChatColor.RED + "Please clear existing tick performance data before running this again! /tickperformance clear");
                return true;
            }
            Integer seconds = parseInt(sender, args[1]);
            if (seconds == null)
                return true;
            new BukkitRunnable() {

                long start = System.currentTimeMillis();

                @Override
                public void run() {
                    long now = System.currentTimeMillis();
                    tickTimings.add(now);
                    if ((now - start) / 1000 >= seconds) {
                        sender.sendMessage(ChatColor.GREEN + "Tick timings data collection has completed. Do /tickperformance view to view the data.");
                        cancel();
                    }
                }
            }.runTaskTimer(dragons, 1L, 1L);
            sender.sendMessage(ChatColor.GREEN + "Began tick timings data collection. Server may experience mild lag while this runs.");
        } else if (args[0].equalsIgnoreCase("clear")) {
            tickTimings.clear();
            sender.sendMessage(ChatColor.GREEN + "Cleared tick timings data.");
        } else if (args[0].equalsIgnoreCase("view")) {
            if (tickTimings.size() == 0) {
                sender.sendMessage(ChatColor.RED + "No tick performance data available! To gather data, do /tickperformance start <recPeriodInSeconds>");
                return true;
            }
            sender.sendMessage(ChatColor.DARK_GREEN + "Recorded tick data:");
            long prev = tickTimings.get(0);
            long longest = 0;
            long shortest = -1;
            long sum = 0;
            int nLong = 0;
            boolean verbose = args.length > 1 && args[1].equalsIgnoreCase("-verbose");
            for (int i = 1; i < tickTimings.size(); i++) {
                long ms = tickTimings.get(i) - prev;
                sum += ms;
                if (ms > longest)
                    longest = ms;
                if (shortest == -1 || ms < shortest)
                    shortest = ms;
                if (ms > 5 + 1000 / 20)
                    nLong++;
                if (verbose)
                    sender.sendMessage(ChatColor.GRAY + "#" + i + ": " + (ms <= 5 + 1000 / 20 ? ChatColor.GREEN : ChatColor.RED) + ms + "ms");
                prev = tickTimings.get(i);
            }
            double avg = (double) sum / (tickTimings.size() - 1);
            sender.sendMessage(ChatColor.GREEN + "Ticks Recorded: " + ChatColor.GRAY + (tickTimings.size() - 1));
            sender.sendMessage(ChatColor.GREEN + "Long Ticks: " + ChatColor.GRAY + nLong);
            sender.sendMessage(ChatColor.GREEN + "Shortest Tick: " + ChatColor.GRAY + shortest + "ms");
            sender.sendMessage(ChatColor.GREEN + "Longest Tick: " + ChatColor.GRAY + longest + "ms");
            sender.sendMessage(ChatColor.GREEN + "Average Tick: " + ChatColor.GRAY + MathUtil.round(avg) + "ms");
        }
    } else if (label.equalsIgnoreCase("getprocessid")) {
        if (!requirePermission(sender, SystemProfileFlag.DEVELOPMENT))
            return true;
        sender.sendMessage(ChatColor.GREEN + "Process ID: " + ChatColor.GRAY + ProcessHandle.current().pid());
    } else if (label.equalsIgnoreCase("getstacktrace")) {
        if (!requirePermission(sender, SystemProfileFlag.DEVELOPMENT))
            return true;
        UUID cid = LOGGER.newCID();
        Thread thread = Thread.currentThread();
        if (args.length > 0) {
            Integer id = parseInt(sender, args[0]);
            for (Thread test : Thread.getAllStackTraces().keySet()) {
                if (test.getId() == id) {
                    thread = test;
                    break;
                }
            }
        }
        LOGGER.info(cid, "Stack trace requested for thread " + thread.getId() + " " + thread.getName() + " (" + thread.getState() + ")");
        sender.sendMessage(ChatColor.GREEN + "Stack trace for thread " + thread.getId() + " " + thread.getName() + " (" + thread.getState() + ")");
        for (StackTraceElement elem : thread.getStackTrace()) {
            sender.sendMessage(ChatColor.GRAY + elem.toString());
            LOGGER.info(cid, elem.toString());
        }
        sender.sendMessage(ChatColor.YELLOW + "Stack trace logged with correlation ID " + StringUtil.toHdFont(cid.toString()));
    } else if (label.equalsIgnoreCase("getactivethreads")) {
        if (!requirePermission(sender, SystemProfileFlag.DEVELOPMENT))
            return true;
        sender.sendMessage(ChatColor.DARK_GREEN + "" + Thread.getAllStackTraces().size() + " active threads:");
        // adapted from https://stackoverflow.com/a/46979843/8463670
        Thread.getAllStackTraces().keySet().stream().collect(Collectors.groupingBy(Thread::getThreadGroup)).forEach((group, threads) -> {
            sender.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "GROUP " + group.getName() + " - " + group.activeCount() + " thr, " + group.activeGroupCount() + " sub" + ", par=" + (group.getParent() == null ? "none" : group.getParent().getName()) + ", maxpriority=" + group.getMaxPriority());
            TableGenerator tg = new TableGenerator(Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT, Alignment.LEFT);
            tg.addRow(COL_ID, COL_NAME, COL_STATE, COL_PRIORITY, COL_DAEMON);
            for (Thread thread : threads) {
                tg.addRowEx("/getstacktrace " + thread.getId(), "Click to view stack trace for thread #" + thread.getId() + " " + thread.getName() + " (" + thread.getState() + ")", "" + thread.getId(), StringUtil.truncateWithEllipsis(thread.getName(), 20), thread.getState().toString(), "" + thread.getPriority(), "" + thread.isDaemon());
            }
            tg.display(sender);
        });
    } else if (label.equalsIgnoreCase("requestgc")) {
        if (!requirePermission(sender, SystemProfileFlag.DEVELOPMENT))
            return true;
        long before = System.currentTimeMillis();
        System.gc();
        sender.sendMessage(ChatColor.GREEN + "Ran garbage collector in " + (System.currentTimeMillis() - before) + "ms");
    } else if (label.equalsIgnoreCase("generatedump")) {
        CommandSender console = Bukkit.getConsoleSender();
        dragons.getLogger().info("");
        dragons.getLogger().info("");
        dragons.getLogger().info("");
        dragons.getLogger().info("==== BEGIN FULL SERVER DATA DUMP ====");
        dragons.getLogger().info("");
        dragons.getLogger().info("=== BEGIN USER DUMP ===");
        for (User user : UserLoader.allUsers()) {
            if (user.getPlayer() == null) {
                dragons.getLogger().info("USER " + user.getName() + " - " + user + " - OFFLINE");
            } else {
                dragons.getLogger().info("USER " + user.getName() + " - " + user + " - World " + user.getPlayer().getWorld() + ", Loc " + StringUtil.locToString(user.getPlayer().getLocation()) + ", Access Level " + user.getActivePermissionLevel());
            }
        }
        dragons.getLogger().info("=== END USER DUMP ===");
        dragons.getLogger().info("");
        Bukkit.dispatchCommand(console, "debug dump gameobjects");
        dragons.getLogger().info("");
        Bukkit.dispatchCommand(console, "debug dump entities");
        dragons.getLogger().info("");
        Bukkit.dispatchCommand(console, "debug dump threads");
        dragons.getLogger().info("");
        Bukkit.dispatchCommand(console, "debug dump workers");
        dragons.getLogger().info("");
        Bukkit.dispatchCommand(console, "debug dump pendingtasks");
        dragons.getLogger().info("");
        Bukkit.dispatchCommand(console, "lag");
        dragons.getLogger().info("");
        Bukkit.dispatchCommand(console, "worldperformance");
        dragons.getLogger().info("");
        Bukkit.dispatchCommand(console, "serverperformance");
        dragons.getLogger().info("");
        dragons.getLogger().info("==== END FULL SERVER DATA DUMP ====");
        dragons.getLogger().info("");
        dragons.getLogger().info("");
        dragons.getLogger().info("");
    } else if (label.equalsIgnoreCase("clearnetworkmessagecache") || label.equalsIgnoreCase("clearnmc")) {
        if (!requirePermission(sender, SystemProfileFlag.DEVELOPMENT))
            return true;
        MongoCollection<Document> messages = dragons.getMongoConfig().getDatabase().getCollection(MessageConstants.MESSAGE_COLLECTION);
        if (args.length == 0) {
            DeleteResult result = messages.deleteMany(new Document());
            sender.sendMessage(ChatColor.GREEN + "Successfully cleared the network-wide message cache (n=" + result.getDeletedCount() + ")");
        } else {
            Integer seconds = parseInt(sender, args[0]);
            if (seconds == null)
                return true;
            DeleteResult result = messages.deleteMany(new Document("timestamp", new Document("$lt", System.currentTimeMillis() - seconds * 1000)));
            sender.sendMessage(ChatColor.GREEN + "Successfully removed " + result.getDeletedCount() + " messages from the cache");
        }
    } else if (label.equalsIgnoreCase("printnetworkmessages")) {
        if (!requirePermission(sender, SystemProfileFlag.DEVELOPMENT))
            return true;
        MessageDispatcher dispatcher = dragons.getMessageDispatcher();
        dispatcher.setDebug(!dispatcher.isDebug());
        sender.sendMessage(ChatColor.GREEN + (dispatcher.isDebug() ? "Enabled" : "Disabled") + " network message logging.");
    } else if (label.equalsIgnoreCase("manifest")) {
        Map<String, List<UUID>> manifest = User.getConnectionMessageHandler().getManifest();
        sender.sendMessage(ChatColor.DARK_GREEN + "Displaying network-wide user manifest.");
        manifest.forEach((server, users) -> {
            sender.sendMessage(ChatColor.YELLOW + "Server " + server + " - " + users.size() + " online");
            sender.sendMessage(ChatColor.GRAY + "  " + StringUtil.parseList(users.stream().map(uuid -> userLoader.loadObject(uuid).getName()).collect(Collectors.toList())));
        });
    }
    return true;
}
Also used : Document(org.bson.Document) NPCLoader(mc.dragons.core.gameobject.npc.NPCLoader) Arrays(java.util.Arrays) Alignment(mc.dragons.core.util.TableGenerator.Alignment) MongoCollection(com.mongodb.client.MongoCollection) MessageConstants(mc.dragons.core.networking.MessageConstants) Item(org.bukkit.entity.Item) ThreadMXBean(com.sun.management.ThreadMXBean) User(mc.dragons.core.gameobject.user.User) Player(org.bukkit.entity.Player) ArrayList(java.util.ArrayList) MessageDispatcher(mc.dragons.core.networking.MessageDispatcher) DragonsCommandExecutor(mc.dragons.core.commands.DragonsCommandExecutor) PermissionLevel(mc.dragons.core.gameobject.user.permission.PermissionLevel) ItemFrame(org.bukkit.entity.ItemFrame) World(org.bukkit.World) Map(java.util.Map) Chunk(org.bukkit.Chunk) ManagementFactory(java.lang.management.ManagementFactory) Bukkit(org.bukkit.Bukkit) StringUtil(mc.dragons.core.util.StringUtil) CommandSender(org.bukkit.command.CommandSender) Properties(java.util.Properties) UserLoader(mc.dragons.core.gameobject.user.UserLoader) Entity(org.bukkit.entity.Entity) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) FloorLoader(mc.dragons.core.gameobject.floor.FloorLoader) UUID(java.util.UUID) EntityType(org.bukkit.entity.EntityType) SystemProfileFlag(mc.dragons.core.gameobject.user.permission.SystemProfile.SystemProfileFlags.SystemProfileFlag) Collectors(java.util.stream.Collectors) Dragons(mc.dragons.core.Dragons) List(java.util.List) OperatingSystemMXBean(com.sun.management.OperatingSystemMXBean) LagMeter(mc.dragons.core.tasks.LagMeter) TableGenerator(mc.dragons.core.util.TableGenerator) DeleteResult(com.mongodb.client.result.DeleteResult) ChatColor(org.bukkit.ChatColor) Command(org.bukkit.command.Command) MathUtil(mc.dragons.core.util.MathUtil) NPC(mc.dragons.core.gameobject.npc.NPC) PersistentDataType(org.bukkit.persistence.PersistentDataType) NPC(mc.dragons.core.gameobject.npc.NPC) Entity(org.bukkit.entity.Entity) User(mc.dragons.core.gameobject.user.User) ItemFrame(org.bukkit.entity.ItemFrame) World(org.bukkit.World) Properties(java.util.Properties) Document(org.bson.Document) Item(org.bukkit.entity.Item) MessageDispatcher(mc.dragons.core.networking.MessageDispatcher) ArrayList(java.util.ArrayList) List(java.util.List) UUID(java.util.UUID) ThreadMXBean(com.sun.management.ThreadMXBean) Player(org.bukkit.entity.Player) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) TableGenerator(mc.dragons.core.util.TableGenerator) Chunk(org.bukkit.Chunk) CommandSender(org.bukkit.command.CommandSender) OperatingSystemMXBean(com.sun.management.OperatingSystemMXBean) DeleteResult(com.mongodb.client.result.DeleteResult)

Aggregations

User (mc.dragons.core.gameobject.user.User)3 TableGenerator (mc.dragons.core.util.TableGenerator)3 UUID (java.util.UUID)2 PermissionLevel (mc.dragons.core.gameobject.user.permission.PermissionLevel)2 SystemProfileFlag (mc.dragons.core.gameobject.user.permission.SystemProfile.SystemProfileFlags.SystemProfileFlag)2 Report (mc.dragons.tools.moderation.report.ReportLoader.Report)2 Document (org.bson.Document)2 MongoCollection (com.mongodb.client.MongoCollection)1 DeleteResult (com.mongodb.client.result.DeleteResult)1 OperatingSystemMXBean (com.sun.management.OperatingSystemMXBean)1 ThreadMXBean (com.sun.management.ThreadMXBean)1 ManagementFactory (java.lang.management.ManagementFactory)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Map (java.util.Map)1 Properties (java.util.Properties)1 Collectors (java.util.stream.Collectors)1 Dragons (mc.dragons.core.Dragons)1 DragonsCommandExecutor (mc.dragons.core.commands.DragonsCommandExecutor)1