2016-03-02 19:28:01 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
2014-10-27 11:23:08 +00:00
|
|
|
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
2014-11-29 19:16:00 +00:00
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2014-10-27 11:23:08 +00:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2016-03-06 15:56:15 +00:00
|
|
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME, blockHostConsole = true)
|
2014-10-27 11:23:08 +00:00
|
|
|
@CommandParameters(description = "Report a player for admins to see.", usage = "/<command> <player> <reason>")
|
2015-10-19 17:43:46 +00:00
|
|
|
public class Command_report extends FreedomCommand
|
2014-10-27 11:23:08 +00:00
|
|
|
{
|
2015-11-22 18:26:47 +00:00
|
|
|
|
2014-10-27 11:23:08 +00:00
|
|
|
@Override
|
2015-11-22 18:26:47 +00:00
|
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
2014-10-27 11:23:08 +00:00
|
|
|
{
|
|
|
|
if (args.length < 2)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Player player = getPlayer(args[0]);
|
|
|
|
|
|
|
|
if (player == null)
|
|
|
|
{
|
2016-03-02 19:28:01 +00:00
|
|
|
msg(PLAYER_NOT_FOUND);
|
2014-10-27 11:23:08 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sender instanceof Player)
|
|
|
|
{
|
2015-11-22 18:26:47 +00:00
|
|
|
if (player.equals(playerSender))
|
2014-10-27 11:23:08 +00:00
|
|
|
{
|
2016-03-02 19:28:01 +00:00
|
|
|
msg(ChatColor.RED + "Please, don't try to report yourself.");
|
2014-10-27 11:23:08 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-19 17:43:46 +00:00
|
|
|
if (plugin.al.isAdmin(player))
|
2014-10-27 11:23:08 +00:00
|
|
|
{
|
2016-03-02 19:28:01 +00:00
|
|
|
msg(ChatColor.RED + "You can not report an admin.");
|
2014-10-27 11:23:08 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
2016-05-12 19:40:39 +00:00
|
|
|
plugin.cm.reportAction(playerSender, player, report);
|
2014-10-27 11:23:08 +00:00
|
|
|
|
2016-03-02 19:28:01 +00:00
|
|
|
msg(ChatColor.GREEN + "Thank you, your report has been successfully logged.");
|
2014-10-27 11:23:08 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2014-11-20 22:20:31 +00:00
|
|
|
}
|