From 6332080493f5e292db2f43b834e21844e4d25988 Mon Sep 17 00:00:00 2001 From: Bella Date: Tue, 17 Mar 2020 17:03:53 -0400 Subject: [PATCH] add end teleport --- .../module/modules/player/EndTeleport.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/main/java/me/zeroeightsix/kami/module/modules/player/EndTeleport.java diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/player/EndTeleport.java b/src/main/java/me/zeroeightsix/kami/module/modules/player/EndTeleport.java new file mode 100644 index 00000000..0cbbeab0 --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/module/modules/player/EndTeleport.java @@ -0,0 +1,43 @@ +package me.zeroeightsix.kami.module.modules.player; + +import me.zero.alpine.listener.EventHandler; +import me.zero.alpine.listener.Listener; +import me.zeroeightsix.kami.command.Command; +import me.zeroeightsix.kami.event.events.PacketEvent; +import me.zeroeightsix.kami.module.Module; +import me.zeroeightsix.kami.setting.Setting; +import me.zeroeightsix.kami.setting.Settings; +import me.zeroeightsix.kami.util.Wrapper; +import net.minecraft.network.play.server.SPacketDisconnect; +import net.minecraft.network.play.server.SPacketRespawn; +import net.minecraft.util.text.TextComponentString; + +import java.util.Objects; + +/** + * Created by 0x2E | PretendingToCode + */ +@Module.Info(name = "EndTeleport", category = Module.Category.PLAYER, description = "Allows for teleportation when going through end portals") +public class EndTeleport extends Module { + private Setting confirmed = register(Settings.b("Confirm", true)); + + @Override + public void onEnable() { + if (Wrapper.getMinecraft().getCurrentServerData() == null) { + Command.sendWarningMessage(getChatName() + "This module does not work in singleplayer"); + disable(); + } else if (!confirmed.getValue()) { + Command.sendWarningMessage(getChatName() + "This module will kick you from the server! It is part of the exploit and cannot be avoided"); + } + } + + @EventHandler + public Listener receiveListener = new Listener<>(event -> { + if (event.getPacket() instanceof SPacketRespawn) { + if (((SPacketRespawn) event.getPacket()).getDimensionID() == 1 && confirmed.getValue()) { + Objects.requireNonNull(Wrapper.getMinecraft().getConnection()).handleDisconnect(new SPacketDisconnect(new TextComponentString("Attempting teleportation exploit"))); + disable(); + } + } + }); +}