Search in sources :

Example 1 with VelocityPartyTeleportRequest

use of com.alessiodp.parties.velocity.parties.objects.VelocityPartyTeleportRequest in project Parties by AlessioDP.

the class VelocityCommandTeleport method performTeleport.

public void performTeleport(PartyImpl party, PartyPlayerImpl player, int delay) {
    Player velocityPlayer = ((VelocityPartiesBootstrap) plugin.getBootstrap()).getServer().getPlayer(player.getPlayerUUID()).orElse(null);
    if (velocityPlayer != null) {
        if (ConfigParties.ADDITIONAL_TELEPORT_ACCEPT_REQUEST_ENABLE)
            player.sendMessage(Messages.ADDCMD_TELEPORT_ACCEPT_REQUEST_SENT);
        else
            player.sendMessage(Messages.ADDCMD_TELEPORT_TELEPORTING);
        for (PartyPlayer onlinePlayer : party.getOnlineMembers(true)) {
            if (!onlinePlayer.getPlayerUUID().equals(player.getPlayerUUID())) {
                if (ConfigParties.ADDITIONAL_TELEPORT_ACCEPT_REQUEST_ENABLE) {
                    VelocityPartyTeleportRequest request = new VelocityPartyTeleportRequest((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 : VelocityPartyTeleportRequest(com.alessiodp.parties.velocity.parties.objects.VelocityPartyTeleportRequest) PartyPlayer(com.alessiodp.parties.api.interfaces.PartyPlayer) Player(com.velocitypowered.api.proxy.Player) PartyPlayer(com.alessiodp.parties.api.interfaces.PartyPlayer) PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) VelocityPartiesBootstrap(com.alessiodp.parties.velocity.bootstrap.VelocityPartiesBootstrap)

Aggregations

PartyPlayer (com.alessiodp.parties.api.interfaces.PartyPlayer)1 PartyPlayerImpl (com.alessiodp.parties.common.players.objects.PartyPlayerImpl)1 VelocityPartiesBootstrap (com.alessiodp.parties.velocity.bootstrap.VelocityPartiesBootstrap)1 VelocityPartyTeleportRequest (com.alessiodp.parties.velocity.parties.objects.VelocityPartyTeleportRequest)1 Player (com.velocitypowered.api.proxy.Player)1