From 022a5914c24b92d826dbb41c44cb3318be070ff4 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Tue, 5 Jan 2021 22:03:27 +0000 Subject: [PATCH] Fix multiple chat messages in one update appearing out of order --- src/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 2017eda..eeb5e0c 100644 --- a/src/api.ts +++ b/src/api.ts @@ -524,8 +524,9 @@ function buildUpdates(data: Array): DynmapUpdates { } } + //Sort chat by newest first updates.chat = updates.chat.sort((one, two) => { - return one.timestamp - two.timestamp; + return two.timestamp - one.timestamp; }); console.debug(`Updates: ${accepted} accepted. Rejected: `, dropped);