Skip to content

Commit

Permalink
add troll
Browse files Browse the repository at this point in the history
  • Loading branch information
Spigey committed Jun 29, 2024
1 parent 4651c36 commit c673f3c
Show file tree
Hide file tree
Showing 3 changed files with 704 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/spigey/asteroide/AsteroideAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
import meteordevelopment.meteorclient.systems.modules.Modules;
import org.slf4j.Logger;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -27,9 +34,20 @@ public class AsteroideAddon extends MeteorAddon {
public static String MinehutIP = "?";
public static String trackedPlayer = null;
public static double[] lastPos = {0, 0, 0};
public static List<String> trolls = new ArrayList<>();
@Override
public void onInitialize() {
LOG.info("\nLoaded Asteroide v0.1.4-fix\n");
try (InputStream is = getClass().getClassLoader().getResourceAsStream("trolls.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
trolls.add(line);
}
} catch (IOException e) {
System.err.println("Error reading trolls.txt: " + e.getMessage());
e.printStackTrace();
}
// Modules
addModule(new AutoKys());
addModule(new ServerCrashModule());
Expand Down Expand Up @@ -62,6 +80,7 @@ public void onInitialize() {
addModule(new AimbotModule());
addModule(new EncryptChatModule());
addModule(new DistributeModule());
addModule(new TrollModule());
// addModule(new SwimModule());

// Commands
Expand Down
94 changes: 94 additions & 0 deletions src/main/java/spigey/asteroide/modules/TrollModule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package spigey.asteroide.modules;

import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.client.network.PlayerListEntry;
import spigey.asteroide.AsteroideAddon;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class TrollModule extends Module {
public TrollModule() {
super(AsteroideAddon.CATEGORY, "troll", "Automatically msgs random people.");
}
private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final Setting<String> command = sgGeneral.add(new StringSetting.Builder()
.name("command")
.description("Command to use.")
.defaultValue("/msg")
.build()
);
private final Setting<List<String>> quotes = sgGeneral.add(new StringListSetting.Builder()
.name("additional quotes")
.description("More quotes to use.")
.defaultValue("kys")
.build()
);
private final Setting<List<String>> users = sgGeneral.add(new StringListSetting.Builder()
.name("excluded users")
.description("Will not msg these users.")
.build()
);
private final Setting<List<String>> ranks = sgGeneral.add(new StringListSetting.Builder()
.name("excluded ranks")
.description("Will not msg people with these ranks.")
.defaultValue("owner", "admin", "developer", "helper", "mod", "staff")
.build()
);
private final Setting<Integer> delay = sgGeneral.add(new IntSetting.Builder()
.name("delay in ticks")
.description("How many ticks to wait before msging the next user.")
.min(1)
.sliderMax(100)
.defaultValue(30)
.build()
);

private int tick = 0;
private int idx = 0;
private List<String> display = new ArrayList<>();
private List<String> user = new ArrayList<>();

@Override
public void onActivate() {
tick = 1;
idx = 0;
user = new ArrayList<>();
display = new ArrayList<>();
for (PlayerListEntry player : mc.getNetworkHandler().getPlayerList()) display.add(player.getDisplayName() == null ? player.getProfile().getName() : player.getDisplayName().getString());
for (PlayerListEntry player : mc.getNetworkHandler().getPlayerList()) user.add(player.getProfile().getName());
}

@EventHandler
private void onTick(TickEvent.Post event){
if(tick > 0){tick--; return;}
if(tick < 0) return;
user = new ArrayList<>();
display = new ArrayList<>();
for (PlayerListEntry player : mc.getNetworkHandler().getPlayerList()) display.add(player.getDisplayName() == null ? player.getProfile().getName() : player.getDisplayName().getString());
for (PlayerListEntry player : mc.getNetworkHandler().getPlayerList()) user.add(player.getProfile().getName());
if(display.isEmpty() || user.isEmpty()) return;
if(idx >= display.size()) idx = 0;
String gift = display.get(idx).toLowerCase();
boolean yes = false;
while (!yes) { // do not touch this code
yes = true;
for (String s : ranks.get()) {if (gift.toLowerCase().contains(s.toLowerCase())) yes = false;}
for (String s : users.get()) {if (user.get(idx).toLowerCase().contains(s.toLowerCase())) yes = false;}
if(user.get(idx).contains("§")) yes = false;
if(!yes) {if(idx >= display.size()){idx = 0;}else{idx++;} return;}
if(display.isEmpty()){ toggle(); return;}
}
List<String> troll = new ArrayList<>();
troll.addAll(AsteroideAddon.trolls);
troll.addAll(quotes.get());
ChatUtils.sendPlayerMsg(String.format("/%s %s %s", command.get().replace("/", ""), user.get(idx), troll.get(new Random().nextInt(troll.size()))));
idx++;
tick = delay.get();
}
}
Loading

0 comments on commit c673f3c

Please sign in to comment.