bots mabe
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user