TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java

64 lines
2.0 KiB
Java
Raw Normal View History

2020-06-30 07:25:38 +00:00
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
2020-06-30 07:25:38 +00:00
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
2020-09-28 03:17:01 +00:00
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Manually verify someone", usage = "/<command> <playername>", aliases="mv")
2020-06-30 07:25:38 +00:00
public class Command_manuallyverify extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
boolean enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean());
2020-06-30 07:25:38 +00:00
if (!plugin.dc.enabled)
{
msg("The Discord verification system is currently disabled", ChatColor.RED);
return true;
}
if (!enableBot)
{
msg("The Discord verification system is currently disabled", ChatColor.RED);
return true;
}
2020-06-30 07:25:38 +00:00
if (args.length == 0)
{
return false;
}
final Player player = getPlayer(args[0]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
if (!plugin.pl.IsImpostor(player))
2020-06-30 07:25:38 +00:00
{
msg("That player is not an impostor.");
return true;
}
FUtil.staffAction(sender.getName(), "Manually verifying player " + player.getName(), false);
2020-06-30 07:25:38 +00:00
player.setOp(true);
player.sendMessage(YOU_ARE_OP);
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
{
plugin.pl.getPlayer(player).getFreezeData().setFrozen(false);
player.sendMessage(ChatColor.GRAY + "You have been unfrozen.");
}
plugin.pl.verify(player, null);
plugin.rm.updateDisplay(player);
return true;
}
}