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