make /2fa remove <player> accessible from the console
This commit is contained in:
parent
7493532ba2
commit
ccf93dc8eb
|
@ -34,6 +34,34 @@ public class TFACommand implements CommandExecutor, TabCompleter
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
if (args.length >= 2 && args[0].equalsIgnoreCase("remove"))
|
||||
{
|
||||
OfflinePlayer otherPlayer = PlayerUtils.getOfflinePlayer(args[1]);
|
||||
if (otherPlayer == null)
|
||||
{
|
||||
sender.sendMessage("Could not find player \"" + args[1] + "\".");
|
||||
return true;
|
||||
}
|
||||
if (th.hasEnabled2FA(otherPlayer.getUniqueId()))
|
||||
{
|
||||
th.remove2FA(otherPlayer.getUniqueId());
|
||||
sender.sendMessage("Removed two-factor authentication for " + otherPlayer.getName() + ".");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(otherPlayer.getName() + " does not have two-factor authentication enabled.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Usage: /<command> remove <player>".replace("<command>", label));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if (args.length >= 1 && args[0].equalsIgnoreCase("remove"))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue