forked from ChomeNS/chomens-bot-java
add icu self care
i control uwu uwuw uw uwu wu
This commit is contained in:
parent
e4be8face5
commit
2cc734f9dd
4 changed files with 35 additions and 4 deletions
|
@ -53,16 +53,24 @@ public class Configuration {
|
|||
@Getter public boolean gamemode = true;
|
||||
@Getter public boolean endCredits = true;
|
||||
|
||||
@Getter public boolean cspy = true;
|
||||
@Getter public boolean vanish = true;
|
||||
@Getter public boolean nickname = true;
|
||||
@Getter public boolean socialspy = true;
|
||||
@Getter public boolean mute = true;
|
||||
|
||||
@Getter public boolean cspy = true;
|
||||
|
||||
@Getter public AntiIcuSelfCare icu = new AntiIcuSelfCare();
|
||||
|
||||
@Getter public boolean prefix = true;
|
||||
@Getter public boolean username = true;
|
||||
}
|
||||
|
||||
public static class AntiIcuSelfCare {
|
||||
@Getter public boolean enabled = true;
|
||||
@Getter public int positionPacketsPerSecond = 10;
|
||||
}
|
||||
|
||||
public static class Bots {
|
||||
@Getter public String host;
|
||||
@Getter public int port;
|
||||
|
|
|
@ -10,12 +10,12 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.Serverb
|
|||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||
import land.chipmunk.chayapak.chomens_bot.chatParsers.data.MutablePlayerListEntry;
|
||||
import land.chipmunk.chayapak.chomens_bot.data.Rotation;
|
||||
import lombok.Getter;
|
||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
|||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.packet.PacketProtocol;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||
import land.chipmunk.chayapak.chomens_bot.Configuration;
|
||||
import lombok.Getter;
|
||||
|
@ -35,6 +36,7 @@ public class SelfCarePlugin extends SessionAdapter {
|
|||
private int entityId;
|
||||
private GameMode gamemode;
|
||||
private int permissionLevel;
|
||||
private int positionPacketsPerSecond = 0;
|
||||
private boolean cspy = false;
|
||||
private boolean vanish = false;
|
||||
private boolean nickname = false;
|
||||
|
@ -76,6 +78,13 @@ public class SelfCarePlugin extends SessionAdapter {
|
|||
else if (message.startsWith("Successfully set your username to \"")) username = false;
|
||||
}
|
||||
});
|
||||
|
||||
bot.position().addListener(new PositionPlugin.PositionListener() {
|
||||
@Override
|
||||
public void positionChange(Vector3i position) {
|
||||
SelfCarePlugin.this.positionChange();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void check () {
|
||||
|
@ -86,6 +95,7 @@ public class SelfCarePlugin extends SessionAdapter {
|
|||
else if (selfCares.cspy() && !cspy && bot.kaboom()) bot.chat().send("/commandspy:commandspy on");
|
||||
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());
|
||||
else if (selfCares.icu().enabled() && positionPacketsPerSecond > selfCares.icu().positionPacketsPerSecond()) bot.core().run("essentials:sudo * icu stop");
|
||||
else if (selfCares.vanish() && !vanish && !visibility && bot.hasEssentials()) {
|
||||
if (bot.useChat()) bot.chat().send("/essentials:vanish enable");
|
||||
else bot.core().run("essentials:vanish " + bot.username() + " enable");
|
||||
|
@ -121,6 +131,7 @@ public class SelfCarePlugin extends SessionAdapter {
|
|||
socialspy = false;
|
||||
muted = false;
|
||||
prefix = false;
|
||||
positionPacketsPerSecond = 0;
|
||||
|
||||
final Runnable task = () -> {
|
||||
final Session session = bot.session();
|
||||
|
@ -164,6 +175,13 @@ public class SelfCarePlugin extends SessionAdapter {
|
|||
else if (event == EntityEvent.PLAYER_OP_PERMISSION_LEVEL_4) permissionLevel = 4;
|
||||
}
|
||||
|
||||
// totallynotskidded™ from smp.,.,
|
||||
public void positionChange () {
|
||||
positionPacketsPerSecond++;
|
||||
|
||||
bot.executor().schedule(() -> positionPacketsPerSecond--, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected (DisconnectedEvent event) {
|
||||
checkTask.cancel(true);
|
||||
|
|
|
@ -50,6 +50,11 @@ selfCare:
|
|||
# commandspy
|
||||
cspy: true
|
||||
|
||||
# icu (icontrolUwU)
|
||||
icu:
|
||||
enabled: true
|
||||
positionPacketsPerSecond: 10 # 10 seems to be a best number for me
|
||||
|
||||
# extras
|
||||
prefix: true
|
||||
username: true # do NOT set this to false unless you know what you are doing
|
||||
|
|
Loading…
Reference in a new issue