fix: make the events work with new adventure and improve SNBTUtilities a bit

This commit is contained in:
ChomeNS
2025-05-19 18:39:18 +07:00
parent b4f0958202
commit 0f28e8c900
10 changed files with 42 additions and 84 deletions

View File

@@ -3,8 +3,8 @@ package me.chayapak1.chomens_bot.evalFunctions;
import me.chayapak1.chomens_bot.Bot;
import me.chayapak1.chomens_bot.data.eval.EvalFunction;
import me.chayapak1.chomens_bot.data.listener.Listener;
import me.chayapak1.chomens_bot.util.SNBTUtilities;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
public class GetLatestChatMessageFunction extends EvalFunction implements Listener {
private String latestMessage = "";
@@ -17,7 +17,7 @@ public class GetLatestChatMessageFunction extends EvalFunction implements Listen
@Override
public boolean onSystemMessageReceived (final Component component, final String string, final String ansi) {
latestMessage = GsonComponentSerializer.gson().serialize(component);
latestMessage = SNBTUtilities.fromComponent(false, component);
return true;
}