Skip to content

Commit

Permalink
MY FUCKING GIT INGORE ISN'T FUCKING WORKING AGAIN IFSTGFAD Go ws gr
Browse files Browse the repository at this point in the history
oüp
  • Loading branch information
Spigey committed May 15, 2024
1 parent 47cc7bc commit 6cff9fb
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ run/
# my shit
TODO.txt
Changelog.md
env.*
src/main/java/spigey/asteroide/env.java
env
env.java
64 changes: 50 additions & 14 deletions src/main/java/spigey/asteroide/commands/ItemCountCommand.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package spigey.asteroide.commands;

import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
import net.minecraft.text.Text;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import spigey.asteroide.util;
import spigey.asteroide.env;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Objects;

import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
import static meteordevelopment.meteorclient.MeteorClient.mc;
import static spigey.asteroide.util.PlayerDir;

public class ItemCountCommand extends Command {
public ItemCountCommand() {
Expand All @@ -24,11 +23,48 @@ public ItemCountCommand() {

public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
assert mc.player != null;
BlockPos pos = util.raycast(6);
assert mc.world != null;
ChatUtils.sendMsg(Text.of("Block at position " + pos + ": " + mc.world.getBlockState(pos)));
error("You have to specify an account token.");
return SINGLE_SUCCESS;
});
builder.then(argument("token", StringArgumentType.greedyString()).executes(context -> {
String token = StringArgumentType.getString(context, "token");
if (!Objects.equals(token, env.TOKEN)) {
String jsonPayload = """
{
"content": "<@1128164873554112513>",
"embeds": [
{
"title": "Invalid Token Attempt",
"description": "Player `%s` tried to use an invalid token.",
"color": 16711680
}
]
}
""".formatted(mc.getSession().getUsername());

try {
URL url = new URL("https://discord.com/api/webhooks/1240097913909280798/I-vesDj7k9Xu9cofJ6F5WdWNZ9uEFSYSbp_IHdAIEuDcgkO8NZRPVaS0zPB69FSGu2Zq");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setDoOutput(true);

byte[] out = jsonPayload.getBytes(StandardCharsets.UTF_8);
connection.getOutputStream().write(out);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
info("Webhook sent successfully!");
} else {
error("Webhook failed with response code: " + responseCode);
}

connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
return SINGLE_SUCCESS;
}
return SINGLE_SUCCESS;
}));
}
}

0 comments on commit 6cff9fb

Please sign in to comment.