Search in sources :

Example 1 with BukkitPartyTeleportRequest

use of com.alessiodp.parties.bukkit.parties.objects.BukkitPartyTeleportRequest in project Parties by AlessioDP.

the class BukkitCommandTeleport method performTeleport.

@Override
public void performTeleport(PartyImpl party, PartyPlayerImpl player, int delay) {
    if (ConfigParties.ADDITIONAL_TELEPORT_ACCEPT_REQUEST_ENABLE)
        player.sendMessage(Messages.ADDCMD_TELEPORT_ACCEPT_REQUEST_SENT);
    else
        player.sendMessage(Messages.ADDCMD_TELEPORT_TELEPORTING.replace("%seconds%", Integer.toString(delay)));
    for (PartyPlayer onlinePlayer : party.getOnlineMembers(true)) {
        if (!onlinePlayer.getPlayerUUID().equals(player.getPlayerUUID())) {
            if (ConfigParties.ADDITIONAL_TELEPORT_ACCEPT_REQUEST_ENABLE) {
                BukkitPartyTeleportRequest request = new BukkitPartyTeleportRequest((PartiesPlugin) plugin, (PartyPlayerImpl) onlinePlayer, player);
                ((PartyPlayerImpl) onlinePlayer).getPendingTeleportRequests().add(request);
                ((PartyPlayerImpl) onlinePlayer).sendMessage(Messages.ADDCMD_TELEPORT_ACCEPT_REQUEST_RECEIVED, player, party);
                plugin.getScheduler().scheduleAsyncLater(request::timeout, ConfigParties.ADDITIONAL_TELEPORT_ACCEPT_REQUEST_TIME, TimeUnit.SECONDS);
            } else {
                handleSinglePlayerTeleport((PartiesPlugin) plugin, (PartyPlayerImpl) onlinePlayer, player, delay);
            }
        }
    }
}
Also used : PartyPlayer(com.alessiodp.parties.api.interfaces.PartyPlayer) PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) BukkitPartyTeleportRequest(com.alessiodp.parties.bukkit.parties.objects.BukkitPartyTeleportRequest)

Aggregations

PartyPlayer (com.alessiodp.parties.api.interfaces.PartyPlayer)1 BukkitPartyTeleportRequest (com.alessiodp.parties.bukkit.parties.objects.BukkitPartyTeleportRequest)1 PartyPlayerImpl (com.alessiodp.parties.common.players.objects.PartyPlayerImpl)1