Skip to content

Commit b40cfab

Browse files
committed
Make command somewhat useful
1 parent d357889 commit b40cfab

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/main/kotlin/org/polyfrost/polyplus/client/PolyPlusClient.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package org.polyfrost.polyplus.client
22

3+
import dev.deftu.omnicore.api.client.commands.OmniClientCommands
34
import dev.deftu.omnicore.api.client.player.playerUuid
5+
import dev.deftu.textile.Text
6+
import dev.deftu.textile.minecraft.MCTextStyle
7+
import dev.deftu.textile.minecraft.TextColors
48
import io.ktor.client.HttpClient
59
import io.ktor.client.engine.cio.CIO
610
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
@@ -24,6 +28,8 @@ import org.polyfrost.polyplus.client.network.http.PolyAuthorization
2428
import org.polyfrost.polyplus.client.network.http.PolyCosmetics
2529
import org.polyfrost.polyplus.client.network.websocket.PolyConnection
2630
import org.polyfrost.polyplus.client.network.websocket.ServerboundPacket
31+
import org.polyfrost.polyui.data.PolyImage
32+
import org.polyfrost.polyui.utils.image
2733

2834
object PolyPlusClient {
2935
private val LOGGER = LogManager.getLogger(PolyPlusConstants.NAME)
@@ -68,6 +74,21 @@ object PolyPlusClient {
6874

6975
refresh()
7076
PolyPlusConfig.addDefaultCommand(PolyPlusConstants.ID)
77+
.then(OmniClientCommands.literal("refresh")
78+
.executes { ctx ->
79+
refresh()
80+
LOGGER.info("PolyPlus Client refresh triggered via command.")
81+
val text = Text.literal("PolyPlus will refresh in the background.")
82+
.setStyle(MCTextStyle.color(TextColors.GREEN))
83+
ctx.source.replyChat(text)
84+
})
85+
.then(OmniClientCommands.literal("version")
86+
.executes { ctx ->
87+
val text = Text.literal("PolyPlus Client version: ${PolyPlusConstants.VERSION}")
88+
.setStyle(MCTextStyle.color(TextColors.AQUA))
89+
ctx.source.replyChat(text)
90+
})
91+
.apply(OmniClientCommands::register)
7192
}
7293

7394
fun refresh() {

0 commit comments

Comments
 (0)