Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Chat: fix selection of suitable chat
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Nov 18, 2023
1 parent 8b73e09 commit e16bc32
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ public void playerChatEvent(@NotNull AsyncPlayerChatEvent event) {
String playerChat = fPlayer.getSettings().getChat();
if (playerChat == null || !availableChatsList.contains(playerChat)) {

int priority = -1;
int priority = Integer.MIN_VALUE;

for (String chatType : availableChatsList) {
if (!config.getVaultBoolean(sender, getModule() + ".list." + chatType + ".enable")) continue;
String chatTrigger = config.getVaultString(sender, getModule() + ".list." + chatType + ".prefix.trigger");
if (!chatTrigger.isEmpty() && !message.startsWith(chatTrigger)) continue;
if (message.equals(chatTrigger)) continue;

int chatPriority = config.getVaultInt(sender, getModule() + ".list." + chatType + ".priority");
if (chatPriority <= priority) continue;

if (hasNoPermission(sender, chatType)) continue;

playerChat = chatType;
priority = chatPriority;
}
}

Expand Down

0 comments on commit e16bc32

Please sign in to comment.