Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[DEBUG] Add some debug messages #138

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<groupId>de.jeter</groupId>
<artifactId>ChatEx</artifactId>
<name>ChatEx</name>
<inceptionYear>2022</inceptionYear>
<inceptionYear>2024</inceptionYear>

<version>3.1.0</version>
<version>3.2.0</version>
<description>ChatManagement plugin for Bukkit</description>
<url>https://www.spigotmc.org/resources/chatex-continued.71041/</url>

Expand Down
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
2 changes: 1 addition & 1 deletion src/main/java/de/jeter/chatex/utils/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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."),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/jeter/chatex/utils/Locales.java
Original file line number Diff line number Diff line change
Expand Up @@ -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!"),
;

Expand Down