lazy fix the sus issue + add package to idea config
This commit is contained in:
@@ -84,6 +84,12 @@ public class Bot {
|
||||
this.bruhify = new BruhifyPlugin(this);
|
||||
this.grepLog = new GrepLogPlugin(this);
|
||||
|
||||
try {
|
||||
Thread.sleep(1000); // real
|
||||
} catch (InterruptedException ignored) {
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
reconnect();
|
||||
}
|
||||
|
||||
@@ -99,10 +105,13 @@ public class Bot {
|
||||
|
||||
@Override
|
||||
public void packetReceived(Session session, Packet packet) {
|
||||
for (SessionListener listener : listeners) {
|
||||
if (packet instanceof ClientboundLoginPacket) {
|
||||
if (packet instanceof ClientboundLoginPacket) {
|
||||
for (SessionListener listener : listeners) {
|
||||
listener.connected(new ConnectedEvent(session));
|
||||
}
|
||||
}
|
||||
|
||||
for (SessionListener listener : listeners) {
|
||||
listener.packetReceived(session, packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,6 @@ public class DiscordPlugin {
|
||||
for (Bot bot : Main.allBots) {
|
||||
String channelId = servers.get(bot.host() + ":" + bot.port());
|
||||
|
||||
bot.discord(this);
|
||||
|
||||
bot.addListener(new SessionAdapter() {
|
||||
@Override
|
||||
public void connected(ConnectedEvent event) {
|
||||
@@ -80,8 +78,6 @@ public class DiscordPlugin {
|
||||
|
||||
if (channelAlreadyAddedListeners) return;
|
||||
|
||||
alreadyAddedListeners.put(channelId, true);
|
||||
|
||||
jda.addEventListener(new ListenerAdapter() {
|
||||
@Override
|
||||
public void onMessageReceived(@NotNull MessageReceivedEvent event) {
|
||||
@@ -176,6 +172,8 @@ public class DiscordPlugin {
|
||||
}
|
||||
});
|
||||
|
||||
alreadyAddedListeners.put(channelId, true);
|
||||
|
||||
bot.executor().scheduleAtFixedRate(() -> onDiscordTick(channelId), 0, 50, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@@ -184,6 +182,8 @@ public class DiscordPlugin {
|
||||
sendMessageInstantly("Disconnected: " + "`" + event.getReason().replace("`", "\\`") + "`", channelId);
|
||||
}
|
||||
});
|
||||
|
||||
bot.discord(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user