|
| 1 | +/* |
| 2 | + * Copyright 2025 Lambda |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package com.lambda.module.modules.player |
| 19 | + |
| 20 | +import com.lambda.event.events.TickEvent |
| 21 | +import com.lambda.event.listener.SafeListener.Companion.listen |
| 22 | +import com.lambda.module.Module |
| 23 | +import com.lambda.module.tag.ModuleTag |
| 24 | +import net.minecraft.util.Hand |
| 25 | + |
| 26 | +object AntiAFK : Module( |
| 27 | + name = "AntiAFK", |
| 28 | + description = "Keeps you from getting kicked", |
| 29 | + tag = ModuleTag.PLAYER, |
| 30 | +) { |
| 31 | + private val delay by setting("Delay", 300, 5..600, 1, unit = " s", description = "Delay between swinging the hand.") |
| 32 | + private val swingHand by setting("Swing Hand", Hand.MAIN_HAND, description = "Hand to swing.") |
| 33 | + |
| 34 | + init { |
| 35 | + listen<TickEvent.Pre> { |
| 36 | + if (mc.uptimeInTicks % (delay * 20) != 0L) return@listen |
| 37 | + player.swingHand(swingHand) |
| 38 | + } |
| 39 | + } |
| 40 | +} |
0 commit comments