mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 01:16:46 -04:00
command util: format clickable commands
This commit is contained in:
parent
af79d23851
commit
ae7a2890ab
25
src/main/java/de/bixilon/minosoft/terminal/CommandUtil.kt
Normal file
25
src/main/java/de/bixilon/minosoft/terminal/CommandUtil.kt
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.terminal
|
||||
|
||||
import de.bixilon.minosoft.data.text.TextComponent
|
||||
import de.bixilon.minosoft.data.text.events.click.InternalCommandClickEvent
|
||||
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
||||
|
||||
object CommandUtil {
|
||||
|
||||
fun commandText(command: String): TextComponent {
|
||||
return TextComponent("\"$command\"").clickEvent(InternalCommandClickEvent(command)).color(ChatColors.GRAY).underline()
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
@ -17,8 +17,7 @@ import de.bixilon.minosoft.commands.nodes.LiteralNode
|
||||
import de.bixilon.minosoft.commands.stack.print.PrintTarget
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager
|
||||
import de.bixilon.minosoft.data.text.BaseComponent
|
||||
import de.bixilon.minosoft.data.text.TextComponent
|
||||
import de.bixilon.minosoft.data.text.events.click.InternalCommandClickEvent
|
||||
import de.bixilon.minosoft.terminal.CommandUtil.commandText
|
||||
import de.bixilon.minosoft.updater.MinosoftUpdate
|
||||
import de.bixilon.minosoft.updater.MinosoftUpdater
|
||||
import de.bixilon.minosoft.updater.UpdateProgress
|
||||
@ -66,8 +65,8 @@ object UpdateCommand : Command {
|
||||
} else {
|
||||
print("There is a new update available:")
|
||||
print("Version: ${it.name} (${it.id})")
|
||||
print(BaseComponent("Run ", TextComponent("\"update notes\"").clickEvent(InternalCommandClickEvent("update notes")), " to see the release notes."))
|
||||
print(BaseComponent("Run ", TextComponent("\"update update\"").clickEvent(InternalCommandClickEvent("update update")), " to download and update."))
|
||||
print(BaseComponent("Run ", commandText("update notes"), " to see the release notes."))
|
||||
print(BaseComponent("Run ", commandText("update update"), " to download and update."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user