Skip to content

Commit

Permalink
add more debug messages for DiscordHook
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomut0 committed Aug 6, 2024
1 parent 3b51299 commit 6d1f565
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,16 @@ public void onPlayerUnlinking(AccountUnlinkedEvent event) {
protected void setupDiscord() {
Map<String, TextChannel> discordTagChannels = getCachedChannels().stream().
collect(Collectors.toMap(TextChannel::getName, textChannel -> textChannel));
SimpleClans.debug("DiscordTagChannels before clearing: " + String.join(",", discordTagChannels.keySet()));

clearChannels(discordTagChannels);
SimpleClans.debug("DiscordTagChannels after clearing: " + String.join(",", discordTagChannels.keySet()));

resetPermissions(discordTagChannels);

SimpleClans.debug("ClanTags before creating: " + String.join(",", clanTags));
createChannels(discordTagChannels);
SimpleClans.debug("ClanTags after creating: " + String.join(",", clanTags));
}

@NotNull
Expand Down Expand Up @@ -384,6 +390,7 @@ public void createChannel(@NotNull String clanTag)
clanTag, response.code, response.message));
return;
}

for (Map.Entry<ClanPlayer, Member> entry : discordClanPlayers.entrySet()) {
// The map is formed from clan#getMembers (so the clan exists)
//noinspection ConstantConditions
Expand Down Expand Up @@ -592,7 +599,7 @@ private void validateChannel(@NotNull String clanTag)
}

Map<ClanPlayer, Member> discordClanPlayers = getDiscordPlayers(clan);
if (discordClanPlayers.size() == 0) {
if (discordClanPlayers.isEmpty()) {
throw new InvalidChannelException(String.format("Clan %s doesn't have any linked players", clanTag),
"your.clan.doesnt.have.any.linked.player");
}
Expand Down

0 comments on commit 6d1f565

Please sign in to comment.