diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9aa3c88..b5d027f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,16 @@
-
+
+
+
+
+
+
+
+
+
+
@@ -34,26 +43,26 @@
-
+
- {
+ "keyToString": {
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "git-widget-placeholder": "master",
+ "jdk.selected.JAVA_MODULE": "17",
+ "last_opened_file_path": "/home/chayapak1/IdeaProjects/chomens-bot-java",
+ "project.structure.last.edited": "Modules",
+ "project.structure.proportion": "0.0",
+ "project.structure.side.proportion": "0.0",
+ "settings.editor.selected.configurable": "preferences.keymap"
}
-}]]>
+}
@@ -95,55 +104,6 @@
1680245437032
-
- 1681287412000
-
-
-
- 1681287412000
-
-
- 1681367090767
-
-
-
- 1681367090770
-
-
- 1681367264222
-
-
-
- 1681367264222
-
-
- 1681372930407
-
-
-
- 1681372930407
-
-
- 1681439228534
-
-
-
- 1681439228535
-
-
- 1681454086491
-
-
-
- 1681454086491
-
-
- 1681455582686
-
-
-
- 1681455582686
-
1681457880562
@@ -438,7 +398,56 @@
1682142828982
-
+
+ 1682164566394
+
+
+
+ 1682164566394
+
+
+ 1682167370618
+
+
+
+ 1682167370618
+
+
+ 1682168732774
+
+
+
+ 1682168732774
+
+
+ 1682169054135
+
+
+
+ 1682169054135
+
+
+ 1682169510400
+
+
+
+ 1682169510400
+
+
+ 1682169836895
+
+
+
+ 1682169836895
+
+
+ 1682170080224
+
+
+
+ 1682170080224
+
+
@@ -453,13 +462,6 @@
-
-
-
-
-
-
-
@@ -478,7 +480,14 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java
index 63397ec..66925f7 100644
--- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java
+++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java
@@ -23,15 +23,13 @@ public class Bot {
@Getter private final String host;
@Getter private final int port;
- private final String _username;
- @Getter private final boolean kaboom;
- @Getter private final String serverName;
- @Getter @Setter private boolean useCore;
- @Getter @Setter private boolean useChat;
- @Getter private final boolean hasEssentials;
- @Getter private final List allBots;
+
+ @Getter private final Configuration.BotOption options;
+
@Getter private final Configuration config;
+ @Getter private List allBots;
+
@Getter private String username;
@Getter public Session session;
@@ -65,16 +63,14 @@ public class Bot {
@Getter private MazePlugin maze;
@Getter private ExploitsPlugin exploits;
- public Bot (String host, int port, String _username, boolean kaboom, String serverName, boolean useCore, boolean useChat, boolean hasEssentials, List allBots, Configuration config) {
- this.host = host;
- this.port = port;
- this._username = _username;
- this.kaboom = kaboom;
- this.serverName = serverName;
- this.useCore = useCore;
- this.useChat = useChat;
- this.hasEssentials = hasEssentials;
+ public Bot (Configuration.BotOption botOption, List allBots, Configuration config) {
+ this.host = botOption.host;
+ this.port = botOption.port;
+
+ this.options = botOption;
+
this.allBots = allBots;
+
this.config = config;
ConsolePlugin.addListener(new ConsolePlugin.Listener() {
@@ -111,6 +107,8 @@ public class Bot {
}
public void reconnect () {
+ final String _username = options.username();
+
if (_username == null) username = RandomStringUtils.randomAlphabetic(8);
else username = _username;
diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java
index e4ae346..4e09511 100644
--- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java
+++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java
@@ -26,7 +26,7 @@ public class Configuration {
@Getter public List trusted = new ArrayList<>();
@Getter public SelfCare selfCare = new SelfCare();
- @Getter public Bots[] bots = new Bots[]{};
+ @Getter public BotOption[] bots = new BotOption[]{};
public static class Core {
@Getter public int layers = 3;
@@ -73,7 +73,7 @@ public class Configuration {
@Getter public int positionPacketsPerSecond = 10;
}
- public static class Bots {
+ public static class BotOption {
@Getter public String host;
@Getter public int port;
@Getter public String username;
diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java
index 3bfaf88..a6ff9ee 100644
--- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java
+++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java
@@ -48,7 +48,7 @@ public class Main {
final Configuration config = _config;
- Configuration.Bots[] botsOptions = config.bots();
+ Configuration.BotOption[] botsOptions = config.bots();
// idk if these should be here lol, but it is just the discord stuff
JDA jda = null;
@@ -64,17 +64,8 @@ public class Main {
System.exit(1);
}
- for (Configuration.Bots botOption : botsOptions) {
- final String host = botOption.host();
- final int port = botOption.port();
- final String username = botOption.username();
- final boolean kaboom = botOption.kaboom();
- final String serverName = botOption.serverName();
- final boolean useCore = botOption.useCore();
- final boolean useChat = botOption.useChat();
- final boolean hasEssentials = botOption.hasEssentials();
-
- final Bot bot = new Bot(host, port, username, kaboom, serverName, useCore, useChat, hasEssentials, allBots, config);
+ for (Configuration.BotOption botOption : botsOptions) {
+ final Bot bot = new Bot(botOption, allBots, config);
allBots.add(bot);
}
diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java
index 704eef2..62b1c6a 100644
--- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java
+++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java
@@ -181,7 +181,7 @@ public class ChatPlugin extends SessionAdapter {
}
public void tellraw (Component component, String targets) {
- if (bot.useChat()) {
+ if (bot.options().useChat()) {
if (!targets.equals("@a")) return; // worst fix of all time!1!
final String stringified = ComponentUtilities.stringifyMotd(component).replace("ยง", "&");
diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java
index 6db028f..d7f3072 100644
--- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java
+++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java
@@ -54,7 +54,7 @@ public class CorePlugin extends PositionPlugin.PositionListener {
public CorePlugin (Bot bot) {
this.bot = bot;
- this.kaboom = bot.kaboom();
+ this.kaboom = bot.options().kaboom();
bot.position().addListener(this);
@@ -78,7 +78,7 @@ public class CorePlugin extends PositionPlugin.PositionListener {
public void run (String command) {
if (!ready) return;
- if (bot.useCore()) {
+ if (bot.options().useCore()) {
bot.session().send(new ServerboundSetCommandBlockPacket(
absoluteCorePosition(),
command,
diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java
index 48a18c3..1322ff1 100644
--- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java
+++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/SelfCarePlugin.java
@@ -92,24 +92,24 @@ public class SelfCarePlugin extends SessionAdapter {
if (selfCares.gamemode() && gamemode != GameMode.CREATIVE) bot.chat().send("/minecraft:gamemode creative @s[type=player]");
else if (selfCares.op() && permissionLevel < 2) bot.chat().send("/minecraft:op @s[type=player]");
- else if (selfCares.cspy() && !cspy && bot.kaboom()) bot.chat().send("/commandspy:commandspy on");
- else if (selfCares.prefix() && !prefix && bot.kaboom()) bot.chat().send("/extras:prefix &8[&eChomeNS Bot&8]");
- else if (selfCares.username() && !username && bot.kaboom()) bot.chat().send("/extras:username " + bot.username());
+ else if (selfCares.cspy() && !cspy && bot.options().kaboom()) bot.chat().send("/commandspy:commandspy on");
+ else if (selfCares.prefix() && !prefix && bot.options().kaboom()) bot.chat().send("/extras:prefix &8[&eChomeNS Bot&8]");
+ else if (selfCares.username() && !username && bot.options().kaboom()) bot.chat().send("/extras:username " + bot.username());
else if (selfCares.icu().enabled() && positionPacketsPerSecond > selfCares.icu().positionPacketsPerSecond()) bot.core().run("essentials:sudo * icu stop");
- else if (selfCares.vanish() && !vanish && !visibility && bot.hasEssentials()) {
- if (bot.useChat()) bot.chat().send("/essentials:vanish enable");
+ else if (selfCares.vanish() && !vanish && !visibility && bot.options().hasEssentials()) {
+ if (bot.options().useChat()) bot.chat().send("/essentials:vanish enable");
else bot.core().run("essentials:vanish " + bot.username() + " enable");
}
- else if (selfCares.nickname() && !nickname && bot.hasEssentials()) {
- if (bot.useChat()) bot.chat().send("/essentials:nickname off");
+ else if (selfCares.nickname() && !nickname && bot.options().hasEssentials()) {
+ if (bot.options().useChat()) bot.chat().send("/essentials:nickname off");
else bot.core().run("essentials:nickname " + bot.username() + " off");
}
- else if (selfCares.socialspy() && !socialspy && bot.hasEssentials()) {
- if (bot.useChat()) bot.chat().send("/essentials:socialspy enable");
+ else if (selfCares.socialspy() && !socialspy && bot.options().hasEssentials()) {
+ if (bot.options().useChat()) bot.chat().send("/essentials:socialspy enable");
else bot.core().run("essentials:socialspy " + bot.username() + " enable");
}
- else if (selfCares.mute() && muted && bot.hasEssentials()) {
- if (bot.useChat()) bot.chat().send("/essentials:mute " + bot.username());
+ else if (selfCares.mute() && muted && bot.options().hasEssentials()) {
+ if (bot.options().useChat()) bot.chat().send("/essentials:mute " + bot.username());
else bot.core().run("essentials:mute " + bot.username());
}
}
diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TrustedPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TrustedPlugin.java
index 0ab93aa..7cf3eef 100644
--- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TrustedPlugin.java
+++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/TrustedPlugin.java
@@ -36,7 +36,7 @@ public class TrustedPlugin extends PlayersPlugin.PlayerListener {
final Component component = Component.translatable(
"[%s] [%s] %s",
Component.text("ChomeNS Bot").color(NamedTextColor.YELLOW),
- Component.text(this.bot.serverName()).color(NamedTextColor.GRAY),
+ Component.text(this.bot.options().serverName()).color(NamedTextColor.GRAY),
message.color(NamedTextColor.WHITE)
).color(NamedTextColor.DARK_GRAY);