From ce52c98668ec270a2635e34b6d70b47d4a6cd16a Mon Sep 17 00:00:00 2001 From: itqop Date: Mon, 21 Oct 2024 20:05:09 +0300 Subject: [PATCH] chore(release): v0.1.6 ### Fixed - Global Chat Issue: - Resolved bugs affecting the functionality of the global chat. --- CHANGELOG.md | 7 +++++ CHANGELOG.ru.md | 7 +++++ gradle.properties | 2 +- .../chatit/handlers/ChatEventHandler.java | 30 +++++++++++++------ 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f99ebe1..1d35e1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/). +## [0.1.6] - 2024-10-21 + +### Fixed + +- **Global Chat Issue**: + - Resolved bugs affecting the functionality of the global chat. + ## [0.1.5] - 2024-10-21 ### Fixed diff --git a/CHANGELOG.ru.md b/CHANGELOG.ru.md index a11faf2..d31a001 100644 --- a/CHANGELOG.ru.md +++ b/CHANGELOG.ru.md @@ -4,6 +4,13 @@ Формат основан на [Keep a Changelog](https://keepachangelog.com/ru/1.0.0/), и этот проект придерживается [Семантического Версионирования](https://semver.org/lang/ru/). +## [0.1.6] - 2024-10-21 + +### Исправлено + +- **Проблема с глобальным чатом**: + - Исправлены ошибки, влияющие на работу глобального чата. + ## [0.1.5] - 2024-10-21 ### Исправлено diff --git a/gradle.properties b/gradle.properties index 102e4d3..8f296af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,7 +38,7 @@ mod_name=ChatIT # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=All Rights Reserved # The mod version. See https://semver.org/ -mod_version=0.1.5-BETA +mod_version=0.1.6-BETA # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/org/itqop/chatit/handlers/ChatEventHandler.java b/src/main/java/org/itqop/chatit/handlers/ChatEventHandler.java index c9213ae..dc2f2e1 100644 --- a/src/main/java/org/itqop/chatit/handlers/ChatEventHandler.java +++ b/src/main/java/org/itqop/chatit/handlers/ChatEventHandler.java @@ -48,24 +48,36 @@ public class ChatEventHandler { MutableComponent adultComponent = createAdultMessage(); sender.sendSystemMessage(adultComponent); } else { - boolean messageSent = false; + boolean localMessageSent = false; for (ServerPlayer receiver : server.getPlayerList().getPlayers()) { PlayerConfigManager.ensurePlayerExists(receiver); if (profanityScore > threshold && !PlayerConfigManager.hasAdultContentEnabled(receiver)) { continue; } - if (((receiver.getCommandSenderWorld() == sender.getCommandSenderWorld() && receiver.position().distanceTo(sender.position()) <= 50) && (sender != receiver)) || isGlobal) { + + if (isGlobal) { receiver.sendSystemMessage(chatComponent); - messageSent = true; + continue; } + + if (receiver.getCommandSenderWorld() != sender.getCommandSenderWorld() || + receiver.position().distanceTo(sender.position()) > 50 || + receiver == sender) { + continue; + } + + receiver.sendSystemMessage(chatComponent); + localMessageSent = true; } - if (!messageSent) { - MutableComponent errorComponent = createErrorMessage(Config.messageLocal); - sender.sendSystemMessage(errorComponent); - } - else { - sender.sendSystemMessage(chatComponent); + + if (!isGlobal) { + if (!localMessageSent) { + MutableComponent errorComponent = createErrorMessage(Config.messageLocal); + sender.sendSystemMessage(errorComponent); + } else { + sender.sendSystemMessage(chatComponent); + } } } });