bots mabe

This commit is contained in:
ChomeNS
2023-04-27 20:25:54 +07:00
parent b429a1e300
commit c2f05724fd
6 changed files with 21 additions and 25 deletions

View File

@@ -28,7 +28,7 @@ public class Bot {
@Getter private final Configuration config;
@Getter private List<Bot> allBots;
@Getter private List<Bot> bots;
@Getter private String username;
@@ -64,14 +64,14 @@ public class Bot {
@Getter private ExploitsPlugin exploits;
@Getter private FilterPlugin filter;
public Bot (Configuration.BotOption botOption, List<Bot> allBots, Configuration config) {
public Bot (Configuration.BotOption botOption, List<Bot> bots, Configuration config) {
this.host = botOption.host;
this.port = botOption.port;
this.options = botOption;
if (options.reconnectDelay == -1) options.reconnectDelay = config.reconnectDelay;
this.allBots = allBots;
this.bots = bots;
this.config = config;

View File

@@ -12,7 +12,7 @@ import java.util.ArrayList;
import java.util.List;
public class Main {
public static final List<Bot> allBots = new ArrayList<>();
public static final List<Bot> bots = new ArrayList<>();
public static void main(String[] args) throws IOException {
final File file = new File("config.yml");
@@ -65,10 +65,10 @@ public class Main {
}
for (Configuration.BotOption botOption : botsOptions) {
final Bot bot = new Bot(botOption, allBots, config);
allBots.add(bot);
final Bot bot = new Bot(botOption, bots, config);
bots.add(bot);
}
new ConsolePlugin(allBots, config, jda);
new ConsolePlugin(bots, config, jda);
}
}

View File

@@ -39,7 +39,7 @@ public class NetMessageCommand implements Command {
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
final Bot bot = context.bot();
final List<Bot> bots = bot.allBots();
final List<Bot> bots = bot.bots();
final String hostAndPort = bot.host() + ":" + bot.port();

View File

@@ -40,7 +40,7 @@ public class DiscordPlugin {
this.servers = options.servers();
this.jda = jda;
for (Bot bot : Main.allBots) {
for (Bot bot : Main.bots) {
String channelId = servers.get(bot.host() + ":" + bot.port());
bot.addListener(new Bot.Listener() {

View File

@@ -23,7 +23,7 @@ public class TrustedPlugin extends PlayersPlugin.PlayerListener {
}
public void broadcast (Component message, UUID exceptTarget) {
for (Bot bot : bot.allBots()) {
for (Bot bot : bot.bots()) {
if (!bot.loggedIn()) continue;
bot.logger().custom(Component.text("Trusted Broadcast").color(NamedTextColor.AQUA), message);