CommandHelper

CommandHelper

46.5k Downloads

Running a closure through eval() throws ClassCastException

LadyCailinBot opened this issue ยท 4 comments

commented

CMDHELPER-2901 - Reported by Octopod

The stacktrace: http://paste.thezomg.com/12956/64460139/
Relevant code: http://paste.thezomg.com/12958/39146467/

Running the code above throws java.lang.ClassCastException: com.laytonsmith.core.constructs.CString cannot be cast to com.laytonsmith.core.constructs.CLabel

commented

Comment by LadyCailin

Closures can't be eval'd, so this is a misuse of the function. Given that it's a stracktrace though, it's still a bug.

commented

Comment by EntityReborn

This seems to be working for me.
{{
[19:27:09 INFO]: CH: Running original command from a MCCommandSender ----> /eval eval(closure(msg('hi')))
[19:27:09 INFO]: hi}}

commented

Comment by LadyCailin

A simple enough of a closure will work. A more complex one probably will not. This bug is valid, because I really need to explicitly check for a string being passed to eval. Closures should provide a specific error stating that they aren't supported.

commented

Comment by LadyCailin

Fixed in latest build.