feat: getBotUsername eval function

This commit is contained in:
Chayapak 2024-11-02 15:29:47 +07:00
parent c655b5d0cd
commit 9e22cdfea5
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
2 changed files with 17 additions and 4 deletions

View file

@ -0,0 +1,15 @@
package me.chayapak1.chomens_bot.evalFunctions;
import me.chayapak1.chomens_bot.Bot;
import me.chayapak1.chomens_bot.data.eval.EvalFunction;
public class GetBotUsernameFunction extends EvalFunction {
public GetBotUsernameFunction (Bot bot) {
super("getBotUsername", bot);
}
@Override
public Output execute(Object... args) {
return new Output(bot.username, false);
}
}

View file

@ -7,10 +7,7 @@ import io.socket.client.Socket;
import me.chayapak1.chomens_bot.Bot; import me.chayapak1.chomens_bot.Bot;
import me.chayapak1.chomens_bot.data.eval.EvalFunction; import me.chayapak1.chomens_bot.data.eval.EvalFunction;
import me.chayapak1.chomens_bot.data.eval.EvalOutput; import me.chayapak1.chomens_bot.data.eval.EvalOutput;
import me.chayapak1.chomens_bot.evalFunctions.ChatFunction; import me.chayapak1.chomens_bot.evalFunctions.*;
import me.chayapak1.chomens_bot.evalFunctions.CoreFunction;
import me.chayapak1.chomens_bot.evalFunctions.CorePlaceBlockFunction;
import me.chayapak1.chomens_bot.evalFunctions.GetPlayerListFunction;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -38,6 +35,7 @@ public class EvalPlugin {
functions.add(new CorePlaceBlockFunction(bot)); functions.add(new CorePlaceBlockFunction(bot));
functions.add(new ChatFunction(bot)); functions.add(new ChatFunction(bot));
functions.add(new GetPlayerListFunction(bot)); functions.add(new GetPlayerListFunction(bot));
functions.add(new GetBotUsernameFunction(bot));
try { try {
socket = IO.socket(bot.config.eval.address); socket = IO.socket(bot.config.eval.address);