Search in sources :

Example 71 with PartyImpl

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

the class CommonListener method handlePostPartyDelete.

public void handlePostPartyDelete(UUID partyId, DeleteCause cause, UUID kickedId, UUID senderId) {
    PartyImpl party = plugin.getPartyManager().getParty(partyId);
    if (party != null) {
        PartyPlayerImpl kickedPlayer = kickedId != null ? plugin.getPlayerManager().getPlayer(kickedId) : null;
        PartyPlayerImpl commandSender = senderId != null ? plugin.getPlayerManager().getPlayer(senderId) : null;
        if (plugin.getPartyManager().isPartyCached(partyId)) {
            party.getMembers().forEach(u -> {
                plugin.getPlayerManager().reloadPlayer(u);
            });
        }
        plugin.getPartyManager().removePartyFromCache(partyId);
        IPartyPostDeleteEvent event = plugin.getEventManager().preparePartyPostDeleteEvent(party, cause, kickedPlayer, commandSender);
        plugin.getEventManager().callEvent(event);
        plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_DELETE_PARTY, partyId.toString(), cause.name(), kickedId != null ? kickedId.toString() : "none", senderId != null ? senderId.toString() : "none"), true);
    }
}
Also used : PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) IPartyPostDeleteEvent(com.alessiodp.parties.api.events.common.party.IPartyPostDeleteEvent) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 72 with PartyImpl

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

the class CommonListener method handlePostLevelUp.

public void handlePostLevelUp(UUID partyId, int number, boolean reload) {
    if (ConfigMain.ADDITIONAL_EXP_ENABLE) {
        if (reload)
            plugin.getPartyManager().reloadParty(partyId);
        PartyImpl party = plugin.getPartyManager().getParty(partyId);
        if (party != null) {
            IPartyLevelUpEvent event = plugin.getEventManager().prepareLevelUpEvent(party, number);
            plugin.getEventManager().callEvent(event);
            plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_LEVEL_UP, partyId.toString(), number), true);
        }
    }
}
Also used : IPartyLevelUpEvent(com.alessiodp.parties.api.events.common.party.IPartyLevelUpEvent) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 73 with PartyImpl

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

the class CommonListener method handleExperience.

public void handleExperience(UUID partyId, UUID playerId, double experience, boolean gainMessage) {
    if (ConfigMain.ADDITIONAL_EXP_ENABLE) {
        PartyImpl party = plugin.getPartyManager().getParty(partyId);
        PartyPlayerImpl partyPlayer = plugin.getPlayerManager().getPlayer(playerId);
        if (party != null) {
            party.giveExperience(experience, partyPlayer, null, gainMessage);
        }
        plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_EXPERIENCE, CommonUtils.formatDouble(experience), partyId.toString(), playerId != null ? playerId.toString() : "none"), true);
    }
}
Also used : PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl)

Example 74 with PartyImpl

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

the class CommonListener method handlePostBroadcast.

public void handlePostBroadcast(UUID partyId, UUID playerId, String message) {
    PartyImpl party = plugin.getPartyManager().getParty(partyId);
    if (party != null) {
        PartyPlayerImpl player = plugin.getPlayerManager().getPlayer(playerId);
        IPartyPostBroadcastEvent event = plugin.getEventManager().preparePartyPostBroadcastEvent(party, message, player);
        plugin.getEventManager().callEvent(event);
        plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_BROADCAST_MESSAGE, playerId != null ? playerId.toString() : "none", partyId.toString(), message), true);
    }
}
Also used : PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) PartyImpl(com.alessiodp.parties.common.parties.objects.PartyImpl) IPartyPostBroadcastEvent(com.alessiodp.parties.api.events.common.party.IPartyPostBroadcastEvent)

Example 75 with PartyImpl

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

the class CommonListener method handleAddHome.

public void handleAddHome(UUID partyId, String home) {
    PartyImpl party = plugin.getPartyManager().getParty(partyId);
    if (party != null) {
        CommandSetHome.savePartyHome(party, PartyHomeImpl.deserialize(home));
        plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_ADD_HOME_BUNGEE, party.getId()), true);
    }
}
Also used : 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