Skip to content

Commit 36b1d9e

Browse files
authored
修复 1.21.11 部分异常功能 & 修复 JavaScript 功能报错失效
2 parents a561f38 + 60331fd commit 36b1d9e

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ subprojects {
7272
disableOnSkippedVersion = false
7373
}
7474
version {
75-
taboolib = "6.2.4-5902762"
75+
taboolib = "6.2.4-8d51195"
7676
coroutines = null
7777
}
7878
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
group=me.arasple.mc.trmenu
2-
version=3.9.16
2+
version=3.9.17

plugin/src/main/kotlin/trplugins/menu/api/action/impl/send/CommandOp.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.bukkit.entity.Player
44
import taboolib.common.platform.ProxyPlayer
55
import taboolib.common.platform.function.submit
66
import taboolib.expansion.dispatchCommandAsOp
7+
import taboolib.platform.util.runTask
78
import trplugins.menu.api.action.ActionHandle
89
import trplugins.menu.api.action.base.ActionBase
910
import trplugins.menu.api.action.base.ActionContents
@@ -22,23 +23,24 @@ class CommandOp(handle: ActionHandle) : ActionBase(handle) {
2223

2324
override fun onExecute(contents: ActionContents, player: ProxyPlayer, placeholderPlayer: ProxyPlayer) {
2425
val fakeOp = player.session().menu?.settings?.commandFakeOp ?: true
26+
val bukkitPlayer = player.cast<Player>()
2527
contents.stringContent().parseContentSplited(placeholderPlayer, ";").forEach {
26-
submit(async = false) {
28+
bukkitPlayer.location.runTask( {
2729
if (fakeOp) {
28-
player.cast<Player>().dispatchCommandAsOp(it)
30+
bukkitPlayer.dispatchCommandAsOp(it)
2931
} else {
3032
player.isOp.let { isOp ->
3133
player.isOp = true
3234
try {
33-
player.performCommand(it)
35+
bukkitPlayer.performCommand(it)
3436
} catch (e: Throwable) {
3537
e.printStackTrace()
3638
} finally {
3739
player.isOp = isOp
3840
}
3941
}
4042
}
41-
}
43+
})
4244
}
4345
}
4446

plugin/src/main/kotlin/trplugins/menu/module/internal/script/js/NashornAgent.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
package trplugins.menu.module.internal.script.js
22

33
import com.google.common.collect.Maps
4+
import taboolib.common.env.RuntimeDependencies
5+
import taboolib.common.env.RuntimeDependency
46
import taboolib.common5.compileJS
57
import trplugins.menu.util.EvalResult
68
import javax.script.CompiledScript
79
import javax.script.SimpleScriptContext
810

11+
@RuntimeDependencies(
12+
RuntimeDependency(
13+
"!org.ow2.asm:asm:9.7.1",
14+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
15+
),
16+
RuntimeDependency(
17+
"!org.ow2.asm:asm-commons:9.7.1",
18+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
19+
),
20+
RuntimeDependency(
21+
"!org.ow2.asm:asm-tree:9.7.1",
22+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
23+
),
24+
RuntimeDependency(
25+
"!org.ow2.asm:asm-util:9.7.1",
26+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
27+
),
28+
RuntimeDependency(
29+
"!org.ow2.asm:asm-analysis:9.7.1",
30+
test = "!jdk.nashorn.api.scripting.NashornScriptEngineFactory"
31+
)
32+
)
33+
934
object NashornAgent {
1035
private val compiledScripts = Maps.newConcurrentMap<String, CompiledScript>();
1136
fun preCompile(script: String): CompiledScript {

0 commit comments

Comments
 (0)