Skript

Skript

743k Downloads

java.lang.ClassCastException: class java.lang.Double cannot be cast to class ch.njol.skript.hooks.economy.classes.Money

1immy opened this issue · 1 comments

commented

Skript/Server Version

[09:04:12 INFO]: [Skript] Server Version: 1.21-2252-d5c06b4 (MC: 1.21)
[09:04:12 INFO]: [Skript] Skript Version: 2.9.0 (skriptlang-github)
[09:04:12 INFO]: [Skript] Installed Skript Addons: 
[09:04:12 INFO]: [Skript]  - SkQuery v4.1.10
[09:04:12 INFO]: [Skript] Installed dependencies: 
[09:04:12 INFO]: [Skript]  - Vault v1.7.3-b131
[09:04:12 INFO]: [Skript]  - WorldGuard v7.0.11-SNAPSHOT+2278-6898ad8

Bug Description

Attempting to access variable with a double type throws a typecast error. Here is the error message:

[09:03:13 ERROR]: #!#! Stack trace:
[09:03:13 ERROR]: #!#! java.lang.ClassCastException: class java.lang.Double cannot be cast to class ch.njol.skript.hooks.economy.classes.Money (java.lang.Double is in module java.base of loader 'bootstrap'; ch.njol.skript.hooks.economy.classes.Money is in unnamed module of loader 'Skript-2.9.0.jar' @720b63d8)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.hooks.economy.classes.Money$4.convert(Money.java:97)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//org.skriptlang.skript.lang.converter.Converters.convert(Converters.java:501)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.util.ConvertedExpression.getArray(ConvertedExpression.java:196)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.function.FunctionReference.execute(FunctionReference.java:313)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.function.ExprFunctionCall.get(ExprFunctionCall.java:60)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:97)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.VariableString.toString(VariableString.java:532)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.VariableString.iterator(VariableString.java:721)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.ExpressionList$1.hasNext(ExpressionList.java:134)
[09:03:13 ERROR]: #!#!     at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132)
[09:03:13 ERROR]: #!#!     at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
[09:03:13 ERROR]: #!#!     at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[09:03:13 ERROR]: #!#!     at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[09:03:13 ERROR]: #!#!     at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
[09:03:13 ERROR]: #!#!     at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[09:03:13 ERROR]: #!#!     at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.expressions.ExprItemWithLore.get(ExprItemWithLore.java:69)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.expressions.ExprItemWithLore.get(ExprItemWithLore.java:41)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.expressions.base.PropertyExpression.get(PropertyExpression.java:88)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:97)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.util.SimpleExpression.getSingle(SimpleExpression.java:60)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.util.ConvertedExpression.getSingle(ConvertedExpression.java:188)
[09:03:13 ERROR]: #!#!     at SkQuery-4.1.10.jar//com.w00tmast3r.skquery.elements.effects.EffFormatSlot.execute(EffFormatSlot.java:62)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.Effect.run(Effect.java:49)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:88)
[09:03:13 ERROR]: #!#!     at Skript-2.9.0.jar//ch.njol.skript.effects.Delay.lambda$walk$0(Delay.java:107)
[09:03:13 ERROR]: #!#!     at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:101)
[09:03:13 ERROR]: #!#!     at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:482)
[09:03:13 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1689)
[09:03:13 ERROR]: #!#!     at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:507)
[09:03:13 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1573)
[09:03:13 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1275)
[09:03:13 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:332)
[09:03:13 ERROR]: #!#!     at java.base/java.lang.Thread.run(Thread.java:1583)
[09:03:13 ERROR]: #!#! 
[09:03:13 ERROR]: #!#! Version Information:
[09:03:13 ERROR]: #!#!   Skript: 2.9.0 (latest)
[09:03:13 ERROR]: #!#!     Flavor: skriptlang-github
[09:03:13 ERROR]: #!#!     Date: 16:01:35.354421100
[09:03:13 ERROR]: #!#!   Bukkit: 1.21-R0.1-SNAPSHOT
[09:03:13 ERROR]: #!#!   Minecraft: 1.21
[09:03:13 ERROR]: #!#!   Java: 21.0.3 (OpenJDK 64-Bit Server VM 21.0.3+9-LTS)
[09:03:13 ERROR]: #!#!   OS: Linux amd64 4.19.0-17-amd64
[09:03:13 ERROR]: #!#! 
[09:03:13 ERROR]: #!#! Server platform: Paper
[09:03:13 ERROR]: #!#! 
[09:03:13 ERROR]: #!#! Current node: null
[09:03:13 ERROR]: #!#! Current item: format slot
[09:03:13 ERROR]: #!#! Current trigger: command /flybuy (simple event) (Shops.sk, line 796)
[09:03:13 ERROR]: #!#! 
[09:03:13 ERROR]: #!#! Thread: Server thread
[09:03:13 ERROR]: #!#! 
[09:03:13 ERROR]: #!#! Language: english
[09:03:13 ERROR]: #!#! Link parse mode: STRICT
[09:03:13 ERROR]: #!#! 
[09:03:13 ERROR]: #!#! End of Error.
[09:03:13 ERROR]: #!#! 

Expected Behavior

Skript should be able to run the line with no problems and no exceptions.

Steps to Reproduce

Have a double variable and attempt to run this line:

if player's money is less than {fly.price}:
			format slot 23 of player with book and quill named "&a&lPURCHASE FLY TIME" with lore " ", "&fPurchase temporary fly time.", " ", "&c• &7&nPrice:&r &c%{fly.price}% coins/minute.", " ", "&c• &7Max you can", "&r  &7purchase: &c0 minutes.", " ", "&c• &7You need atleast", "&r  &7&a%{fly.price}-(money of player)% &7more coins to" and "&r  &7afford one minute." to close then run [make console execute "tm msg %player% {@ErrorTitle}"]->[send "{@ErrorMessage}"]

Errors or Screenshots

https://paste.gg/p/anonymous/4e791b9604fe475ea216cff4858bdd9c

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

Duplicate #6920