add kaboom in config for self care and core

This commit is contained in:
ChomeNS 2023-03-24 16:15:26 +07:00
parent ada2f66cdb
commit c7fdad965f
5 changed files with 13 additions and 6 deletions

View file

@ -22,6 +22,7 @@ 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 List<Bot> allBots;
@Getter private final Configuration config;
@ -41,10 +42,11 @@ public class Bot {
@Getter private final MusicPlayerPlugin music;
@Getter private final TPSPlugin tps;
public Bot (String host, int port, String _username, List<Bot> allBots, Configuration config) {
public Bot (String host, int port, String _username, boolean kaboom, List<Bot> allBots, Configuration config) {
this.host = host;
this.port = port;
this._username = _username;
this.kaboom = kaboom;
this.allBots = allBots;
this.config = config;

View file

@ -37,5 +37,6 @@ public class Configuration {
@Getter public String host;
@Getter public int port;
@Getter public String username;
@Getter public boolean kaboom = false;
}
}

View file

@ -54,9 +54,10 @@ public class Main {
final String host = botOption.host();
final int port = botOption.port();
final String username = botOption.username();
final boolean kaboom = botOption.kaboom();
new Thread(() -> {
final Bot bot = new Bot(host, port, username, allBots, config);
final Bot bot = new Bot(host, port, username, kaboom, allBots, config);
allBots.add(bot);
latch.countDown();

View file

@ -36,8 +36,11 @@ public class CorePlugin extends PositionPlugin.PositionListener {
public Vector3i relativeCorePosition = Vector3i.from(coreStart);
private boolean kaboom;
public CorePlugin (Bot bot) {
this.bot = bot;
this.kaboom = bot.kaboom();
bot.position().addListener(this);
@ -61,7 +64,7 @@ public class CorePlugin extends PositionPlugin.PositionListener {
bot.session().send(new ServerboundSetCommandBlockPacket(
absoluteCorePosition(),
command,
CommandBlockMode.REDSTONE,
kaboom ? CommandBlockMode.AUTO : CommandBlockMode.REDSTONE,
true,
false,
true
@ -155,7 +158,7 @@ public class CorePlugin extends PositionPlugin.PositionListener {
);
final Session session = bot.session();
session.send(new ServerboundSetCreativeModeSlotPacket(36, new ItemStack(347 /* command block id */, 64, new CompoundTag("", tag))));
session.send(new ServerboundSetCreativeModeSlotPacket(36, new ItemStack(kaboom ? 466 /* repeating command block id */ : 347 /* command block id */, 64, new CompoundTag("", tag))));
session.send(new ServerboundPlayerActionPacket(PlayerAction.START_DIGGING, temporaryBlockPosition, Direction.NORTH, 0));
session.send(new ServerboundUseItemOnPacket(temporaryBlockPosition, Direction.UP, Hand.MAIN_HAND, 0.5f, 0.5f, 0.5f, false, 1));
}

View file

@ -82,12 +82,12 @@ 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.chat().send("/commandspy:commandspy on");
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.prefix() && !prefix) bot.chat().send("/extras:prefix &8[&eChomeNS Bot&8]");
else if (selfCares.prefix() && !prefix && bot.kaboom()) bot.chat().send("/extras:prefix &8[&eChomeNS Bot&8]");
}
@Override