forked from ChomeNS/chomens-bot-java
make self care not use ch at queue
This commit is contained in:
parent
07187e7b75
commit
c713634584
4 changed files with 34 additions and 21 deletions
|
@ -87,6 +87,8 @@ public class Configuration {
|
|||
}
|
||||
|
||||
public static class SelfCare {
|
||||
public int delay = 225;
|
||||
|
||||
public boolean op = true;
|
||||
public boolean gamemode = true;
|
||||
public boolean endCredits = true;
|
||||
|
|
|
@ -226,28 +226,36 @@ public class ChatPlugin extends Bot.Listener {
|
|||
}
|
||||
}
|
||||
|
||||
bot.session.send(new ServerboundChatCommandPacket(
|
||||
removedMessage,
|
||||
Instant.now().toEpochMilli(),
|
||||
0L,
|
||||
Collections.emptyList(),
|
||||
0,
|
||||
new BitSet()
|
||||
));
|
||||
sendCommandInstantly(removedMessage);
|
||||
} else {
|
||||
bot.session.send(new ServerboundChatPacket(
|
||||
message,
|
||||
Instant.now().toEpochMilli(),
|
||||
0L,
|
||||
null,
|
||||
0,
|
||||
new BitSet()
|
||||
));
|
||||
sendChatInstantly(message);
|
||||
}
|
||||
|
||||
queue.remove(0);
|
||||
}
|
||||
|
||||
public void sendCommandInstantly (String command) {
|
||||
bot.session.send(new ServerboundChatCommandPacket(
|
||||
command,
|
||||
Instant.now().toEpochMilli(),
|
||||
0L,
|
||||
Collections.emptyList(),
|
||||
0,
|
||||
new BitSet()
|
||||
));
|
||||
}
|
||||
|
||||
public void sendChatInstantly (String message) {
|
||||
bot.session.send(new ServerboundChatPacket(
|
||||
message,
|
||||
Instant.now().toEpochMilli(),
|
||||
0L,
|
||||
null,
|
||||
0,
|
||||
new BitSet()
|
||||
));
|
||||
}
|
||||
|
||||
public void clearQueue () { queue.clear(); }
|
||||
|
||||
public void send (String message) {
|
||||
|
|
|
@ -94,21 +94,22 @@ public class SelfCarePlugin extends Bot.Listener {
|
|||
else if (selfCares.username && !username && bot.options.kaboom) bot.chat.send("/extras:username " + bot.username);
|
||||
|
||||
// core
|
||||
// TODO: improve lol
|
||||
else if (selfCares.icu.enabled && positionPacketsPerSecond > selfCares.icu.positionPacketsPerSecond) bot.core.run("essentials:sudo * icu stop");
|
||||
else if (selfCares.vanish && !vanish && !visibility && bot.options.hasEssentials) {
|
||||
if (bot.options.useChat) bot.chat.send("/essentials:vanish enable");
|
||||
if (bot.options.useChat) bot.chat.sendCommandInstantly("essentials:vanish enable");
|
||||
else bot.core.run("essentials:vanish " + bot.username + " enable");
|
||||
}
|
||||
else if (selfCares.nickname && !nickname && bot.options.hasEssentials) {
|
||||
if (bot.options.useChat) bot.chat.send("/essentials:nick off");
|
||||
if (bot.options.useChat) bot.chat.sendCommandInstantly("essentials:nick off");
|
||||
else bot.core.run("essentials:nickname " + bot.username + " off");
|
||||
}
|
||||
else if (selfCares.socialspy && !socialspy && bot.options.hasEssentials) {
|
||||
if (bot.options.useChat) bot.chat.send("/essentials:socialspy enable");
|
||||
if (bot.options.useChat) bot.chat.sendCommandInstantly("essentials:socialspy enable");
|
||||
else bot.core.run("essentials:socialspy " + bot.username + " enable");
|
||||
}
|
||||
else if (selfCares.mute && muted && bot.options.hasEssentials) {
|
||||
if (bot.options.useChat) bot.chat.send("/essentials:mute " + bot.profile.getIdAsString());
|
||||
if (bot.options.useChat) bot.chat.sendCommandInstantly("essentials:mute " + bot.profile.getIdAsString());
|
||||
else bot.core.run("essentials:mute " + bot.profile.getIdAsString());
|
||||
|
||||
muted = false; // too lazy fix and probably the worst fix?
|
||||
|
@ -140,7 +141,7 @@ public class SelfCarePlugin extends Bot.Listener {
|
|||
check();
|
||||
};
|
||||
|
||||
checkTask = bot.executor.scheduleAtFixedRate(task, 0, bot.options.chatQueueDelay + 75, TimeUnit.MILLISECONDS);
|
||||
checkTask = bot.executor.scheduleAtFixedRate(task, 0, bot.config.selfCare.delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void packetReceived (ClientboundGameEventPacket packet) {
|
||||
|
|
|
@ -61,6 +61,8 @@ core:
|
|||
customName: '[{"text":"ChomeNS ","color":"yellow"},{"text":"Core","color":"green"},{"text":"™","color":"gold"}]'
|
||||
|
||||
selfCare:
|
||||
delay: 225 # NOTE: self care does NOT use chat queue
|
||||
|
||||
# vanilla
|
||||
op: true
|
||||
gamemode: true
|
||||
|
|
Loading…
Reference in a new issue