From 8832efeb05b9fe7e9e7a8198d0a16280bdca9659 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Wed, 18 Jun 2025 20:11:09 +0700 Subject: [PATCH] feat: login message (and also command), for use with ayunboom --- build-number.txt | 2 +- src/main/java/me/chayapak1/chomens_bot/Bot.java | 2 ++ src/main/java/me/chayapak1/chomens_bot/Configuration.java | 1 + src/main/resources/default-config.yml | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build-number.txt b/build-number.txt index bd2735df..26b3ecce 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -3461 \ No newline at end of file +3462 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/Bot.java b/src/main/java/me/chayapak1/chomens_bot/Bot.java index cf9f5504..13f42e1c 100644 --- a/src/main/java/me/chayapak1/chomens_bot/Bot.java +++ b/src/main/java/me/chayapak1/chomens_bot/Bot.java @@ -258,6 +258,8 @@ public class Bot extends SessionAdapter { this.listener.dispatch(listener -> listener.connected(new ConnectedEvent(session))); session.send(ServerboundPlayerLoadedPacket.INSTANCE); + + if (!options.loginMessage.isBlank()) this.chat.send(options.loginMessage); } private void packetReceived (final ClientboundCustomQueryPacket packet) { diff --git a/src/main/java/me/chayapak1/chomens_bot/Configuration.java b/src/main/java/me/chayapak1/chomens_bot/Configuration.java index 199e44ae..15c8ade1 100644 --- a/src/main/java/me/chayapak1/chomens_bot/Configuration.java +++ b/src/main/java/me/chayapak1/chomens_bot/Configuration.java @@ -166,6 +166,7 @@ public class Configuration { public boolean resolveSRV = true; public int reconnectDelay = 2000; public int chatQueueDelay = 125; + public String loginMessage = ""; public EssentialsMessages essentialsMessages = new EssentialsMessages(); public CoreRateLimit coreRateLimit = new CoreRateLimit(); diff --git a/src/main/resources/default-config.yml b/src/main/resources/default-config.yml index e10bd689..8ad26c22 100644 --- a/src/main/resources/default-config.yml +++ b/src/main/resources/default-config.yml @@ -140,6 +140,7 @@ bots: # useCorePlaceBlock - uses the place block core instead of the main core. only used if useCore is enabled # useChat - when the bot tellraws it will chat instead of using the core to run tellraw # useSNBTComponents - if the server is >=1.21.5, it's pretty likely that you can enable this since 1.21.5 supports SNBT components + # loginMessage - the message to send when the bot received the login packet, this can also be a command, just prefix it with `/` # coreCommandSpy - set to true if server supports enabling player's commandspy through command block, defaults to true # logConnectionStatusMessages - logs connecting and disconnected messages to console (and the log file) and discord if set to true, defaults to true # resolveSRV - whether to resolve SRV records on the server. the notchian minecraft doesn't resolve them @@ -165,6 +166,7 @@ bots: # useCorePlaceBlock: false # useChat: false # useSNBTComponents: true + # loginMessage: '' # coreCommandSpy: true # logConnectionStatusMessages: true # resolveSRV: true