Kick player only Synchronously

This commit is contained in:
Xephi59 2016-05-02 02:39:53 +02:00
parent 121dd7e6fb
commit e97b4641a1

View File

@ -1,15 +1,17 @@
package fr.xephi.authme.command.executable.authme;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.security.crypts.HashedPassword;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.List;
/**
* Admin command to register a user.
@ -55,10 +57,16 @@ public class RegisterAdminCommand implements ExecutableCommand {
commandService.send(sender, MessageKey.REGISTER_SUCCESS);
ConsoleLogger.info(sender.getName() + " registered " + playerName);
Player player = commandService.getPlayer(playerName);
final Player player = commandService.getPlayer(playerName);
if (player != null) {
sender.getServer().getScheduler().scheduleSyncDelayedTask(AuthMe.getInstance(), new Runnable()
{
@Override
public void run() {
player.kickPlayer("An admin just registered you, please log in again");
}
});
}
}
});
}