diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java index 500d92f97..f2de8f91b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCommand.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -28,43 +29,46 @@ public class ReportCommand extends CommandBase { UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "The report feature is currently in a trial phase for Ultra+ players")); } - else if(args == null || args.length < 2) - { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Invalid Usage: " + F.elem("/report "))); - } else { - String playerName = args[0]; - Player reportedPlayer = UtilPlayer.searchOnline(player, playerName, false); - String reason = F.combine(args, 1, null, false); - - if (reportedPlayer != null) + Plugin.getReportManager().canReport(player).thenCompose(BukkitFuture.accept(canReport -> { - // allow developer (iKeirNez) to report himself (for easy testing reasons) - if (reportedPlayer == player && !player.getUniqueId().equals(IKEIRNEZ_UUID)) + if (canReport) { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "You cannot report yourself.")); - } - else - { - Plugin.getReportManager().canReport(player).thenAccept(canReport -> + if(args == null || args.length < 2) { - if (canReport) + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Invalid Usage: " + F.elem("/report "))); + } + else + { + String playerName = args[0]; + Player reportedPlayer = UtilPlayer.searchOnline(player, playerName, false); + String reason = F.combine(args, 1, null, false); + + if (reportedPlayer != null) { - new ReportCategoryPage(Plugin, player, reportedPlayer, reason).openInventory(); + // allow developer (iKeirNez) to report himself (for easy testing reasons) + if (reportedPlayer == player && !player.getUniqueId().equals(IKEIRNEZ_UUID)) + { + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "You cannot report yourself.")); + } + else + { + new ReportCategoryPage(Plugin, player, reportedPlayer, reason).openInventory(); + } } else { - player.sendMessage(C.cRed + "You are banned from using the report command."); - } - }); - } - } - else - { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Unable to find player '" + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Unable to find player '" + playerName + "'!")); - } + } + } + } + else + { + player.sendMessage(C.cRed + "You are banned from using the report command."); + } + })); } } }