add hasEssentials to config

This commit is contained in:
Chayapak 2023-04-11 13:36:44 +07:00
parent 04eddcb12c
commit 74b51345bb
5 changed files with 16 additions and 8 deletions

View file

@ -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<Bot> 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<Bot> allBots, Configuration config) {
public Bot (String host, int port, String _username, boolean kaboom, String serverName, boolean useChat, boolean hasEssentials, List<Bot> 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;

View file

@ -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;
}
}

View file

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

View file

@ -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());
}

View file

@ -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