Search in sources :

Example 1 with ChatChannel

use of com.gmail.nossr50.datatypes.chat.ChatChannel in project Foundation by kangarko.

the class ItemsAdderHook method getActivePartyChat.

String getActivePartyChat(final Player player) {
    try {
        final McMMOPlayer mcplayer = UserManager.getPlayer(player);
        if (mcplayer != null) {
            final Party party = mcplayer.getParty();
            final ChatChannel channelType = mcplayer.getChatChannel();
            return channelType == ChatChannel.PARTY || channelType == ChatChannel.PARTY_OFFICER && party != null ? party.getName() : null;
        }
    } catch (final Throwable throwable) {
        if (!errorLogged) {
            Common.warning("Failed getting mcMMO party chat for " + player.getName() + " due to error. Returning null." + " Ensure you have the latest mcMMO version, if so, contact plugin authors to update the integration. Error was: " + throwable);
            errorLogged = true;
        }
    }
    return null;
}
Also used : ChatChannel(com.gmail.nossr50.datatypes.chat.ChatChannel) Party(com.gmail.nossr50.datatypes.party.Party) McMMOPlayer(com.gmail.nossr50.datatypes.player.McMMOPlayer)

Aggregations

ChatChannel (com.gmail.nossr50.datatypes.chat.ChatChannel)1 Party (com.gmail.nossr50.datatypes.party.Party)1 McMMOPlayer (com.gmail.nossr50.datatypes.player.McMMOPlayer)1