Read Only
- Статус
- Оффлайн
- Регистрация
- 7 Дек 2025
- Сообщения
- 115
- Реакции
- 2
- Выберите загрузчик игры
- Прочие моды
Сливаю вам функцию ServerHelper с Вальхаллы (отремапил и снял обфу с класса, с джарки туксевича)
SS - А оно надо?
SS - А оно надо?
ServerHelper.java:
package wprotect;
import com.google.common.eventbus.Subscribe;
import java.awt.Color;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3d;
import net.minecraft.item.ItemBlock;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.TextComponentString;
import net.minecraft.util.ChatComponentText;
@ModuleInfo(name = "ServerHelper", extendsClass = Player.class, description = "Помощник под сервера")
public class ServerHelper extends Module implements ClickHandler {
public ModuleSetting<String> modeSelection = new ModuleSetting("Выбор режимов", "FunTime", new String[]{"FunTime", "HolyWorld", "ReallyWorld", "MetaHvH"});
public CheckBoxSetting dontWriteBlockedWords = new CheckBoxSetting("Не писать запретки", Boolean.valueOf(true)).module(() -> modeSelection.getValue().equals("ReallyWorld"));
public CheckBoxSetting drawItems = new CheckBoxSetting("Рисовать предметы", Boolean.valueOf(true)).module(() -> modeSelection.getValue().equals("FunTime"));
public ModuleSetting<Boolean> explosionTrap = new ModuleSetting("Взрывная трапка)", -1).module(() -> modeSelection.getValue().equals("HolyWorld"));
public ModuleSetting<Boolean> trap = new ModuleSetting("Трапа)", -1).module(() -> modeSelection.getValue().equals("HolyWorld"));
public Map<ModuleSetting, Integer> settingValues;
public ModuleSetting<Boolean> stun = new ModuleSetting("Оглушение)", -1).module(() -> modeSelection.getValue().equals("HolyWorld"));
public ModuleSetting<Boolean> explosionThing = new ModuleSetting("Взрывная штучка)", -1).module(() -> modeSelection.getValue().equals("HolyWorld"));
public CheckBoxSetting dontDownloadRP = new CheckBoxSetting("Не скачивать рп", Boolean.valueOf(true)).module(() -> modeSelection.getValue().equals("ReallyWorld"));
public static ServerHelper INSTANCE = new ServerHelper("Выбор режимов", "FunTime", new String[]{"FunTime", "HolyWorld", "ReallyWorld", "MetaHvH"});
public String[] blockedWords = new String[]{"экспа", "экспенсив", "экспой", "нуриком", "целкой", "нурлан", "newcode", "ньюкод", "нурсултан", "целестиал", "целка", "нурик", "атернос", "aternos", "expa", "celka", "nurik", "expensive", "celestial", "nursultan", "фанпей", "funpay", "fluger", "акриен", "akrien", "фантайм", "funtime", "безмамный", "rich", "рич", "без мамный", "wild", "вилд", "excellent", "экселлент", "matix", "impact", "матикс", "импакт", "wurst"};
public Timer timer = new Timer();
public Map<String, Map<ModuleSetting, Integer>> modeSettings = new HashMap();
public CheckBoxSetting autoEventCoords = new CheckBoxSetting("Авто точки эвентов", Boolean.valueOf(true)).module(() -> modeSelection.getValue().equals("MetaHvH"));
public static ModuleSetting<Boolean> plaster = (new ModuleSetting("Пласт", -1)).module(() -> modeSelection.getValue().equals("FunTime"));
public static ModuleSetting<Boolean> trapModule = (new ModuleSetting("Трапа)", -1)).module(() -> modeSelection.getValue().equals("FunTime"));
public static ModuleSetting<Boolean> visibleDust = (new ModuleSetting("Явная пыль)", -1)).module(() -> modeSelection.getValue().equals("FunTime"));
public ModuleSetting<Boolean> writeCoords = new ModuleSetting("Писать координаты", -1);
public int lastMessageCount = -1;
public static ModuleSetting<Boolean> godAura = (new ModuleSetting("Божья аура)", -1)).module(() -> modeSelection.getValue().equals("FunTime"));
public CheckBoxSetting inRadiusTrap = new CheckBoxSetting("В радиусе трапка", Boolean.valueOf(false)).module(() -> modeSelection.getValue().equals("FunTime"));
public Map<String, Location> points = new ConcurrentHashMap();
public boolean waitingForLillian;
public د_ hudComponent;
public CheckBoxSetting convertTime = new CheckBoxSetting("Конвертить время", Boolean.valueOf(true)).module(() -> modeSelection.getValue().equals("FunTime"));
public Module parentModule = new Module();
public static ModuleSetting<Boolean> disorientation = (new ModuleSetting("Дезорентация)", -1)).module(() -> modeSelection.getValue().equals("FunTime"));
public ModuleSetting<Boolean> gravity = (new ModuleSetting("Гравитация)", -1)).module(() -> modeSelection.getValue().equals("HolyWorld"));
public String currentMode;
public boolean flag;
public ModuleSetting<Boolean> fireTornado = (new ModuleSetting("Огнененый смерч)", -1)).module(() -> modeSelection.getValue().equals("FunTime"));
public List<ModuleSetting> settingsList;
public int currentSlot = -1;
public long lastTime;
public void onUpdate(Module module) {
IChatComponent message = module.getDisplayName();
if (convertTime.isEnabled() && modeSelection.isValueEnabled("FunTime") && message instanceof ChatComponentText) {
ChatComponentText textComponent = (ChatComponentText) message;
String text = textComponent.getText().toLowerCase(Locale.ROOT);
if (text.contains("до следующего ивента:")) {
int start = text.indexOf(":") + 2;
int end = text.indexOf(" сек", start);
if (end == -1) {
return;
}
String timeStr = text.substring(start, end);
int seconds = Integer.parseInt(timeStr.trim());
String formattedTime = formatTime(seconds);
chat("След. ивент через: " + formattedTime);
}
}
}
public void useExplosionTrap() {
if (InventoryModule.findItem(Items.TNT) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует взрывная трапка!");
} else {
InventoryModule.setSelectedItem(Items.TNT, false);
}
}
@Subscribe
public void onChatMessage(ChatReceivedEvent event) {
String mode = modeSelection.getValue();
if (!mode.equals(this.currentMode)) {
onUpdate(this.currentMode);
modeSelection.setValue(mode);
this.currentMode = mode;
for (ModuleSetting setting : this.settingsList) {
this.settingValues.put(setting, (Integer) setting.getValue());
}
}
for (ModuleSetting setting : this.settingsList) {
int currentValue = (Integer) setting.getValue();
int previousValue = this.settingValues.getOrDefault(setting, -1);
if (currentValue != previousValue) {
modeSelection.setValue(modeSelection.getValue());
this.settingValues.put(setting, currentValue);
}
}
if (modeSelection.isValueEnabled("MetaHvH")) {
if (this.flag) {
this.timer.update(System.currentTimeMillis() - this.lastTime > 200L);
int lilyPosition = findItem("ливалка", true);
int lilySlot = findItem("ливалка", false);
if (lilySlot == -1 && lilyPosition == -1) {
chat("Ливалка не найдена!");
this.flag = false;
return;
}
if (!PlayerController.isBlockHit(Blocks.OBSIDIAN)) {
chat("Заюзал ливалка!");
int usedSlot = useItem(lilyPosition, lilySlot);
if (usedSlot > 8) {
ConnectionModule.sendPacket(usedSlot);
}
}
this.flag = false;
}
if (this.waitingForLillian) {
int featherPos = findItem("перо", true);
int featherSlot = findItem("перо", false);
if (featherSlot == -1 && featherPos == -1) {
chat("Перо не найдено");
this.waitingForLillian = false;
return;
}
if (!PlayerController.isBlockHit(Blocks.DRAGON_EGG)) {
chat("Заюзал перо!");
int currentSlot = PlayerController.getCurrentSelectedSlot();
int usedSlot = useItem(featherPos, featherSlot);
if (usedSlot > 8) {
ConnectionModule.sendPacket(usedSlot);
}
if (InventoryModule.hasItem(Items.FEATHER) && currentSlot != PlayerController.getCurrentSelectedSlot()) {
PlayerController.setCurrentSelectedSlot(currentSlot);
}
}
this.waitingForLillian = false;
}
this.timer.update(System.currentTimeMillis() - this.lastTime > 200L);
if (autoEventCoords.isEnabled() && !this.points.isEmpty()) {
Vec3d playerPos = PlayerController.getPlayerPosition();
Iterator var17 = this.points.entrySet().iterator();
while (var17.hasNext()) {
Map.Entry entry = (Map.Entry) var17.next();
Vec3d pointPos = ((Location) entry.getValue()).position;
Vec3d adjustedPos = new Vec3d(pointPos.getX() + 0.5, pointPos.getY() + 0.5, pointPos.getZ() + 0.5);
double distance = playerPos.distanceTo(adjustedPos);
if (distance <= 10.0) {
var17.remove();
ConnectionModule.sendCommand(".gps off");
chat("Точка '" + entry.getKey() + "' удалена: игрок в радиусе 10 блоков (" + pointPos.getX() + ", " + pointPos.getY() + ", " + pointPos.getZ() + ")");
}
}
}
}
}
public void onModeChange(String modeName) {
Map settings = (Map) this.modeSettings.computeIfAbsent(modeName, (var0) -> new HashMap());
for (ModuleSetting setting : this.settingsList) {
settings.put(setting, (Integer) setting.getValue());
}
}
public void useGravity() {
if (InventoryModule.findItem(Items.SAND) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует гравитация!");
} else {
InventoryModule.setSelectedItem(Items.SAND, false);
}
}
public void useStun() {
if (InventoryModule.findItem(Items.SLIME_BALL) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует оглушение!");
} else {
InventoryModule.setSelectedItem(Items.SLIME_BALL, false);
}
}
@Subscribe
public void onKeyPress(KeyPressEvent event) {
if (this.settingsList.contains(event.getKey())) {
modeSelection.setValue(modeSelection.getValue());
this.settingValues.put((ModuleSetting) event.getKey(), (Integer) ((ModuleSetting) event.getKey()).getValue());
}
}
public String formatTime(int totalSeconds) {
int hours = totalSeconds / 3600;
int minutes = totalSeconds % 3600 / 60;
int seconds = totalSeconds % 60;
String result = "";
if (hours > 0) {
result = result + hours + " часов ";
}
if (minutes > 0) {
result = result + minutes + " минут ";
}
if (seconds > 0 || result.isEmpty()) {
result = result + seconds + " секунд";
}
return result.trim();
}
@Subscribe
public void onTick(TickEvent event) {
if (!GlowModule.enabled && event.getType() == EventType.RENDER) {
if (drawItems.isEnabled() && modeSelection.isValueEnabled("FunTime")) {
this.hudComponent.render(event);
}
if (modeSelection.isValueEnabled("MetaHvH") && autoEventCoords.isEnabled()) {
this.points.entrySet().removeIf((var1x) -> {
if (((Location) var1x.getValue()).isExpired()) {
String message = ((String) var1x.getKey()).startsWith("Золотой блок") ? "Точка '" + var1x.getKey() + "' удалена (истекло 5 минут для Золотого блока)" : "Точка '" + var1x.getKey() + "' удалена (истекло время)";
chat(message);
ConnectionModule.sendCommand(".gps off");
return true;
} else {
return false;
}
});
if (!this.points.isEmpty()) {
for (Map.Entry entry : this.points.entrySet()) {
Vec3d pointPos = ((Location) entry.getValue()).position;
Vec3d adjustedPos = new Vec3d(pointPos.getX() + 0.5, pointPos.getY() + 0.5, pointPos.getZ() + 0.5);
RayTraceResult rayTrace = Raytracer.rayTrace(adjustedPos.x, adjustedPos.y, adjustedPos.z);
if (!(rayTrace.getBlockPos().getY() <= 0.0) && !(rayTrace.getBlockPos().getX() <= 0.0)) {
int distance = (int) PlayerController.getPlayerPosition().distanceTo(adjustedPos);
String label = entry.getKey() + " " + distance + "м";
float x = RenderUtil.drawText(label, 8.0f);
float y = rayTrace.getBlockPos().getX() - x / 2.0f;
float z = rayTrace.getBlockPos().getY() - RenderUtil.getFontHeight() / 2.0f;
if (rayTrace.getBlockPos().getY() < RenderUtil.getRenderY() && rayTrace.getBlockPos().getX() < RenderUtil.getRenderY()) {
RenderUtil.drawText(event.getClientPlayer().getName(), label, y, z, Color.WHITE.getRGB(), 8.0f, 1.0f);
}
}
}
}
}
}
}
@Subscribe
public void onSendMessage(SendMessageEvent event) {
this.onUpdate(event.getPlayer());
if (modeSelection.isValueEnabled("ReallyWorld") && dontDownloadRP.isEnabled() && event.getPlayer() instanceof EntityPlayer) {
IChatComponent component = event.getMessage();
if (component instanceof ChatMessage) {
ChatMessage chatMessage = (ChatMessage) component;
String messageText = chatMessage.getText().toLowerCase();
for (String blockedWord : this.blockedWords) {
if (messageText.contains(blockedWord)) {
chat(GOLD.getPrefix() + blockedWords + GOLD.getPrefix() + " запрещенные" + GOLD.getPrefix() + " символы, все удалено.");
event.cancel();
return;
}
}
}
}
if (modeSelection.isValueEnabled("MetaHvH") && autoEventCoords.isEnabled()) {
IChatComponent component = event.getMessage();
if (component instanceof ChatComponentText) {
ChatComponentText textComponent = (ChatComponentText) component;
String text = textComponent.getText();
if (text.contains("Золотой блок » Появился Золотой блок на координатах")) {
Pattern pattern = Pattern.compile("Золотой блок » Появился Золотой блок на координатах: (-?\\d+\\.\\d+), (-?\\d+\\.\\d+), (-?\\d+\\.\\d+)");
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
int x = (int) Double.parseDouble(matcher.group(1));
int y = (int) Double.parseDouble(matcher.group(2));
int z = (int) Double.parseDouble(matcher.group(3));
this.points.put("Золотой блок " + x + "," + z, new Location(new Vec3d(x, y, z), 5));
ConnectionModule.sendCommand(".gps add " + x + " " + z);
chat("Добавлен золотой блок: " + x + " " + y + " " + z);
}
} else if (text.contains("Обнаружен аирдроп")) {
Pattern pattern = Pattern.compile("AirDrop » Его координаты: X: (-?\\d+), Y: (-?\\d+), Z: (-?\\d+)");
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
int x = Integer.parseInt(matcher.group(1));
int y = Integer.parseInt(matcher.group(2));
int z = Integer.parseInt(matcher.group(3));
this.points.put("Аирдроп " + x + "," + z, new Location(new Vec3d(x, y, z), 5));
ConnectionModule.sendCommand(".gps add " + x + " " + z);
chat("Добавлен аирдроп: " + x + " " + y + " " + z);
}
} else if (text.contains("Сокровища Воздушных Пиратов были найдены")) {
Pattern pattern = Pattern.compile("Сокровища Воздушных Пиратов были найдены! Координаты: (-?\\d+), (-?\\d+), (-?\\d+)");
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
int x = Integer.parseInt(matcher.group(1));
int y = Integer.parseInt(matcher.group(2));
int z = Integer.parseInt(matcher.group(3));
this.points.put("Корабль " + x + "," + z, new Location(new Vec3d(x, y, z), 5));
ConnectionModule.sendCommand(".gps add " + x + " " + z);
chat("Добавлен корабль: " + x + " " + y + " " + z);
}
}
}
}
if (modeSelection.isValueEnabled("MetaHvH")) {
this.timer.update(event.getPlayer());
}
}
public void useGodAura() {
if (InventoryModule.findItem(Items.BEETROOT) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует божья аура!");
} else {
InventoryModule.setSelectedItem(Items.BEETROOT, false);
}
}
@Subscribe
public void onPlayerJoin(PlayerJoinEvent event) {
if (!GlowModule.enabled) {
if (drawItems.isEnabled() && modeSelection.isValueEnabled("FunTime")) {
this.hudComponent.render(event);
}
}
}
public int useItem(int itemPos, int itemSlot) {
if (itemPos != -1) {
this.timer.update(PlayerController.getCurrentSelectedSlot());
ConnectionModule.sendPacket(new C09PacketHeldItemChange(itemPos));
ConnectionModule.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
ConnectionModule.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
this.lastTime = System.currentTimeMillis();
return itemPos;
} else if (itemSlot != -1) {
this.timer.update(PlayerController.getCurrentSelectedSlot());
ConnectionModule.sendPacket(itemSlot);
ConnectionModule.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
ConnectionModule.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
this.lastTime = System.currentTimeMillis();
return itemSlot;
} else {
return -1;
}
}
public void useExplosionThing() {
if (InventoryModule.findItem(Items.TNT_MINECART) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует взрывная штучка!");
} else {
InventoryModule.setSelectedItem(Items.TNT_MINECART, false);
}
}
public void useTrap() {
if (InventoryModule.findItem(Items.ENDER_PEARL) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует трапка!");
} else {
InventoryModule.setSelectedItem(Items.ENDER_PEARL, false);
}
}
public void updateSettings(String modeName) {
Map settings = (Map) this.modeSettings.getOrDefault(modeName, new HashMap());
for (ModuleSetting setting : this.settingsList) {
setting.setValue((Integer) settings.getOrDefault(setting, -1));
}
}
public void usePlaster() {
if (InventoryModule.findItem(Items.PAPER) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует пласт!");
} else {
InventoryModule.setSelectedItem(Items.PAPER, false);
}
}
public ServerHelper() {
this.settingsList = Arrays.asList(trapModule, disorientation, godAura, visibleDust, plaster, this.fireTornado, this.gravity, this.stun, this.explosionTrap, this.explosionThing, this.writeCoords, this.modeSelection);
this.currentMode = "FunTime";
this.settingValues = new HashMap();
Modules.Value<?> value = Default.getModuleRegistry().register(this, "ItemsHud", 196.0f, 5.0f);
this.hudComponent = new د_(value);
this.register(new Module[]{drawItems, modeSelection, inRadiusTrap, trapModule, disorientation, godAura, visibleDust, plaster, this.fireTornado, this.gravity, this.stun, this.explosionTrap, this.explosionThing, this.writeCoords, this.autoEventCoords, this.dontWriteBlockedWords, this.convertTime, this.dontDownloadRP, this.autoEventCoords, this.modeSelection});
for (String mode : modeSelection.getModes()) {
this.modeSettings.put(mode, new HashMap());
}
this.onModeChange(modeSelection.getValue());
for (ModuleSetting setting : this.settingsList) {
this.settingValues.put(setting, (Integer) setting.getValue());
}
}
public void useDisorientation() {
if (InventoryModule.findItem(Items.REDSTONE) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует дезориентация!");
} else {
InventoryModule.setSelectedItem(Items.REDSTONE, false);
}
}
public void reset() {
this.flag = false;
this.waitingForLillian = false;
this.lastTime = 0L;
if (modeSelection.isValueEnabled("MetaHvH") && !this.points.isEmpty()) {
ConnectionModule.sendCommand(".gps off");
this.points.clear();
}
this.onModeChange(modeSelection.getValue());
super.reset();
}
@Subscribe
public void onPressKey(PressKeyEvent event) {
if (modeSelection.isValueEnabled("FunTime")) {
if (event.getKey() == (Integer) trapModule.getValue()) {
if (this.inRadiusTrap.isEnabled()) {
for (Entity entity : World.getEntities()) {
if (entity != PlayerController.getPlayer() && PlayerController.getDistanceToEntity(entity) <= 4.0f && this.timer.delay(150L)) {
this.useTrap();
this.timer.reset();
}
}
} else {
this.useTrap();
}
}
if (event.getKey() == (Integer) disorientation.getValue()) {
this.useDisorientation();
}
if (event.getKey() == (Integer) godAura.getValue()) {
this.fireTornado();
}
if (event.getKey() == (Integer) visibleDust.getValue()) {
this.usePlaster();
}
if (event.getKey() == (Integer) plaster.getValue()) {
this.useGodAura();
}
if (event.getKey() == (Integer) this.fireTornado.getValue()) {
this.fireTornado();
}
}
if (modeSelection.isValueEnabled("HolyWorld")) {
if (event.getKey() == (Integer) this.gravity.getValue()) {
this.useExplosionThing();
}
if (event.getKey() == (Integer) this.gravity.getValue()) {
this.useGravity();
}
if (event.getKey() == (Integer) this.stun.getValue()) {
this.useStun();
}
if (event.getKey() == (Integer) this.explosionTrap.getValue()) {
this.useExplosionTrap();
}
if (event.getKey() == (Integer) this.explosionTrap.getValue()) {
this.usePlaster();
}
}
if (modeSelection.isValueEnabled("MetaHvH") && event.getKey() == (Integer) this.modeSelection.getValue()) {
this.flag = true;
}
if (event.getKey() == (Integer) this.writeCoords.getValue()) {
int x = (int) PlayerController.getPlayerPosition().getX();
ConnectionModule.sendCommand("!Координаты x " + x + ". z " + (int) PlayerController.getPlayerPosition().getZ());
}
}
public void fireTornado() {
if (InventoryModule.findItem(Items.FIREBALL) == -1) {
chat(GOLD.getPrefix() + "У вас отсутствует огненный смерч!");
} else {
InventoryModule.setSelectedItem(Items.FIREBALL, false);
}
}
public int findItem(String itemName, boolean searchHotbar) {
int start = searchHotbar ? 0 : 9;
int end = searchHotbar ? 9 : 36;
for (int i = start; i < end; ++i) {
ItemStack itemStack = PlayerController.getInventory().getStack(i);
if (!(itemStack.getItem() instanceof ItemBlock)) {
String stackName = RenderUtil.stripColor(itemStack.getDisplayName());
if (stackName != null && stackName.toLowerCase().contains(itemName)) {
return i;
}
}
}
return -1;
}
}
}
Последнее редактирование: