[BUG] Fix user cache not reloading when a new member joins the server

This commit is contained in:
2023-10-23 21:17:18 +02:00
parent 9c89bc151b
commit 8055d5c975
3 changed files with 11 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
version_major=0
version_minor=0
version_patch=28
version_patch=29
shade_group=com.hypherionmc.sdlink.shaded.

View File

@@ -23,6 +23,7 @@ import net.dv8tion.jda.api.events.channel.ChannelCreateEvent;
import net.dv8tion.jda.api.events.channel.ChannelDeleteEvent;
import net.dv8tion.jda.api.events.guild.GuildBanEvent;
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent;
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
@@ -98,6 +99,13 @@ public class DiscordEventHandler extends ListenerAdapter {
}
}
@Override
public void onGuildMemberJoin(@NotNull GuildMemberJoinEvent event) {
if (event.getJDA().getStatus() == JDA.Status.CONNECTED) {
CacheManager.loadUserCache();
}
}
@Override
public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) {
if (event.getJDA().getStatus() == JDA.Status.CONNECTED) {

View File

@@ -3,8 +3,6 @@ package com.hypherionmc.sdlink.core.util;
import com.hypherionmc.sdlink.core.config.SDLinkConfig;
import com.hypherionmc.sdlink.core.discord.BotController;
import java.util.concurrent.TimeUnit;
public class Profiler {
private long startTime;
@@ -40,9 +38,9 @@ public class Profiler {
}
long stopTime = System.nanoTime();
double seconds = (double) (stopTime - startTime) / 1_000_000_000;
double seconds = (double) (stopTime - startTime) / 1_000_000;
BotController.INSTANCE.getLogger().info("[Profiler (" + this.profilerName + ")] " + message + " took " + seconds + " seconds");
BotController.INSTANCE.getLogger().info("[Profiler (" + this.profilerName + ")] " + message + " took " + seconds + " ms");
hasStarted = false;
}