Skip to content

Commit

Permalink
anti cheater
Browse files Browse the repository at this point in the history
NopoTheGamer committed Oct 17, 2022
1 parent f4e9923 commit c52e80f
Showing 6 changed files with 72 additions and 46 deletions.
20 changes: 10 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -20,21 +20,21 @@ loom {
launchConfigs {
"client" {
// If you don't want mixins, remove these lines
property("mixin.debug", "true")
/*property("mixin.debug", "true")
property("asmhelper.verbose", "true")
arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
arg("--mixin", "mixins.examplemod.json")
arg("--mixin", "mixins.examplemod.json")*/
}
}
forge {
pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter())
// If you don't want mixins, remove this lines
mixinConfig("mixins.examplemod.json")
//mixinConfig("mixins.examplemod.json")
}
// If you don't want mixins, remove these lines
mixin {
/*mixin {
defaultRefmapName.set("mixins.examplemod.refmap.json")
}
}*/
}

sourceSets.main {
@@ -60,10 +60,10 @@ dependencies {
forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")

// If you don't want mixins, remove these lines
shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
/*shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
isTransitive = false
}
annotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT")
annotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT")*/

// If you don't want to log in with your real minecraft account, remove this line
runtimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
@@ -77,14 +77,14 @@ tasks.withType(JavaCompile::class) {
}

tasks.withType(Jar::class) {
archiveBaseName.set("examplemod")
archiveBaseName.set("anticheater")
manifest.attributes.run {
this["FMLCorePluginContainsFMLMod"] = "true"
this["ForceLoadAsMod"] = "true"

// If you don't want mixins, remove these lines
this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker"
this["MixinConfigs"] = "mixins.examplemod.json"
/*this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker"
this["MixinConfigs"] = "mixins.examplemod.json"*/
}
}

2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -18,4 +18,4 @@ pluginManagement {
}
}

rootProject.name = "examplemod"
rootProject.name = "anticheater"
59 changes: 56 additions & 3 deletions src/main/java/com/example/ExampleMod.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,66 @@
package com.example;

import net.minecraft.init.Blocks;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Mod(modid = "examplemod", version = "1.0.0")
import java.io.*;
import java.net.URL;
import java.util.concurrent.CompletableFuture;


// https://gist.githubusercontent.com/PizzaboiBestLegit/c65896b963454b679eb68a29435ccb19/raw
// Dungeon Finder > Proplayerist joined the dungeon group! (Tank Level 31)

@Mod(modid = "anticheater", version = "1.0.0")
public class ExampleMod {
public final Gson gson = new GsonBuilder().setPrettyPrinting().create();
public JsonObject data = null;
boolean shouldError = true;

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
System.out.println("Dirt: " + Blocks.dirt.getUnlocalizedName());
fetchCheaters();
MinecraftForge.EVENT_BUS.register(this);
}

@SubscribeEvent
public void onChat(ClientChatReceivedEvent event) {
if (data == null) {
if (shouldError && Minecraft.getMinecraft().currentScreen == null) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cError fetching cheaters!"));
shouldError = false;
}
return;
};
String message = event.message.getUnformattedText();
if (message.contains("Dungeon Finder > ")) {
String ign = message.substring("Dungeon Finder > ".length()).split(" ")[0];
if (data.has(ign)) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("!!!!"));
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§c" + ign + " is a cheater!"));
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("!!!!"));
}
}
}

public void fetchCheaters() {
CompletableFuture.supplyAsync(() -> {
try (Reader inReader = new InputStreamReader(new URL("https://gist.githubusercontent.com/PizzaboiBestLegit/c65896b963454b679eb68a29435ccb19/raw").openStream())) {
data = gson.fromJson(inReader, JsonObject.class);
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
});
}
}
16 changes: 0 additions & 16 deletions src/main/java/com/example/mixin/MixinGuiMainMenu.java

This file was deleted.

10 changes: 5 additions & 5 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[
{
"modid": "examplemod",
"name": "Xample Mod",
"description": "A mod that is used as an example.",
"modid": "anticheater",
"name": "AntiCheater",
"description": "Tells you if a person who joined the party via dungeon finder has a pizza name",
"version": "1.0.0",
"mcversion": "1.8.9",
"url": "https://github.com/romangraef/Forge1.8.9Template/",
"url": "https://github.com/NopoTheGamer/Anti-Cheater/",
"updateUrl": "",
"authorList": [
"You"
"nopo"
],
"credits": "",
"logoFile": "",
11 changes: 0 additions & 11 deletions src/main/resources/mixins.examplemod.json

This file was deleted.

0 comments on commit c52e80f

Please sign in to comment.