Search in sources :

Example 1 with PartyAskRequestImpl

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;
}
Also used : PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) PartyAskRequestImpl(com.alessiodp.parties.common.players.objects.PartyAskRequestImpl) PartyAskRequest(com.alessiodp.parties.api.interfaces.PartyAskRequest)

Aggregations

PartyAskRequest (com.alessiodp.parties.api.interfaces.PartyAskRequest)1 PartyAskRequestImpl (com.alessiodp.parties.common.players.objects.PartyAskRequestImpl)1 PartyPlayerImpl (com.alessiodp.parties.common.players.objects.PartyPlayerImpl)1