Compare commits
2 Commits
1c304a5108
...
770a58fb1d
Author | SHA1 | Date | |
---|---|---|---|
770a58fb1d
|
|||
1862ce4f65
|
@@ -39,7 +39,8 @@ class SolarNetworkConnect : JavaPlugin() {
|
|||||||
private var playerSolarpassMap: MutableMap<String, String?> = mutableMapOf()
|
private var playerSolarpassMap: MutableMap<String, String?> = mutableMapOf()
|
||||||
|
|
||||||
private fun handleWebSocketPacket(packet: WebSocketPacket) {
|
private fun handleWebSocketPacket(packet: WebSocketPacket) {
|
||||||
logger.info("Received WebSocket packet: type=${packet.type}")
|
if (config.getBoolean("debug"))
|
||||||
|
logger.info("Received WebSocket packet: type=${packet.type}")
|
||||||
if (packet.type.startsWith("messages") && packet.data != null) {
|
if (packet.type.startsWith("messages") && packet.data != null) {
|
||||||
try {
|
try {
|
||||||
when (packet.type) {
|
when (packet.type) {
|
||||||
|
@@ -187,15 +187,11 @@ class SnCommand(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
val transactionSrv = SnBalanceService(sn);
|
val transactionSrv = SnBalanceService(sn);
|
||||||
val transaction = transactionSrv.addBalance(amount, "Withdraw from GoatCraft", accountId);
|
transactionSrv.addBalance(amount, "Withdraw from GoatCraft", accountId);
|
||||||
val transactionHintComponent =
|
val transactionHintComponent =
|
||||||
TextComponent(
|
TextComponent(
|
||||||
ChatColor.GREEN.toString() + (messages["command_withdraw_done"]
|
ChatColor.GREEN.toString() + (messages["command_withdraw_done"]
|
||||||
?: "Done! transaction number ") + ChatColor.WHITE + ChatColor.BOLD + "#${
|
?: "Done! ")
|
||||||
transaction.id.take(
|
|
||||||
6
|
|
||||||
)
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
p0.playSound(p0.player!!, Sound.BLOCK_ANVIL_PLACE, 1.0F, 1.0F)
|
p0.playSound(p0.player!!, Sound.BLOCK_ANVIL_PLACE, 1.0F, 1.0F)
|
||||||
|
@@ -47,7 +47,7 @@ class SnBalanceService(private val sn: SnService) {
|
|||||||
ignoreUnknownKeys = true
|
ignoreUnknownKeys = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addBalance(amount: Double, remark: String, accountID: String): SnTransaction {
|
fun addBalance(amount: Double, remark: String, accountID: String) {
|
||||||
val body = SnTransactionRequest(
|
val body = SnTransactionRequest(
|
||||||
amount = amount,
|
amount = amount,
|
||||||
remark = remark,
|
remark = remark,
|
||||||
@@ -65,10 +65,6 @@ class SnBalanceService(private val sn: SnService) {
|
|||||||
|
|
||||||
sn.client.newCall(request).execute().use { response ->
|
sn.client.newCall(request).execute().use { response ->
|
||||||
if (!response.isSuccessful) throw IOException("Unexpected code $response")
|
if (!response.isSuccessful) throw IOException("Unexpected code $response")
|
||||||
val responseBody = response.body!!.string()
|
|
||||||
val out = json.decodeFromString<SnTransaction>(responseBody)
|
|
||||||
|
|
||||||
return out
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user