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 af47930..e418126 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java @@ -26,6 +26,7 @@ public class Bot { @Getter private final boolean kaboom; @Getter private final String serverName; @Getter @Setter private boolean useChat; + @Getter private final boolean hasEssentials; @Getter private final List allBots; @Getter private final Configuration config; @@ -61,13 +62,14 @@ public class Bot { @Getter private CloopPlugin cloop; @Getter private MazePlugin maze; - public Bot (String host, int port, String _username, boolean kaboom, String serverName, boolean useChat, List allBots, Configuration config) { + public Bot (String host, int port, String _username, boolean kaboom, String serverName, boolean useChat, boolean hasEssentials, List allBots, Configuration config) { this.host = host; this.port = port; this._username = _username; this.kaboom = kaboom; this.serverName = serverName; this.useChat = useChat; + this.hasEssentials = hasEssentials; this.allBots = allBots; this.config = config; 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 a5d3e81..5be8c89 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java @@ -67,5 +67,6 @@ public class Configuration { @Getter public boolean kaboom = false; @Getter public String serverName; @Getter public boolean useChat = false; + @Getter public boolean hasEssentials = false; } } 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 c343b96..38deec9 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java @@ -71,8 +71,9 @@ public class Main { final boolean kaboom = botOption.kaboom(); final String serverName = botOption.serverName(); final boolean useChat = botOption.useChat(); + final boolean hasEssentials = botOption.hasEssentials(); - final Bot bot = new Bot(host, port, username, kaboom, serverName, useChat, allBots, config); + final Bot bot = new Bot(host, port, username, kaboom, serverName, useChat, hasEssentials, allBots, config); allBots.add(bot); } 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 7fd7148..76c7524 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 @@ -84,10 +84,10 @@ 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.vanish() && !vanish && !visibility) bot.chat().send("/essentials:vanish enable"); - else if (selfCares.nickname() && !nickname) bot.chat().send("/essentials:nickname off"); - else if (selfCares.socialspy() && !socialspy) bot.chat().send("/essentials:socialspy enable"); - else if (selfCares.mute() && muted) bot.chat().send("/essentials:mute " + bot.username()); + else if (selfCares.vanish() && !vanish && !visibility && bot.hasEssentials()) bot.chat().send("/essentials:vanish enable"); + else if (selfCares.nickname() && !nickname && bot.hasEssentials()) bot.chat().send("/essentials:nickname off"); + else if (selfCares.socialspy() && !socialspy && bot.hasEssentials()) bot.chat().send("/essentials:socialspy enable"); + else if (selfCares.mute() && muted && bot.hasEssentials()) bot.chat().send("/essentials:mute " + bot.username()); 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()); } diff --git a/src/main/resources/default-config.yml b/src/main/resources/default-config.yml index b3a7ff0..3457ad8 100644 --- a/src/main/resources/default-config.yml +++ b/src/main/resources/default-config.yml @@ -55,9 +55,13 @@ bots: # username and kaboom are optional. # for username if it doesn't exist it will default to random username # for kaboom it will just default to `false` + # for serverName name it whatever you like, it will be used as server name in trusted broadcast + # for useChat when the bot sends output (tellraw) it will chat instead of using the core to run tellraw + # for hasEssentials it is self-explanatory. if the server has essentials plugin just set it to true - host: 'localhost' port: 25565 username: 'ChomeNS_Bot' kaboom: false - serverName: 'Localhost' # name it whatever you like, it will be used as server name in trusted broadcast - useChat: false # when the bot sends output (tellraw) it will chat instead of using the core to run tellraw + serverName: 'Localhost' + useChat: false + hasEssentials: false