feat: actual ayunboom server self care
This commit is contained in:
@@ -258,8 +258,6 @@ 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) {
|
||||
|
||||
@@ -156,6 +156,7 @@ public class Configuration {
|
||||
public String serverName;
|
||||
public String discordChannelId;
|
||||
public String ircChannel;
|
||||
public boolean isAyunBoom = false;
|
||||
public boolean hidden = false;
|
||||
public boolean useCore = true;
|
||||
public boolean useCorePlaceBlock = false;
|
||||
@@ -166,7 +167,6 @@ 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();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import me.chayapak1.chomens_bot.data.listener.Listener;
|
||||
import me.chayapak1.chomens_bot.data.player.PlayerEntry;
|
||||
import me.chayapak1.chomens_bot.data.selfCare.SelfCare;
|
||||
import me.chayapak1.chomens_bot.data.selfCare.SelfData;
|
||||
import me.chayapak1.chomens_bot.selfCares.ayunboom.AyunBoomSelfCare;
|
||||
import me.chayapak1.chomens_bot.selfCares.essentials.*;
|
||||
import me.chayapak1.chomens_bot.selfCares.kaboom.commandSpy.CommandSpySelfCare;
|
||||
import me.chayapak1.chomens_bot.selfCares.kaboom.extras.PrefixSelfCare;
|
||||
@@ -53,6 +54,9 @@ public class SelfCarePlugin implements Listener {
|
||||
// kaboom - iControlUwU
|
||||
selfCares.add(new IControlUSelfCare(bot));
|
||||
|
||||
// ayunboom
|
||||
selfCares.add(new AyunBoomSelfCare(bot));
|
||||
|
||||
// essentials
|
||||
selfCares.add(new VanishSelfCare(bot));
|
||||
selfCares.add(new NicknameSelfCare(bot));
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package me.chayapak1.chomens_bot.selfCares.ayunboom;
|
||||
|
||||
import me.chayapak1.chomens_bot.Bot;
|
||||
import me.chayapak1.chomens_bot.data.selfCare.SelfCare;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||
|
||||
public class AyunBoomSelfCare extends SelfCare {
|
||||
public AyunBoomSelfCare (final Bot bot) {
|
||||
super(bot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRun () {
|
||||
return bot.options.isAyunBoom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceived (final Packet packet) {
|
||||
if (packet instanceof final ClientboundLoginPacket t_packet) onPacketReceived(t_packet);
|
||||
}
|
||||
|
||||
private void onPacketReceived (final ClientboundLoginPacket ignoredPacket) {
|
||||
this.needsRunning = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived (final Component component, final String string) {
|
||||
if (string.equals("Unable to connect you to ayunboom. Please try again later.")) this.needsRunning = true;
|
||||
else if (string.equals("You are already connected to this server!")) this.needsRunning = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run () {
|
||||
bot.chat.sendCommandInstantly("server ayunboom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup () {
|
||||
this.needsRunning = true;
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,6 @@ 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
|
||||
@@ -161,12 +160,12 @@ bots:
|
||||
# serverName: 'Localhost'
|
||||
# discordChannelId: '1234567890'
|
||||
# ircChannel: '#chomens/localhost'
|
||||
# isAyunBoom: false
|
||||
# hidden: false
|
||||
# useCore: true
|
||||
# useCorePlaceBlock: false
|
||||
# useChat: false
|
||||
# useSNBTComponents: true
|
||||
# loginMessage: ''
|
||||
# coreCommandSpy: true
|
||||
# logConnectionStatusMessages: true
|
||||
# resolveSRV: true
|
||||
|
||||
Reference in New Issue
Block a user