Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kloping committed May 2, 2022
1 parent 5548080 commit c749cf0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 14 deletions.
Binary file modified out/artifacts/a1-miraiLSys.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/cn/kloping/lsys/PluginMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import kotlin.coroutines.CoroutineContext
* @Author hrs [email protected]
*/
class PluginMain() : KotlinPlugin(
JvmPluginDescriptionBuilder("cn.kloping.Lsys", "0.2.9")
JvmPluginDescriptionBuilder("cn.kloping.Lsys", "0.3")
.name("p_0-Author-HRS-LSys-Loaded")
.info("Lsys-main")
.author("HRS")
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cn/kloping/lsys/Resource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ object Resource {
put("存积分.*", "m3")
put("开启", "mOpen")
put("关闭", "mClose")
put("开启群.*?", "mOpen0")
put("关闭.*?", "mClose0")
put("开启私聊", "mpOpen")
put("关闭私聊", "mpClose")
put("菜单", "menuN")
Expand Down
54 changes: 41 additions & 13 deletions src/main/java/cn/kloping/lsys/workers/Methods.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import cn.kloping.lsys.toLink
import io.github.kloping.number.NumberUtils
import kotlinx.coroutines.runBlocking
import net.mamoe.mirai.contact.Contact
import net.mamoe.mirai.event.events.MessageEvent
import net.mamoe.mirai.message.code.MiraiCode
import net.mamoe.mirai.message.data.MessageChainBuilder
import java.util.concurrent.ConcurrentHashMap
Expand Down Expand Up @@ -120,18 +119,47 @@ object Methods {
val gq: Number = any?.gId!!
if (user.qq == Resource.conf.qq) {
if (Resource.conf.opens.contains(gq)) {
/* Resource.conf.opens = Resource.conf.opens.apply {
for ((i, gi) in this.withIndex()) {
when (gi) {
gq -> {
this.drop(i)
break
}
}
}
}
Resource.conf.apply()
*/
conf.opens.remove(gq);
conf.apply();
Result(null, 0)
} else {
Result(null, 1)
}
} else {
null
}
}

/**
* 开启
*/
@JvmField
val mOpen0: (arg: User, args: Request?) -> Result? = { user: User, any: Request? ->
val t1 = any?.str
val numStr = NumberUtils.findNumberFromString(t1);
val gq: Number = Integer.parseInt(numStr);
if (user.qq == Resource.conf.qq) {
if (conf.opens.add(gq.toLong())) {
Resource.conf.apply()
Result(null, 0)
} else {
Result(null, 1)
}
} else {
null
}
}

/**
* 关闭
*/
@JvmField
val mClose0: (arg: User, args: Request?) -> Result? = { user: User, any: Request? ->
val t1 = any?.str
val numStr = NumberUtils.findNumberFromString(t1);
val gq: Number = Integer.parseInt(numStr);
if (user.qq == Resource.conf.qq) {
if (Resource.conf.opens.contains(gq)) {
conf.opens.remove(gq);
conf.apply();
Result(null, 0)
Expand Down

0 comments on commit c749cf0

Please sign in to comment.