Skip to content

Commit b07cf02

Browse files
Add try catch for syncing
1 parent 7c9e57a commit b07cf02

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/src/main/java/com/soulfiremc/server/plugins/POVServer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,15 @@ public void packetSent(Session botSession, Packet packet) {
930930
}
931931
});
932932
botConnection.scheduler().schedule(() -> {
933-
syncBotAndUser(botConnection, clientSession);
933+
try {
934+
syncBotAndUser(botConnection, clientSession);
935+
} catch (Throwable t) {
936+
log.error("Failed to sync bot and user", t);
937+
clientSession.send(new ClientboundSystemChatPacket(
938+
Component.text("Error while syncing you with the bot! Report this error to SoulFire developers.")
939+
.color(NamedTextColor.RED),
940+
false));
941+
}
934942

935943
// Give the client a few moments to process the packets
936944
TimeUtil.waitTime(2, TimeUnit.SECONDS);

0 commit comments

Comments
 (0)