PC-873 Alert user regardless of usage if banned from using /report
This commit is contained in:
parent
8ee6ab6a1b
commit
5dd35d45c4
@ -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<ReportPlugin>
|
||||
{
|
||||
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 <player> <reason>")));
|
||||
}
|
||||
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 <player> <reason>")));
|
||||
}
|
||||
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.");
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user