Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MMM #513

Merged
merged 4 commits into from
Sep 24, 2024
Merged

MMM #513

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/main/java/thunder/hack/ThunderHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.awt.*;
import java.lang.invoke.MethodHandles;


public class ThunderHack implements ModInitializer {
public static final ModMetadata MOD_META;

Expand Down
6 changes: 2 additions & 4 deletions src/main/java/thunder/hack/core/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import thunder.hack.features.cmd.Command;
import thunder.hack.core.manager.client.MacroManager;
import thunder.hack.core.manager.client.ModuleManager;
import thunder.hack.core.manager.client.ServerManager;
import thunder.hack.events.impl.*;
import thunder.hack.gui.font.FontRenderers;
import thunder.hack.gui.notification.Notification;
Expand Down Expand Up @@ -75,7 +74,7 @@ public void onTick(PlayerUpdateEvent event) {
ThunderHack.EVENT_BUS.post(new EventDeath(p));
}

if (!Objects.equals(Managers.COMMAND.getPrefix(), ClientSettings.prefix.getValue().toString()))
if (!Objects.equals(Managers.COMMAND.getPrefix(), ClientSettings.prefix.getValue()))
Managers.COMMAND.setPrefix(ClientSettings.prefix.getValue());

new HashMap<>(InteractionUtility.awaiting).forEach((bp, time) -> {
Expand Down Expand Up @@ -154,8 +153,7 @@ public void onEntitySpawn(EventEntitySpawn e) {
if (e.getEntity() != null && bp.getSquaredDistance(e.getEntity().getPos()) < 4.)
InteractionUtility.awaiting.remove(bp);
});
}
*/
}*/

