-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
f4e9923
commit c52e80f
Showing
6 changed files
with
72 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ pluginManagement { | |
} | ||
} | ||
|
||
rootProject.name = "examplemod" | ||
rootProject.name = "anticheater" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.