Skip to content

Commit

Permalink
Don't send chat message if it is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Gegy committed Nov 3, 2023
1 parent 648678d commit fe32358
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/org/jedi/JustEnoughDiscordIntegrationMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class JustEnoughDiscordIntegrationMod {
private static ForgeConfigSpec.ConfigValue<String> serverStartedEntry;
private static ForgeConfigSpec.ConfigValue<String> serverShuttingDownEntry;
private static ForgeConfigSpec.ConfigValue<String> replyingToEntry;
private static ForgeConfigSpec.ConfigValue<Boolean> sendDeathMessages;
private static ForgeConfigSpec.BooleanValue sendDeathMessages;

private static ForgeConfigSpec.ConfigValue<String> botTokenEntry;
private static ForgeConfigSpec.ConfigValue<List<? extends String>> webhookEntries;
Expand Down Expand Up @@ -225,10 +225,12 @@ public void onServerChatEvent(ServerChatEvent event) {
try {
final String username = event.getUsername();
final String message = event.getMessage().getString();
final String uuid = event.getPlayer().getStringUUID();
final String cacheBust = CACHE_BUSTS.getOrDefault(event.getPlayer().getUUID(), username);
if (!message.isBlank()) {
final String uuid = event.getPlayer().getStringUUID();
final String cacheBust = CACHE_BUSTS.getOrDefault(event.getPlayer().getUUID(), username);

sendMessage(message, username, new URL(String.format(VISAGE_URL, uuid, cacheBust)));
sendMessage(message, username, new URL(String.format(VISAGE_URL, uuid, cacheBust)));
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit fe32358

Please sign in to comment.