Schedule kick

Signed-off-by: Etzelia <etzelia@hotmail.com>
schedule
Etzelia 2021-02-27 22:12:31 -06:00
parent 3be98c7de6
commit 7df76b72ac
No known key found for this signature in database
GPG Key ID: 708511AE7ABC5314
1 changed files with 6 additions and 2 deletions

View File

@ -127,7 +127,9 @@ public class ServerAPI extends JavaPlugin implements IProvider {
public void kick(BanAPI kick) {
Player player = Bukkit.getPlayerExact(kick.getTarget());
if (player != null) {
player.kickPlayer("You have been kicked: " + kick.getReason());
getServer().getScheduler().runTask(this, () -> {
player.kickPlayer("You have been kicked: " + kick.getReason());
});
}
}
@ -140,7 +142,9 @@ public class ServerAPI extends JavaPlugin implements IProvider {
Bukkit.getBanList(BanList.Type.NAME).addBan(ban.getTarget(), ban.getReason(), expires, "ServerAPI");
Player player = Bukkit.getPlayerExact(ban.getTarget());
if (player != null) {
player.kickPlayer("You have been banned: " + ban.getReason());
getServer().getScheduler().runTask(this, () -> {
player.kickPlayer("You have been banned: " + ban.getReason());
});
}
}