PC-873 Alert user regardless of usage if banned from using /report

This commit is contained in:
Keir Nellyer 2016-07-28 17:41:20 +01:00
parent 8ee6ab6a1b
commit 5dd35d45c4

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.BukkitFuture;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -28,7 +29,13 @@ public class ReportCommand extends CommandBase<ReportPlugin>
{ {
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "The report feature is currently in a trial phase for Ultra+ players")); 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) else
{
Plugin.getReportManager().canReport(player).thenCompose(BukkitFuture.accept(canReport ->
{
if (canReport)
{
if(args == null || args.length < 2)
{ {
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Invalid Usage: " + F.elem("/report <player> <reason>"))); UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Invalid Usage: " + F.elem("/report <player> <reason>")));
} }
@ -46,19 +53,9 @@ public class ReportCommand extends CommandBase<ReportPlugin>
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "You cannot report yourself.")); UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "You cannot report yourself."));
} }
else else
{
Plugin.getReportManager().canReport(player).thenAccept(canReport ->
{
if (canReport)
{ {
new ReportCategoryPage(Plugin, player, reportedPlayer, reason).openInventory(); new ReportCategoryPage(Plugin, player, reportedPlayer, reason).openInventory();
} }
else
{
player.sendMessage(C.cRed + "You are banned from using the report command.");
}
});
}
} }
else else
{ {
@ -67,4 +64,11 @@ public class ReportCommand extends CommandBase<ReportPlugin>
} }
} }
} }
else
{
player.sendMessage(C.cRed + "You are banned from using the report command.");
}
}));
}
}
} }