the tag self care

This commit is contained in:
Chayapak 2023-07-13 20:43:23 +07:00
parent 16c79115ee
commit 3134d3e525
3 changed files with 29 additions and 0 deletions

View file

@ -70,6 +70,7 @@ public class Bot {
public MailPlugin mail;
public PacketSnifferPlugin packetSniffer;
public VoiceChatPlugin voiceChat;
public TagPlugin tag;
public Bot (Configuration.BotOption botOption, List<Bot> bots, Configuration config) {
this.host = botOption.host;
@ -115,6 +116,7 @@ public class Bot {
this.mail = new MailPlugin(this);
this.packetSniffer = new PacketSnifferPlugin(this);
this.voiceChat = new VoiceChatPlugin(this);
this.tag = new TagPlugin(this);
for (Listener listener : listeners) listener.loadedPlugins();

View file

@ -330,10 +330,13 @@ public class CorePlugin extends PositionPlugin.Listener {
// bot.chat.send(command);
runPlaceBlock(command);
for (Listener listener : listeners) listener.refilled();
}
public static class Listener {
public void ready () {}
public void refilled () {}
}
public void addListener (Listener listener) { listeners.add(listener); }

View file

@ -0,0 +1,24 @@
package land.chipmunk.chayapak.chomens_bot.plugins;
import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.util.UUIDUtilities;
// TODO: self care
public class TagPlugin extends CorePlugin.Listener {
private final Bot bot;
public final String tag = "chomens_bot";
public TagPlugin (Bot bot) {
this.bot = bot;
bot.core.addListener(this);
}
@Override
public void ready () { // might not be the best idea but whatever
final String command = "minecraft:tag " + UUIDUtilities.selector(bot.profile.getId()) + " add " + tag;
System.out.println(command);
bot.core.run(command);
}
}