Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 16 Дек 2023
- Сообщения
- 633
- Реакции
- 9
Не знаю кому нужно,вроде работает,проверьте.Тк если на 1.21.1 зайти на рв то будет кикать за какой то network error
Код:
package dev.client.ModuleSystem.core.misc;
import com.google.common.collect.Lists;
import com.google.common.eventbus.Subscribe;
import dev.client.EventSystem.core.events.network.PacketEvent;
import dev.client.ModuleSystem.api.Module;
import dev.client.ModuleSystem.api.ModuleCategory;
import dev.client.ModuleSystem.settings.BooleanSetting;
import dev.client.ModuleSystem.settings.MultiSetting;
import dev.client.UtilsSystem.client.ChatUtil;
import dev.client.UtilsSystem.client.ClientHelper;
import dev.client.UtilsSystem.math.timer.TimerUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.network.protocol.game.ClientboundBossEventPacket;
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
import net.minecraft.network.protocol.game.ClientboundRespawnPacket;
import net.minecraft.network.protocol.game.ServerboundChatPacket;
import java.awt.*;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
public class ReallyWorldHelper extends Module {
public ReallyWorldHelper() {
super("ReallyWorldHelper", ModuleCategory.Misc,"Помогает в игровом процессе на ReallyWorld");
}
public final MultiSetting settings = new MultiSetting("Функции",
new BooleanSetting("Блокировать запрещенные слова", true),
new BooleanSetting("Закрывать меню", true)
).setParent(this);
public final BooleanSetting autoGps = new BooleanSetting("Авто точка", true).setParent(this);
public final BooleanSetting notificationGps = new BooleanSetting("Уведомление", true).setParent(this).setShown(() -> autoGps.get());
public final String[] banWords = new String[]{
"экспа", "экспенсив", "экспой", "нуриком", "целкой", "нурлан",
"нурсултан", "целестиал", "целка", "нурик", "атернос", "блейд", "blade", "expa",
"celka", "nurik", "expensive", "celestial", "nursultan", "фанпей",
"funpay", "fluger", "акриен", "akrien", "фантайм", "ft", "funtime",
"безмамный", "rich", "рич", "без мамный", "wild", "вилд", "excellent",
"экселлент", "hvh", "хвх", "matix", "impact", "матикс", "импакт", "wurst"};
private boolean joined;
private UUID uuid;
private TrayIcon trayIcon;
public final TimerUtil timerUtil = new TimerUtil();
public final TimerUtil counter = new TimerUtil();
private final List<String> sent = Lists.newArrayList();
@Subscribe
public void onPacket(PacketEvent e) {
if (e.isSend() && e.getPacket() instanceof ServerboundChatPacket p) {
if (settings.get("Блокировать запрещенные слова").get() && containsBanWords(p.message())) {
print("RW Helper |" + ChatFormatting.RED + " Обнаружены запрещенные слова в вашем сообщении. Отправка отменена.");
e.cancelled();
}
}
if (e.isReceive()) {
handleIncomingPackets(e.getPacket());
}
}
private void handleIncomingPackets(Object packet) {
if (packet instanceof ClientboundBossEventPacket) {
handleBossInfo((ClientboundBossEventPacket) packet);
} else if (packet instanceof ClientboundRespawnPacket) {
joined = true;
timerUtil.reset();
} else if (packet instanceof ClientboundOpenScreenPacket w) {
if (settings.get("Закрывать меню").get() &&
w.getTitle().getString().contains("Меню") &&
joined &&
!timerUtil.isReached(2000)) {
mc.player.closeContainer();
joined = false;
}
}
}
private void handleBossInfo(ClientboundBossEventPacket packet) {
if (autoGps.get()) {
if (packet.operation.getType() == ClientboundBossEventPacket.OperationType.ADD) {
String bossName = packet.operation instanceof ClientboundBossEventPacket.AddOperation ? ((ClientboundBossEventPacket.AddOperation) packet.operation).name.getString().toLowerCase().replaceAll("\\s+", " ") : "";
if (bossName.contains("аирдроп")) {
parseCoordinates("АирДроп", bossName, "x: ", "z: ");
} else if (bossName.contains("талисман")) {
parseCoordinates("Талисман", bossName, "координаты");
} else if (bossName.contains("скрудж")) {
parseCoordinates("Скрудж", bossName, "координаты");
}
uuid = packet.id;
} else if (packet.operation.getType() == ClientboundBossEventPacket.OperationType.REMOVE
&& packet.id.equals(uuid)) {
resetCoordinates();
}
}
}
private void parseCoordinates(String entityName, String bossName, String... coordinateKeywords) {
for (String keyword : coordinateKeywords) {
int coordX = extractCoordinate(bossName, keyword + "x: ");
int coordZ = extractCoordinate(bossName, keyword + "z: ");
if (coordX != -1 && coordZ != -1) {
sendCoordinatesToChat(entityName, coordX, coordZ);
sendNotification(entityName + " появился!", entityName);
return;
}
}
}
private void sendCoordinatesToChat(String name, int x, int z) {
ChatUtil.sendChatClient(".gps add " + x + " " + z);
}
private void resetCoordinates() {
ChatUtil.sendChatClient(".gps remove АирДроп");
ChatUtil.sendChatClient(".gps remove Талисман");
ChatUtil.sendChatClient(".gps remove Скрудж");
}
private boolean containsBanWords(String message) {
return Arrays.stream(banWords).anyMatch(banWord -> message.toLowerCase().contains(banWord));
}
private int extractCoordinate(String text, String coordinateIdentifier) {
int index = text.indexOf(coordinateIdentifier);
if (index != -1) {
String coordinateText = text.substring(index + coordinateIdentifier.length()).split(" ")[0];
try {
return Integer.parseInt(coordinateText);
} catch (NumberFormatException ignored) {
}
}
return -1;
}
private void sendNotification(String title, String message) {
if (notificationGps.get() && SystemTray.isSupported()) {
try {
if (trayIcon == null) {
trayIcon = new TrayIcon(Toolkit.getDefaultToolkit().createImage(""), "ReallyWorldHelper");
trayIcon.setImageAutoSize(true);
SystemTray.getSystemTray().add(trayIcon);
}
trayIcon.displayMessage(title, message, TrayIcon.MessageType.INFO);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void onEnable() {
super.onEnable();
if (!ClientHelper.isReallyWorld()) {
print("Модуль работает только на сервере ReallyWorld");
toggle();
return;
}
sent.clear();
}
}