Dysfold / craftjs

MIT License
10 stars 2 forks source link

QUESTION: JavaScript Array -> List #27

Closed vladimir-gal closed 3 years ago

vladimir-gal commented 3 years ago

Hello, I am hoping someone will try to help me with this one. I am currently trying to create new ItemStack with Lore which accepts Java List to fill the lines. I tried importing the List from java.utils and creating a new List() but that leaves me with exception that it cannot create new List because of Message unsupported. So I tried passing string to new List(String) but it wont accept any arguments. Code snippet:

import { List } from 'java.utils';

const list = new List();
vladimir-gal commented 3 years ago

Managed to get things working with this dirty trick. Using ArrayList and converting it to List

    const List = Java.type('java.util.ArrayList');
    const list: List<string> = new List();