Search in sources :

Example 16 with PartyImpl

use of com.alessiodp.parties.common.parties.objects.PartyImpl in project Parties by AlessioDP.

the class CommonListener method handlePostExperience.

public void handlePostExperience(UUID partyId, UUID playerId, double number, boolean reload) {
    if (ConfigMain.ADDITIONAL_EXP_ENABLE) {
        if (reload)
            plugin.getPartyManager().reloadParty(partyId);
        PartyImpl party = plugin.getPartyManager().getParty(partyId);
        if (party != null) {
            PartyPlayerImpl player = plugin.getPlayerManager().getPlayer(playerId);
            IPartyGetExperienceEvent event = plugin.getEventManager().preparePartyGetExperienceEvent(party, number, player);
            plugin.getEventManager().callEvent(event);
            plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_EXPERIENCE, CommonUtils.formatDouble(number), partyId.toString(), playerId != null ? playerId.toString() : "none"), true);
        }
    }
}
Also used : PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) IPartyGetExperienceEvent(com.alessiodp.parties.api.events.common.party.IPartyGetExperienceEvent) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 17 with PartyImpl

use of com.alessiodp.parties.common.parties.objects.PartyImpl in project Parties by AlessioDP.

the class CommonListener method handleChatMessage.

public void handleChatMessage(UUID partyId, UUID playerId, String message) {
    PartyImpl party = plugin.getPartyManager().getParty(partyId);
    if (party != null) {
        try {
            PartyPlayerImpl player = plugin.getPlayerManager().getPlayer(playerId);
            player.performPartyMessage(message);
            plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_CHAT_MESSAGE, playerId.toString(), partyId.toString(), message), true);
        } catch (Exception ex) {
            plugin.getLoggerManager().logError(PartiesConstants.DEBUG_MESSAGING_LISTEN_INVITE_PARTY_ERROR, ex);
        }
    }
}
Also used : PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 18 with PartyImpl

use of com.alessiodp.parties.common.parties.objects.PartyImpl in project Parties by AlessioDP.

the class CommonListener method handlePostPartyRemoveMember.

public void handlePostPartyRemoveMember(UUID partyId, UUID playerId, LeaveCause cause, UUID kickerId) {
    plugin.getPartyManager().reloadPartyIfCached(partyId);
    PartyImpl party = plugin.getPartyManager().getParty(partyId);
    if (party != null) {
        PartyPlayerImpl player = plugin.getPlayerManager().getPlayer(playerId);
        PartyPlayerImpl kicker = kickerId != null ? plugin.getPlayerManager().getPlayer(kickerId) : null;
        IPlayerPostLeaveEvent event = plugin.getEventManager().preparePlayerPostLeaveEvent(player, party, cause, kicker);
        plugin.getEventManager().callEvent(event);
        plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_REMOVE_MEMBER_PARTY, playerId.toString(), partyId.toString(), cause.name(), kickerId != null ? kickerId.toString() : "none"), true);
    }
}
Also used : IPlayerPostLeaveEvent(com.alessiodp.parties.api.events.common.player.IPlayerPostLeaveEvent) PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 19 with PartyImpl

use of com.alessiodp.parties.common.parties.objects.PartyImpl in project Parties by AlessioDP.

the class CommonListener method handlePostChat.

public void handlePostChat(UUID partyId, UUID playerId, String formattedMessage, String message) {
    PartyImpl party = plugin.getPartyManager().getParty(partyId);
    PartyPlayerImpl player = plugin.getPlayerManager().getPlayer(playerId);
    if (party != null && player != null) {
        IPlayerPostChatEvent event = plugin.getEventManager().preparePlayerPostChatEvent(player, party, formattedMessage, message);
        plugin.getEventManager().callEvent(event);
        plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_CHAT_MESSAGE, playerId.toString(), partyId.toString(), message), true);
    }
}
Also used : PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) IPlayerPostChatEvent(com.alessiodp.parties.api.events.common.player.IPlayerPostChatEvent) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 20 with PartyImpl

use of com.alessiodp.parties.common.parties.objects.PartyImpl in project Parties by AlessioDP.

the class CommonListener method handlePostInvitePlayer.

public void handlePostInvitePlayer(UUID partyId, UUID invitedId, UUID inviterId) {
    PartyImpl party = plugin.getPartyManager().getParty(partyId);
    if (party != null) {
        PartyPlayerImpl invited = plugin.getPlayerManager().getPlayer(invitedId);
        PartyPlayerImpl inviter = inviterId != null ? plugin.getPlayerManager().getPlayer(inviterId) : null;
        IPlayerPostInviteEvent event = plugin.getEventManager().preparePlayerPostInviteEvent(invited, inviter, party);
        plugin.getEventManager().callEvent(event);
        plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_INVITE_PARTY, invitedId.toString(), partyId.toString(), inviterId != null ? inviterId.toString() : "none"), true);
    }
}
Also used : IPlayerPostInviteEvent(com.alessiodp.parties.api.events.common.player.IPlayerPostInviteEvent) PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Aggregations

PartyImpl (com.alessiodp.parties.common.parties.objects.PartyImpl)106 PartyPlayerImpl (com.alessiodp.parties.common.players.objects.PartyPlayerImpl)75 User (com.alessiodp.core.common.user.User)39 PartiesCommandData (com.alessiodp.parties.common.commands.utils.PartiesCommandData)31 ADPPlugin (com.alessiodp.core.common.ADPPlugin)11 UUID (java.util.UUID)11 ConfigMain (com.alessiodp.parties.common.configuration.data.ConfigMain)10 ConfigParties (com.alessiodp.parties.common.configuration.data.ConfigParties)10 PartiesPlugin (com.alessiodp.parties.common.PartiesPlugin)9 PartiesConstants (com.alessiodp.parties.common.configuration.PartiesConstants)9 PartyHomeImpl (com.alessiodp.parties.common.parties.objects.PartyHomeImpl)8 LinkedList (java.util.LinkedList)8 LinkedHashSet (java.util.LinkedHashSet)7 List (java.util.List)7 HashMap (java.util.HashMap)6 ADPMainCommand (com.alessiodp.core.common.commands.utils.ADPMainCommand)5 CommandData (com.alessiodp.core.common.commands.utils.CommandData)5 OfflineUser (com.alessiodp.core.common.user.OfflineUser)5 CommonCommands (com.alessiodp.parties.common.commands.list.CommonCommands)5 PartiesSubCommand (com.alessiodp.parties.common.commands.utils.PartiesSubCommand)5