forked from Cookies_Github_mirror/AquaDX
[+] Allow disable music rank for own machine (#110)
* [+] Allow disable music rank for own machine * fix
This commit is contained in:
@@ -43,6 +43,9 @@ class AquaGameOptions(
|
||||
|
||||
@SettingField("chu3-matching")
|
||||
var chusanMatchingReflector: String = "",
|
||||
|
||||
@SettingField("mai2")
|
||||
var enableMusicRank: Boolean = true,
|
||||
)
|
||||
|
||||
interface AquaGameOptionsRepo : JpaRepository<AquaGameOptions, Long>
|
||||
|
||||
@@ -3,6 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import ext.logger
|
||||
import ext.thread
|
||||
import icu.samnyan.aqua.sega.allnet.TokenChecker
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.QMai2UserPlaylog
|
||||
import org.springframework.scheduling.annotation.Scheduled
|
||||
@@ -55,7 +56,14 @@ class GetGameRankingHandler(
|
||||
override fun handle(request: Map<String, Any>): Any = mapOf(
|
||||
"type" to request["type"],
|
||||
"gameRankingList" to when(request["type"]) {
|
||||
1 -> musicRankingCache.map { mapOf("id" to it.musicId, "point" to it.weight, "userName" to "") }
|
||||
1 -> {
|
||||
val opts = TokenChecker.getCurrentSession()?.user?.gameOptions
|
||||
// If is null or true, return the ranking list
|
||||
if (opts?.enableMusicRank == false)
|
||||
emptyList()
|
||||
else
|
||||
musicRankingCache.map { mapOf("id" to it.musicId, "point" to it.weight, "userName" to "") }
|
||||
}
|
||||
else -> emptyList()
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user