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