Clean up DiscordToMinecraftListener

This commit is contained in:
Allink 2022-05-25 17:18:49 +01:00
parent 0fc5b01b29
commit 1726050d65
No known key found for this signature in database
GPG Key ID: 7F1F1B98F0FAAD13

View File

@ -26,10 +26,26 @@ public class DiscordToMinecraftListener extends ListenerAdapter
public void onMessageReceived(MessageReceivedEvent event)
{
String chat_channel_id = ConfigEntry.DISCORD_CHAT_CHANNEL_ID.getString();
if (event.getMember() != null && !chat_channel_id.isEmpty() && event.getChannel().getId().equals(chat_channel_id))
if (event.getMember() == null)
{
if (!event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()))
return;
}
if (chat_channel_id.isEmpty())
{
return;
}
if (event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()))
{
return;
}
if (!event.getChannel().getId().equals(chat_channel_id))
{
return;
}
Member member = event.getMember();
String tag = getDisplay(member);
Message msg = event.getMessage();
@ -93,8 +109,7 @@ public class DiscordToMinecraftListener extends ListenerAdapter
FLog.info(TextComponent.toLegacyText(components), true);
}
}
}
public String getDisplay(Member member)
{