public void drawSkull(DrawContext e) {
if (showSkull && !skullTimer.passedMs(3000) && ClientSettings.skullEmoji.getValue()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/thunder/hack/core/Managers.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Managers {
public static final PlayerManager PLAYER = new PlayerManager();

// World
public static final HoleManager HOLE = new HoleManager();
public static final HoleManager HOLE = new HoleManager(); //todo ???
public static final WayPointManager WAYPOINT = new WayPointManager();

// Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,14 @@ private void parseModule(JsonObject object, String category) throws NullPointerE
if (module == null)
return;

if (!Objects.equals(category, "none") && !module.getCategory().getName().toLowerCase().equals(category.toLowerCase()))
if (!Objects.equals(category, "none") && !module.getCategory().getName().equalsIgnoreCase(category))
return;

JsonObject mobject = object.getAsJsonObject(module.getName());

for (Setting setting : module.getSettings()) {
try {
if (setting.getValue() instanceof SettingGroup) {

} else if (setting.getValue() instanceof Boolean) {
setting.setValue(mobject.getAsJsonPrimitive(setting.getName()).getAsBoolean());
} else if (setting.getValue() instanceof Float) {
Expand Down Expand Up @@ -353,7 +352,7 @@ public JsonObject getModuleObject(@NotNull Module m) {
} else if (setting.getValue() instanceof String str) {
try {
attribs.add(setting.getName(), jp.parse(str.replace(" ", "%%").replace("/", "++")));
} catch (Exception exception) {
} catch (Exception ignored) {
}
} else if (setting.getValue() instanceof ItemSelectSetting iSelect) {
JsonArray array = new JsonArray();
Expand Down Expand Up @@ -393,7 +392,7 @@ public List<String> getConfigList() {
List<String> list = new ArrayList<>();

if (CONFIGS_FOLDER.listFiles() != null) {
for (File file : Arrays.stream(Objects.requireNonNull(CONFIGS_FOLDER.listFiles())).filter(f -> f.getName().endsWith(".th")).collect(Collectors.toList())) {
for (File file : Arrays.stream(Objects.requireNonNull(CONFIGS_FOLDER.listFiles())).filter(f -> f.getName().endsWith(".th")).toList()) {
list.add(file.getName().replace(".th", ""));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public void onLoad(String category) {
modules.sort(Comparator.comparing(Module::getName));

modules.forEach(m -> {
if (m.isEnabled() && (m.getCategory().getName().toLowerCase().equals(category.toLowerCase()) || category.equals("none")))
if (m.isEnabled() && (m.getCategory().getName().equalsIgnoreCase(category) || category.equals("none")))
ThunderHack.EVENT_BUS.subscribe(m);
});

Expand Down Expand Up @@ -360,7 +360,7 @@ public void onLogin() {

public void onUnload(String category) {
modules.forEach(module -> {
if (module.isEnabled() && (module.getCategory().getName().toLowerCase().equals(category.toLowerCase()) || category.equals("none"))) {
if (module.isEnabled() && (module.getCategory().getName().equalsIgnoreCase(category) || category.equals("none"))) {
ThunderHack.EVENT_BUS.unsubscribe(module);
module.setEnabled(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.List;
import java.util.Objects;


public class ProxyManager implements IManager {
private final List<ThProxy> proxies = new ArrayList<>();
private ThProxy activeProxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public void onPacketReceive(PacketEvent.@NotNull Receive event) {
}
}


public int getPing() {
if (mc.getNetworkHandler() == null || mc.player == null) return 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void setupShader(Shader shader, ManagedShaderEffect effect) {
effect.setUniformValue("outlinecolor", shaders.outlineColor.getValue().getGlRed(), shaders.outlineColor.getValue().getGlGreen(), shaders.outlineColor.getValue().getGlBlue(), shaders.outlineColor.getValue().getGlAlpha());
effect.setUniformValue("primaryColor", shaders.fillColor1.getValue().getGlRed(), shaders.fillColor1.getValue().getGlGreen(), shaders.fillColor1.getValue().getGlBlue(), shaders.fillColor1.getValue().getAlpha());
effect.setUniformValue("secondaryColor", shaders.fillColor2.getValue().getGlRed(), shaders.fillColor2.getValue().getGlGreen(), shaders.fillColor2.getValue().getGlBlue(), shaders.fillColor1.getValue().getAlpha());
effect.setUniformValue("time", (float) ((System.currentTimeMillis() % 100000) / 1000f));
effect.setUniformValue("time", (System.currentTimeMillis() % 100000) / 1000f);
effect.render(Render3DEngine.getTickDelta());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
import org.apache.commons.compress.utils.Lists;
import thunder.hack.core.Managers;
import thunder.hack.core.manager.IManager;
import thunder.hack.features.modules.client.ClientSettings;
import thunder.hack.utility.Timer;
Expand Down Expand Up @@ -62,7 +61,7 @@ public List<String> getOnlinePlayers() {
return Lists.newArrayList(onlinePlayers.iterator());
}

public List<String> getAllPlayers() {
public List<String> getAllPlayers() { // Method 'getAllPlayers()' is never used
return Lists.newArrayList(allPlayers.iterator());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class PlayerManager implements IManager {

public boolean inInventory;


@EventHandler(priority = EventPriority.HIGHEST)
public void onSync(EventSync event) {
if (Module.fullNullCheck()) return;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/thunder/hack/events/impl/EventClickSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import thunder.hack.events.Event;

public class EventClickSlot extends Event {

private final SlotActionType slotActionType;
private final int slot, button, id;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/thunder/hack/events/impl/EventMouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public int getAction() {

int action;

public EventMouse(int b,int action){
public EventMouse(int b,int action) {
button = b;
this.action = action;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class EventPlayerTravel extends Event {
private Vec3d mVec;
private boolean pre;

public EventPlayerTravel(Vec3d mVec,boolean pre) {
public EventPlayerTravel(Vec3d mVec, boolean pre) {
this.mVec = mVec;
this.pre = pre;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
import net.minecraft.text.Text;
import thunder.hack.core.Managers;
import thunder.hack.features.modules.Module;
import thunder.hack.features.modules.client.ClientSettings;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class CategoryArgumentType implements ArgumentType<String> {
private static final List<String> EXAMPLES = Managers.MODULE.getCategories().stream()
.map(Module.Category::getName)
Expand All @@ -30,7 +31,7 @@ public static CategoryArgumentType create() {
public String parse(StringReader reader) throws CommandSyntaxException {
String cat = reader.readString();
if (!EXAMPLES.contains(cat)) throw new DynamicCommandExceptionType(
name -> Text.literal(ClientSettings.language.getValue().equals(ClientSettings.Language.RU) ? "Категории " + name.toString() + " не существует(" : "Category " + name.toString() + " does not exists(")
name -> Text.literal(isRu() ? "Категории " + name.toString() + " не существует(" : "Category " + name.toString() + " does not exist :(")
).create(cat);
return cat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.command.CommandSource;
import net.minecraft.text.Text;
import thunder.hack.ThunderHack;
import thunder.hack.core.Managers;
import thunder.hack.features.modules.client.ClientSettings;

import java.util.Collection;
import java.util.concurrent.CompletableFuture;

import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class CfgArgumentType implements ArgumentType<String> {
private static final Collection<String> EXAMPLES = Managers.CONFIG.getConfigList().stream()
.limit(5)
Expand All @@ -29,7 +29,7 @@ public static CfgArgumentType create() {
public String parse(StringReader reader) throws CommandSyntaxException {
String config = reader.readString();
if (!Managers.CONFIG.getConfigList().contains(config)) throw new DynamicCommandExceptionType(
name -> Text.literal(ClientSettings.language.getValue().equals(ClientSettings.Language.RU) ? "Конфига " + name.toString() + " не существует(" : "Config " + name.toString() + " does not exists(")
name -> Text.literal(isRu() ? "Конфига " + name.toString() + " не существует(" : "Config " + name.toString() + " does not exist :(")
).create(config);

return config;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/thunder/hack/features/cmd/args/CfgModeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.command.CommandSource;
import net.minecraft.text.Text;
import thunder.hack.ThunderHack;
import thunder.hack.core.Managers;
import thunder.hack.features.modules.client.ClientSettings;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class CfgModeType implements ArgumentType<String> {
private static final Collection<String> EXAMPLES = List.of("combat", "render", "player", "misc", "client", "hud", "movement");

Expand All @@ -28,7 +28,7 @@ public static CfgModeType create() {
public String parse(StringReader reader) throws CommandSyntaxException {
String cat = reader.readString();
if (!getExamples().contains(cat)) throw new DynamicCommandExceptionType(
name -> Text.literal(ClientSettings.language.getValue().equals(ClientSettings.Language.RU) ? "Вкладки " + name.toString() + " не существует(" : "Category " + name.toString() + " does not exists(")
name -> Text.literal(isRu() ? "Вкладки " + name.toString() + " не существует(" : "Category " + name.toString() + " does not exist :(")
).create(cat);

return cat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import org.jetbrains.annotations.NotNull;
import thunder.hack.features.modules.client.ClientSettings;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class ChestStealerArgumentType implements ArgumentType<String> {
private static final List<String> EXAMPLES = getRegistered().stream().limit(5).toList();

Expand All @@ -31,7 +32,7 @@ public static ChestStealerArgumentType create() {
public String parse(@NotNull StringReader reader) throws CommandSyntaxException {
String blockName = reader.readString();
if (!getRegistered().contains(blockName)) throw new DynamicCommandExceptionType(
name -> Text.literal(ClientSettings.language.getValue().equals(ClientSettings.Language.RU) ? "Такого предмета нет!" : "There is no such item!")
name -> Text.literal(isRu() ? "Такого предмета нет!" : "There is no such item!")
).create(blockName);
return blockName;
}
Expand All @@ -46,7 +47,6 @@ public Collection<String> getExamples() {
return EXAMPLES;
}


private static @NotNull List<String> getRegistered() {
List<String> result = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
import net.minecraft.command.CommandSource;
import net.minecraft.text.Text;
import thunder.hack.core.Managers;
import thunder.hack.features.modules.client.ClientSettings;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class FriendArgumentType implements ArgumentType<String> {
private static final List<String> EXAMPLES = Managers.FRIEND.getFriends().stream().limit(5).toList();

Expand All @@ -27,7 +28,7 @@ public static FriendArgumentType create() {
public String parse(StringReader reader) throws CommandSyntaxException {
String friend = reader.readString();
if (!Managers.FRIEND.isFriend(friend)) throw new DynamicCommandExceptionType(
name -> Text.literal(ClientSettings.language.getValue().equals(ClientSettings.Language.RU) ? "Друга с именем " + name.toString() + " не существует(" : "Friend with name " + name.toString() + " does not exists(")
name -> Text.literal(isRu() ? "Друга с именем " + name.toString() + " не существует(" : "Friend with name " + name.toString() + " does not exist :(")
).create(friend);

return friend;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.command.CommandSource;
import net.minecraft.text.Text;
import thunder.hack.ThunderHack;
import thunder.hack.core.Managers;
import thunder.hack.features.modules.Module;
import thunder.hack.features.modules.client.ClientSettings;

import java.util.Collection;
import java.util.concurrent.CompletableFuture;

import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class ModuleArgumentType implements ArgumentType<Module> {
private static final Collection<String> EXAMPLES = Managers.MODULE.modules.stream()
.map(Module::getName)
Expand All @@ -31,7 +31,7 @@ public static ModuleArgumentType create() {
public Module parse(StringReader reader) throws CommandSyntaxException {
Module module = Managers.MODULE.get(reader.readString());
if (module == null) throw new DynamicCommandExceptionType(
name -> Text.literal(ClientSettings.language.getValue().equals(ClientSettings.Language.RU) ? "Модуля " + name.toString() + " не существует(" : "Module " + name.toString() + " does not exists(")
name -> Text.literal(isRu() ? "Модуля " + name.toString() + " не существует(" : "Module " + name.toString() + " does not exist :(")
).create(reader.readString());

return module;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
import net.minecraft.command.CommandSource;
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import thunder.hack.features.modules.client.ClientSettings;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class SearchArgumentType implements ArgumentType<String> {
private static final List<String> EXAMPLES = getRegisteredBlocks().stream().limit(5).toList();

Expand All @@ -29,7 +30,7 @@ public static SearchArgumentType create() {
public String parse(StringReader reader) throws CommandSyntaxException {
String blockName = reader.readString();
if (!getRegisteredBlocks().contains(blockName)) throw new DynamicCommandExceptionType(
name -> Text.literal(ClientSettings.language.getValue().equals(ClientSettings.Language.RU) ? "Такого блока нет!" : "There is no such block!")
name -> Text.literal(isRu() ? "Такого блока нет!" : "There is no such block!")
).create(blockName);
return blockName;
}
Expand All @@ -51,5 +52,4 @@ public static List<String> getRegisteredBlocks() {
}
return result;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ public static List<String> getSettings(Module module) {
}
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.command.CommandSource;
import net.minecraft.text.Text;
import thunder.hack.ThunderHack;
import thunder.hack.core.Managers;
import thunder.hack.core.manager.world.WayPointManager;
import thunder.hack.features.modules.client.ClientSettings;

import java.util.Collection;
import java.util.concurrent.CompletableFuture;

import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class WayPointArgumentType implements ArgumentType<WayPointManager.WayPoint> {
private static final Collection<String> EXAMPLES = Managers.WAYPOINT.getWayPoints().stream()
.map(WayPointManager.WayPoint::getName)
Expand All @@ -32,7 +32,7 @@ public WayPointManager.WayPoint parse(StringReader reader) throws CommandSyntaxE
WayPointManager.WayPoint wp = Managers.WAYPOINT.getWayPointByName(reader.readString());

if (wp == null) throw new DynamicCommandExceptionType(
name -> Text.literal(ClientSettings.language.getValue().equals(ClientSettings.Language.RU) ? "Вейпоинта " + name.toString() + " не существует(" : "Waypoint " + name.toString() + " does not exists(")
name -> Text.literal(isRu() ? "Вейпоинта " + name.toString() + " не существует(" : "Waypoint " + name.toString() + " does not exist :(")
).create(reader.readString());

return wp;
Expand Down
Loading
Loading