Solved Kotlin and TextComponent.fromLegacyText(...)

Discussion in 'Spigot Plugin Development' started by MrPowerGamerBR, Jun 9, 2017.

  1. Java:
    new TextComponent(TextComponent.fromLegacyText("wow"));

    Kotlin:
    TextComponent(TextComponent.fromLegacyText("wow"))

    The Java version works fine, but the Kotlin version is showing an error

    [​IMG]

    So... what should I do to fix this?
     
  2. Okay, for some REASON, 1 minute after I posted this thread, IntelliJ decided to convert the code correctly to Kotlin...

    The "fixed" code is
    Code (Text):
    TextComponent(*TextComponent.fromLegacyText("wow"))
    Yeah, it was that asterisk... https://stackoverflow.com/questions...re-variable-name-or-spread-operator-in-kotlin

    So... solved. (I hate when I post something and I figure out the solution a few minutes later after I ask for help :( )