use of com.alessiodp.parties.common.players.objects.PartyAskRequestImpl in project Parties by AlessioDP.
the class PartyImpl method askToJoin.
public PartyAskRequest askToJoin(@NotNull PartyPlayer asker, boolean sendMessages) {
PartyAskRequest ret = null;
if (!asker.isInParty() && !isFull()) {
ret = new PartyAskRequestImpl(plugin, this, asker);
askRequests.add(ret);
asker.getPendingAskRequests().add(ret);
if (sendMessages) {
((PartyPlayerImpl) asker).sendMessage(Messages.ADDCMD_ASK_SENT, this);
broadcastMessageOnlyTo(Messages.ADDCMD_ASK_RECEIVED, asker, RankPermission.ASK_ACCEPT, RankPermission.ASK_DENY);
}
plugin.getScheduler().scheduleAsyncLater(ret::timeout, ConfigParties.ADDITIONAL_ASK_TIMEOUT, TimeUnit.SECONDS);
}
return ret;
}
Aggregations