-
-
Notifications
You must be signed in to change notification settings - Fork 684
feat(Misc): AutoTPA #8408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
minecrrrr
wants to merge
13
commits into
CCBlueX:nextgen
Choose a base branch
from
minecrrrr:AutoTPA
base: nextgen
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(Misc): AutoTPA #8408
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7db4487
fix(Project): set exploit preventer version from 1.0.6+ to 1.0.6+26.1
minecrrrr 3ce3d12
feat(Misc): AutoTPA
minecrrrr a5e8a07
feat(AutoTPA): add blacklist words for teleport messages
minecrrrr 94bc29c
feat(AutoTPA): add Notifier support to AutoTPA
minecrrrr 2cbfd3a
Merge branch 'nextgen' into AutoTPA
minecrrrr a7b4f37
docs(lang): add description for AutoTPA
minecrrrr 758150b
Merge branch 'CCBlueX:nextgen' into AutoTPA
minecrrrr 3275541
Merge branch 'nextgen' into AutoTPA
minecrrrr 549f0ff
Merge branch 'CCBlueX:nextgen' into AutoTPA
minecrrrr 1a9bca2
Merge branch 'nextgen' into AutoTPA
minecrrrr 0585c37
Merge branch 'CCBlueX:nextgen' into AutoTPA
minecrrrr 6618c5e
Merge branch 'CCBlueX:nextgen' into AutoTPA
minecrrrr 20b96b5
Merge branch 'CCBlueX:nextgen' into AutoTPA
minecrrrr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
95 changes: 95 additions & 0 deletions
95
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/misc/ModuleAutoTPA.kt
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| /* | ||
| * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
| * | ||
| * Copyright (c) 2015 - 2026 CCBlueX | ||
| * | ||
| * LiquidBounce is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * LiquidBounce is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package net.ccbluex.liquidbounce.features.module.modules.misc | ||
|
|
||
| import net.ccbluex.liquidbounce.config.types.list.Tagged | ||
| import net.ccbluex.liquidbounce.event.events.PacketEvent | ||
| import net.ccbluex.liquidbounce.event.events.PlayerTickEvent | ||
| import net.ccbluex.liquidbounce.event.handler | ||
| import net.ccbluex.liquidbounce.features.misc.FriendManager | ||
| import net.ccbluex.liquidbounce.features.module.ClientModule | ||
| import net.ccbluex.liquidbounce.features.module.ModuleCategories | ||
| import net.ccbluex.liquidbounce.script.bindings.api.ScriptClient | ||
| import net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket | ||
| import net.minecraft.network.protocol.game.ClientboundSystemChatPacket | ||
|
|
||
| object ModuleAutoTPA : ClientModule("AutoTPA", ModuleCategories.MISC) { | ||
|
|
||
| private val mode by enumChoice("Command", Modes.TPACCEPT) | ||
| private val friendsOnly by boolean("OnlyFriends", true) | ||
|
|
||
| private val teleportMessages = arrayOf( | ||
| "has requested teleport", "просит телепортироваться", "хочет телепортироваться к вам", | ||
| "просит к вам телепортироваться", "хочет телепортироваться к вам.", "отправил вам запрос на телепортацию", | ||
| "/tpyes", "/tpaccept", "/tpno", "/tpdeny", "Z Запрос на телепортацию от", "Z Принять - /tpyes", | ||
| "Z Отклонить - /tpno", "has requested to teleport to you", "To teleport, type /tpaccept", | ||
| "To deny, type /tpdeny", "wants to teleport to you", "[Accept]", "[Deny]", "Incoming teleport request from", | ||
| "Teleport to you", "has sent a TPA request", "sent a teleport request to you", "[Accept", "[Deny", "accept]", | ||
| "deny]" | ||
| ) | ||
|
|
||
| private val blacklistMessages = arrayOf( | ||
| "✉", "[ЛС]", "You]", "Я]", "Вы]", "I]", "» You", "-> You","» I", "-> I", "» Я", "-> Я", | ||
| "» Вы", "-> Вы", "You)", "Я)", "Вы)", "I)", | ||
| ) | ||
|
|
||
| private var canAccept = false | ||
|
|
||
| @Suppress("unused") | ||
| private val onPacket = handler<PacketEvent> { e -> | ||
| val message = when (val packet = e.packet) { | ||
| is ClientboundSystemChatPacket -> packet.content().string | ||
| is ClientboundDisguisedChatPacket -> packet.message().string | ||
| else -> return@handler | ||
| } | ||
|
|
||
| if (isTeleportMessage(message)) { | ||
| if (friendsOnly) { | ||
| val matchedTrigger = teleportMessages.firstOrNull { message.contains(it, ignoreCase = true) } ?: "" | ||
| val cleanMessage = message.replace(matchedTrigger, "", ignoreCase = true) | ||
|
|
||
| canAccept = FriendManager.friends.any { cleanMessage.contains(it.name, ignoreCase = true) } | ||
| } else { | ||
| canAccept = true | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Suppress("unused") | ||
| private val onTick = handler<PlayerTickEvent> { | ||
| if (canAccept) { | ||
| canAccept = false | ||
| val player = mc.player ?: return@handler | ||
|
|
||
| player.connection.sendCommand(mode.tag) | ||
| ScriptClient.displayChatMessage("§a[AutoTPA] §7Teleport request accepted!") | ||
|
MukjepScarlet marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
|
|
||
| private fun isTeleportMessage(message: String): Boolean { | ||
| return teleportMessages.any { message.contains(it, ignoreCase = true) } | ||
| && !blacklistMessages.any { message.contains(it, ignoreCase = true) } | ||
| } | ||
|
|
||
| private enum class Modes(override val tag: String) : Tagged { | ||
| TPACCEPT("tpaccept"), | ||
| TPYES("tpyes"), | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.