Compare commits
3 Commits
1c304a5108
...
master
Author | SHA1 | Date | |
---|---|---|---|
80d58ea4e2
|
|||
770a58fb1d
|
|||
1862ce4f65
|
@@ -39,6 +39,7 @@ 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) {
|
||||||
|
if (config.getBoolean("debug"))
|
||||||
logger.info("Received WebSocket packet: type=${packet.type}")
|
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 {
|
||||||
|
@@ -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)
|
||||||
|
@@ -27,9 +27,8 @@ class SnChatListener(
|
|||||||
@Suppress("SENSELESS_COMPARISON")
|
@Suppress("SENSELESS_COMPARISON")
|
||||||
@EventHandler()
|
@EventHandler()
|
||||||
fun onPlayerJoin(event: PlayerJoinEvent) {
|
fun onPlayerJoin(event: PlayerJoinEvent) {
|
||||||
val user = CMI.getInstance().playerManager.getUser(event.player);
|
val firstTime = Bukkit.getOfflinePlayer(event.player.uniqueId) == null;
|
||||||
val firstTime = user.playerTime == 0L;
|
val templateKey = if (!firstTime) "join" else "join_first";
|
||||||
val templateKey = if (!firstTime) "join" else "joinFirst";
|
|
||||||
val template = messages[templateKey]
|
val template = messages[templateKey]
|
||||||
?: if (!firstTime) "➡️ {player} joined the game." else "➡️ {player} first time joined the game."
|
?: if (!firstTime) "➡️ {player} joined the game." else "➡️ {player} first time joined the game."
|
||||||
val message = template.replace("{player}", event.player.name)
|
val message = template.replace("{player}", event.player.name)
|
||||||
|
@@ -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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
join: "➡️ {player} joined the game."
|
join: "➡️ {player} joined the game."
|
||||||
joinFirst: "➡️ {player} first time joined the game."
|
join_first: "➡️ {player} first time joined the game."
|
||||||
quit: "⬅️ {player} left the game."
|
quit: "⬅️ {player} left the game."
|
||||||
death: "💀 {player} {message}"
|
death: "💀 {player} {message}"
|
||||||
advancement: "🎉 {player} unlocked advancement: {advancement}"
|
advancement: "🎉 {player} unlocked advancement: {advancement}"
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
join: "➡️ {player} 加入了游戏。"
|
join: "➡️ {player} 加入了游戏。"
|
||||||
joinFirst: "➡️ {player} 首次加入了游戏。"
|
join_first: "➡️ {player} 首次加入了游戏。"
|
||||||
quit: "⬅️ {player} 离开了游戏。"
|
quit: "⬅️ {player} 离开了游戏。"
|
||||||
death: "💀 {player} {message}"
|
death: "💀 {player} {message}"
|
||||||
advancement: "🎉 {player} 解锁成就:{advancement}"
|
advancement: "🎉 {player} 解锁成就:{advancement}"
|
||||||
|
Reference in New Issue
Block a user