bots mabe

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

View file

@ -4,12 +4,8 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="chat queue delay in config">
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="new 1.19.4 update i guess">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PositionPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/PositionPlugin.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -101,13 +97,6 @@
<option name="presentableId" value="Default" />
<updated>1680245437032</updated>
</task>
<task id="LOCAL-00078" summary="actually probably fix thing (it kick others)">
<created>1681728469710</created>
<option name="number" value="00078" />
<option name="presentableId" value="LOCAL-00078" />
<option name="project" value="LOCAL" />
<updated>1681728469710</updated>
</task>
<task id="LOCAL-00079" summary="FINALLY FIX EXTRA COLOR PARSING LETS GOOOOOOO&#10;messy code but whatever,..,.,">
<created>1681806588635</created>
<option name="number" value="00079" />
@ -444,7 +433,14 @@
<option name="project" value="LOCAL" />
<updated>1682497425727</updated>
</task>
<option name="localTasksCounter" value="127" />
<task id="LOCAL-00127" summary="new 1.19.4 update i guess">
<created>1682596318209</created>
<option name="number" value="00127" />
<option name="presentableId" value="LOCAL-00127" />
<option name="project" value="LOCAL" />
<updated>1682596318211</updated>
</task>
<option name="localTasksCounter" value="128" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -459,7 +455,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="log exception for funni?" />
<MESSAGE value="fart?!?!?!" />
<MESSAGE value="probably lazy fix the sus" />
<MESSAGE value="improve bot options? mabe mabe" />
@ -484,7 +479,8 @@
<MESSAGE value="fix fallback name?" />
<MESSAGE value="make time output shorter?&#10;mabe" />
<MESSAGE value="chat queue delay in config" />
<option name="LAST_COMMIT_MESSAGE" value="chat queue delay in config" />
<MESSAGE value="new 1.19.4 update i guess" />
<option name="LAST_COMMIT_MESSAGE" value="new 1.19.4 update i guess" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

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);