use of com.alessiodp.parties.common.tasks.TeleportDelayTask in project Parties by AlessioDP.
the class CommandTeleport method handleSinglePlayerTeleport.
// The player accepted the teleport, handling delay
protected void handleSinglePlayerTeleport(PartiesPlugin plugin, PartyPlayerImpl player, PartyPlayerImpl targetPlayer, int delay) {
User user = plugin.getPlayer(player.getPlayerUUID());
if (user != null && player.getPendingTeleportDelay() == null) {
if (delay > 0) {
TeleportDelayTask teleportDelayTask = teleportSinglePlayerWithDelay(plugin, player, targetPlayer, delay);
CancellableTask task = plugin.getScheduler().scheduleAsyncRepeating(teleportDelayTask, 0, 300, TimeUnit.MILLISECONDS);
player.setPendingTeleportDelay(task);
player.sendMessage(Messages.ADDCMD_TELEPORT_PLAYER_TELEPORTIN.replace("%seconds%", Integer.toString(delay)));
} else {
teleportSinglePlayer(plugin, player, targetPlayer);
}
}
}
Aggregations