Skip to content

Commit

Permalink
Update HotJoinC2SThread.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Jab125 committed Nov 23, 2024
1 parent b5bb85a commit 08b3c10
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/dev/jab125/hotjoin/server/HotJoinC2SThread.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.jab125.hotjoin.server;

import dev.jab125.hotjoin.HotJoin;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
Expand Down Expand Up @@ -34,8 +35,14 @@ private void run0() throws Throwable {
new Thread(() -> {
while (true) {
for (Consumer<HotJoinC2SThread> runnable : runnables) {
runnable.accept(this);
runnables.remove(runnable);
boolean success = false;
try {
runnable.accept(this);
success = true;
} catch (Throwable t) {
HotJoin.LOGGER.error("Failed to run action!", t);
}
if (success) runnables.remove(runnable);
}
}
}).start();
Expand Down

1 comment on commit 08b3c10

@angrybirds0706
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this or will hotjoin have 1.21.4 support?

Please sign in to comment.