From 52fe85f9901dedd2a2deb6410050545b2c73b597 Mon Sep 17 00:00:00 2001 From: nea Date: Fri, 21 Jul 2023 14:19:09 +0200 Subject: Kick if you do manage to join skyblock --- .../com/github/romangraef/skyblockplayersanonymous/SPA.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/github/romangraef/skyblockplayersanonymous/SPA.java b/src/main/java/com/github/romangraef/skyblockplayersanonymous/SPA.java index 0862c43..a90af25 100644 --- a/src/main/java/com/github/romangraef/skyblockplayersanonymous/SPA.java +++ b/src/main/java/com/github/romangraef/skyblockplayersanonymous/SPA.java @@ -6,6 +6,7 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -33,6 +34,16 @@ public class SPA { EVENT_BUS.register(this); } + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + if (event.message.getUnformattedText().replaceAll("§.", "").equals("Welcome to Hypixel SkyBlock!")) { + System.out.println("trying to kick you"); + Minecraft.getMinecraft().addScheduledTask(() -> Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(new ChatComponentText( + "§cYou joined SkyBlock. All hope is lost." + ))); + } + } + @SubscribeEvent public void onTick(TickEvent.ClientTickEvent tick) { if (tick.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null) { -- cgit