File tree Expand file tree Collapse file tree
bukkit/src/main/kotlin/org/crashvibe/FGateBukkit/handler
common/src/main/kotlin/org/crashvibe/FGateClient/websocket/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org.crashvibe.FGateBukkit.handler
22
33import net.kyori.adventure.text.Component
4+ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
45import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer
56import org.bukkit.Bukkit
67import org.crashvibe.FGateBukkit.FGateBukkit
@@ -9,10 +10,15 @@ import java.util.function.Consumer
910
1011
1112class Command : Command () {
12- override fun executeCommand (command : String ): CommandResult {
13+ override fun executeCommand (command : String , need_color : Boolean ): CommandResult {
1314 val messages: MutableList <String > = mutableListOf ()
1415 val sender = Bukkit .createCommandSender(Consumer { feedback: Component ->
15- messages.add(PlainTextComponentSerializer .plainText().serialize(feedback))
16+ val serialized = if (need_color) {
17+ LegacyComponentSerializer .legacyAmpersand().serialize(feedback)
18+ } else {
19+ PlainTextComponentSerializer .plainText().serialize(feedback)
20+ }
21+ messages.add(serialized)
1622 })
1723 val latch = java.util.concurrent.CountDownLatch (1 )
1824 var success = false
Original file line number Diff line number Diff line change 11package org.crashvibe.FGateClient.websocket.impl
22
33import com.crashvibe.fgateclient.handler.RequestHandler
4+ import kotlinx.serialization.SerialName
45import kotlinx.serialization.Serializable
56import kotlinx.serialization.json.JsonElement
67import org.crashvibe.FGateClient.websocket.JsonRpcRequest
@@ -12,6 +13,8 @@ abstract class Command : RequestHandler() {
1213 @Serializable
1314 data class Command (
1415 val command : String ,
16+ @SerialName(" need_color" )
17+ val needColor : Boolean ,
1518 )
1619
1720 @Serializable
@@ -22,8 +25,8 @@ abstract class Command : RequestHandler() {
2225
2326 override fun handle (request : JsonRpcRequest <JsonElement >) {
2427 val params = parseParams<Command >(request) ? : return
25- sendResponse(request.id, executeCommand(params.command))
28+ sendResponse(request.id, executeCommand(params.command, params.needColor ))
2629 }
2730
28- abstract fun executeCommand (command : String ): CommandResult
31+ abstract fun executeCommand (command : String , need_color : Boolean ): CommandResult
2932}
Original file line number Diff line number Diff line change 11version =0.0.2
2- apiVersion =0.0.1
2+ apiVersion =0.0.2
33group =org.crashvibe
44description =Client plugin for FlowGate Nexus, providing simplified server connectivity.
You can’t perform that action at this time.
0 commit comments