Skip to content

Commit

Permalink
Make cross-server chat possible without '!' character. Fixes #134
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJeterLP committed Jan 8, 2024
1 parent f77e089 commit 95b8bc8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/de/jeter/chatex/ChatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()), "");
Expand All @@ -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);
Expand Down

0 comments on commit 95b8bc8

Please # to comment.