-
-
Notifications
You must be signed in to change notification settings - Fork 420
Closed
Labels
bugAn issue that needs to be fixed. Alternatively, a PR fixing an issue.An issue that needs to be fixed. Alternatively, a PR fixing an issue.completedThe issue has been fully resolved and the change will be in the next Skript update.The issue has been fully resolved and the change will be in the next Skript update.
Description
Skript/Server Version
2.12.0
MC 1.21.5Bug Description
When executing a round function, it can throw an exception when a number is a certain value.
Expected Behavior
To not throw an exception
Steps to Reproduce
on script load:
set {memoryMXBean} to ManagementFactory.getMemoryMXBean()
every 5 minutes:
set {_heap} to {memoryMXBean}.getHeapMemoryUsage()
set {_used} to {_heap}.getUsed()
set {_max} to {_heap}.getMax()
set {_usedGB} to round({_used} / 1024 / 1024 / 1024 * 10) / 10
set {_maxGB} to round({_max} / 1024 / 1024 / 1024 * 10) / 10
set {_percent} to round((({_used} * 100) / {_max}), 1)
set {_color} to "&a"
if {_percent} >= 80:
set {_color} to "&c"
else if {_percent} >= 60:
set {_color} to "&e"
else if {_percent} >= 40:
set {_color} to "&6"
if {_percent} < 10:
stop
broadcast "&fMemory usage: &7(%{_color}%%{_usedGB}% GB &7/ &f%{_maxGB}% GB &7(%{_color}%%{_percent}%%% &7used&7))"
Errors or Screenshots
[16:09:48 ERROR]: #!#! Stack trace:
[16:09:48 ERROR]: #!#! Caused by: java.lang.NumberFormatException: Character N is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
[16:09:48 ERROR]: #!#! at java.base/java.math.BigDecimal.<init>(BigDecimal.java:608)
[16:09:48 ERROR]: #!#! at java.base/java.math.BigDecimal.<init>(BigDecimal.java:497)
[16:09:48 ERROR]: #!#! at java.base/java.math.BigDecimal.<init>(BigDecimal.java:903)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.classes.data.DefaultFunctions$2.executeSimple(DefaultFunctions.java:69)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.classes.data.DefaultFunctions$2.executeSimple(DefaultFunctions.java:59)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.function.SimpleJavaFunction.execute(SimpleJavaFunction.java:39)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.function.Function.execute(Function.java:116)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.function.FunctionReference.execute(FunctionReference.java:378)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.function.ExprFunctionCall.get(ExprFunctionCall.java:50)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:86)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.effects.EffChange.execute(EffChange.java:302)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.Effect.run(Effect.java:42)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:40)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:67)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.lang.Trigger.execute(Trigger.java:33)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.events.EvtPeriodical.execute(EvtPeriodical.java:103)
[16:09:48 ERROR]: #!#! at Skript-2.12.0.jar//ch.njol.skript.events.EvtPeriodical.lambda$postLoad$0(EvtPeriodical.java:62)
[16:09:48 ERROR]: #!#! at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:78)
[16:09:48 ERROR]: #!#! at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:474)
[16:09:48 ERROR]: #!#! at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1505)
[16:09:48 ERROR]: #!#! at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1249)
[16:09:48 ERROR]: #!#! at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:308)
[16:09:48 ERROR]: #!#! at java.base/java.lang.Thread.run(Thread.java:1583)
[16:09:48 ERROR]: #!#!
[16:09:48 ERROR]: #!#! Skript: 2.12.0 (unknown)
[16:09:48 ERROR]: #!#! Flavor: selfbuilt-unknown
[16:09:48 ERROR]: #!#! Date: unknown
[16:09:48 ERROR]: #!#! Bukkit: 1.21.5-R0.1-SNAPSHOT
[16:09:48 ERROR]: #!#! Minecraft: 1.21.5
[16:09:48 ERROR]: #!#! Java: 21.0.8 (OpenJDK 64-Bit Server VM 21.0.8+9-Ubuntu-0ubuntu122.04.1)
[16:09:48 ERROR]: #!#! OS: Linux amd64 5.15.0-138-generic
[16:09:48 ERROR]: #!#!
[16:09:48 ERROR]: #!#! Server platform: Paper
[16:09:48 ERROR]: #!#!
[16:09:48 ERROR]: #!#! Current node: null
[16:09:48 ERROR]: #!#! Current item: set {_percent} (as java.lang.Object) to round((({_used} (as java.lang.Object) * [[long:100]]) / {_max} (as java.lang.Object) >> ch.njol.skript.lang.util.ConvertedExpression$$Lambda/0x00007f7601e28220@31ec55ae: ConverterInfo{from=class java.lang.Number,to=class java.lang.Number,converter=ch.njol.skript.lang.util.ConvertedExpression$$Lambda/0x00007f7601e30fa8@731ef771,flags=0}), [[long:1]])
[16:09:48 ERROR]: #!#! Current trigger: every 5 seconds (every 5 seconds) (monitor.sk, line 9)
[16:09:48 ERROR]: #!#! Thread: Server thread
[16:09:48 ERROR]: #!#! Language: english
[16:09:48 ERROR]: #!#! Link parse mode: DISABLED
[16:09:48 ERROR]: #!#! End of Error.
Other
No response
Agreement
- I have read the guidelines above and affirm I am following them with this report.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugAn issue that needs to be fixed. Alternatively, a PR fixing an issue.An issue that needs to be fixed. Alternatively, a PR fixing an issue.completedThe issue has been fully resolved and the change will be in the next Skript update.The issue has been fully resolved and the change will be in the next Skript update.