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);
}
}
}
}
Aggregations