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