diff --git a/pom.xml b/pom.xml index 322d9bb..fc7571f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,9 +4,9 @@ de.jeter ChatEx ChatEx - 2022 + 2024 - 3.1.0 + 3.2.0 ChatManagement plugin for Bukkit https://www.spigotmc.org/resources/chatex-continued.71041/ diff --git a/src/main/java/de/jeter/chatex/ChatListener.java b/src/main/java/de/jeter/chatex/ChatListener.java index a1a85d3..aea6839 100644 --- a/src/main/java/de/jeter/chatex/ChatListener.java +++ b/src/main/java/de/jeter/chatex/ChatListener.java @@ -145,10 +145,12 @@ private void executeChatEvent(AsyncPlayerChatEvent event) { } LogHelper.debug("Player did not use a blocked word. Continuing..."); - + LogHelper.debug("ChatMessage: " + chatMessage); boolean global = false; + if (Config.RANGEMODE.getBoolean() || Config.BUNGEECORD.getBoolean()) { - if (chatMessage.startsWith(Config.RANGEPREFIX.getString())) { + LogHelper.debug("Message starts with prefix (" + Config.RANGEPREFIX.getString() + "): " + chatMessage.startsWith(Config.RANGEPREFIX.getString())); + if ((Config.RANGEMODE.getBoolean() && chatMessage.startsWith(Config.RANGEPREFIX.getString())) || Config.BUNGEECORD.getBoolean()) { LogHelper.debug("Global mode enabled!"); if (player.hasPermission("chatex.chat.global")) { chatMessage = chatMessage.replaceFirst(Pattern.quote(Config.RANGEPREFIX.getString()), ""); @@ -162,7 +164,6 @@ private void executeChatEvent(AsyncPlayerChatEvent event) { event.setCancelled(true); return; } - } else { player.sendMessage(Locales.COMMAND_RESULT_NO_PERM.getString(player).replaceAll("%perm", "chatex.chat.global")); event.setCancelled(true); diff --git a/src/main/java/de/jeter/chatex/utils/Config.java b/src/main/java/de/jeter/chatex/utils/Config.java index 5113d8c..8b34d97 100644 --- a/src/main/java/de/jeter/chatex/utils/Config.java +++ b/src/main/java/de/jeter/chatex/utils/Config.java @@ -45,7 +45,7 @@ public enum Config { RANGE("chat-range", 100, "The range to talk to other players. Set to -1 to enable world-wide-chat"), LOGCHAT("logChat", false, "Should the chat be logged?"), DEBUG("debug", false, "Should the debug log be enabled?"), - PRIORITY("EventPriority", EventPriority.NORMAL.name(), "Choose the Eventpriority here of ChatEx. Listeners are called in following order: LOWEST -> LOW -> NORMAL -> HIGH -> HIGHEST -> MONITOR"), + PRIORITY("EventPriority", EventPriority.LOWEST.name(), "Choose the Eventpriority here of ChatEx. Listeners are called in following order: LOWEST -> LOW -> NORMAL -> HIGH -> HIGHEST -> MONITOR"), LOCALE("Locale", "en-EN", "Which language do you want? (You can choose betwenn de-DE, fr-FR, pt-BR, zh-CN and en-EN by default.)"), ADS_ENABLED("Ads.Enabled", true, "Should we check for ads?"), ADS_BYPASS("Ads.Bypass", Arrays.asList("127.0.0.1", "my-domain.com"), "A list with allowed ips or domains."), diff --git a/src/main/java/de/jeter/chatex/utils/Locales.java b/src/main/java/de/jeter/chatex/utils/Locales.java index 72c099d..fa36077 100644 --- a/src/main/java/de/jeter/chatex/utils/Locales.java +++ b/src/main/java/de/jeter/chatex/utils/Locales.java @@ -43,7 +43,7 @@ public enum Locales { PLAYER_JOIN_FIRST_TIME("Messages.Player.JoinFirstTime", "%prefix%displayname%suffix &ejoined the server for the first time!"), PLAYER_KICK("Messages.Player.Kick", "%prefix%displayname%suffix &ewas kicked from the game!"), PLAYER_QUIT("Messages.Player.Quit", "%prefix%displayname%suffix &eleft the game!"), - NO_LISTENING_PLAYERS("Messages.Chat.NoOneListens", "&cNo players are near you to hear you talking! Use the ranged mode to chat."), + NO_LISTENING_PLAYERS("Messages.Chat.NoOneListens", "&cNo players are near you to hear you talking! Try to use the global mode to chat globally."), UPDATE_FOUND("Messages.UpdateFound", "&a[ChatEx]&7 A new update has been found on SpigotMC. Current version: %oldversion New version: %newversion. Click this message to download it!"), ;