-
-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(AutoQueue): message mode (#5696)
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
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
58 changes: 58 additions & 0 deletions
58
...t/ccbluex/liquidbounce/features/module/modules/player/autoqueue/modes/AutoQueueMessage.kt
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
* | ||
* Copyright (c) 2015 - 2025 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.player.autoqueue.modes | ||
|
||
import net.ccbluex.liquidbounce.config.types.Choice | ||
import net.ccbluex.liquidbounce.config.types.ChoiceConfigurable | ||
import net.ccbluex.liquidbounce.event.events.ChatReceiveEvent | ||
import net.ccbluex.liquidbounce.event.handler | ||
import net.ccbluex.liquidbounce.features.module.modules.player.autoqueue.ModuleAutoQueue.modes | ||
|
||
/** | ||
* Can be used for different server that use paper to join a game | ||
*/ | ||
object AutoQueueMessage : Choice("Message") { | ||
|
||
private val text by text("Text", "Новая игра") | ||
private val command by text("Command", "/next") | ||
|
||
override val parent: ChoiceConfigurable<Choice> | ||
get() = modes | ||
|
||
@Suppress("unused") | ||
private val chatReceive = handler<ChatReceiveEvent> { event -> | ||
val message = event.message | ||
|
||
if (event.type != ChatReceiveEvent.ChatType.GAME_MESSAGE) { | ||
return@handler | ||
} | ||
|
||
if (event.message.contains(text)) { | ||
if (command.startsWith("/")) { | ||
network.sendCommand(command.substring(1)) | ||
} else { | ||
network.sendChatMessage(command) | ||
} | ||
} | ||
} | ||
|
||
} |