fix: selfcare being scheduled every single login, causing spam and memory leak

caused while i refactor the thing
This commit is contained in:
ChomeNS
2025-04-11 11:00:25 +07:00
parent ee6811ccd2
commit 057ee9095f
2 changed files with 5 additions and 7 deletions

View File

@@ -45,6 +45,8 @@ public class SelfCarePlugin extends Bot.Listener implements ChatPlugin.Listener
public SelfCarePlugin (final Bot bot) {
this.bot = bot;
bot.executor.scheduleAtFixedRate(this::check, 0, bot.config.selfCare.delay, TimeUnit.MILLISECONDS);
bot.addListener(this);
bot.chat.addListener(this);
}
@@ -87,6 +89,8 @@ public class SelfCarePlugin extends Bot.Listener implements ChatPlugin.Listener
}
public void check () {
if (!bot.loggedIn) return;
final Configuration.SelfCare selfCares = bot.config.selfCare;
final boolean kaboom = bot.serverFeatures.hasExtras;
@@ -149,12 +153,6 @@ public class SelfCarePlugin extends Bot.Listener implements ChatPlugin.Listener
socialspy = false;
muted = false;
prefix = false;
bot.executor.scheduleAtFixedRate(() -> {
if (!bot.loggedIn) return;
check();
}, 0, bot.config.selfCare.delay, TimeUnit.MILLISECONDS);
}
private void packetReceived (final ClientboundGameEventPacket packet) {