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

Commit

Permalink
Chat: fix disable global chat
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Aug 15, 2023
1 parent 37d606a commit 7bf7993
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ public void chat(@NotNull AsyncPlayerChatEvent event) {
removeRecipients(recipients, player, reversedChatType);

if (chatType.equals("local")) {
int localRange = config.getInt("chat.local.range");

recipients.removeIf(recipient -> (player.getWorld() != recipient.getWorld()
|| player.getLocation().distance(recipient.getLocation()) > localRange));

if (config.getBoolean("chat.local.no-recipients.enable") &&
recipients.stream().filter(recipient -> !recipient.getGameMode().equals(GameMode.SPECTATOR)).count() == 1) {
noRecipientsMessage = locale.getFormatString("chat.local.no-recipients", player);
if(config.getBoolean("chat.global.enable")) {
int localRange = config.getInt("chat.local.range");
recipients.removeIf(recipient -> (player.getWorld() != recipient.getWorld()
|| player.getLocation().distance(recipient.getLocation()) > localRange));

if (config.getBoolean("chat.local.no-recipients.enable") &&
recipients.stream().filter(recipient -> !recipient.getGameMode().equals(GameMode.SPECTATOR)).count() == 1) {
noRecipientsMessage = locale.getFormatString("chat.local.no-recipients", player);
}
}

if (config.getBoolean("chat.local.set-cancelled")) event.setCancelled(true);
Expand Down

0 comments on commit 7bf7993

Please sign in to comment.