mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-02 17:12:58 -04:00
Lootpool scripts added
Data transfer from py script to java
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
******************************************************************************/
|
||||
package services;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.python.core.Py;
|
||||
import org.python.core.PyObject;
|
||||
import org.python.util.PythonInterpreter;
|
||||
@@ -107,4 +110,24 @@ public class ScriptService {
|
||||
return func;
|
||||
}
|
||||
|
||||
public Vector<String> fetchStringVector(String path, String method) {
|
||||
Vector<String> vector = new Vector<String>();
|
||||
PyObject result = core.scriptService.callScript(path, "", method);
|
||||
Iterable<PyObject> comp = (Iterable<PyObject>)result.asIterable();
|
||||
for (Iterator<PyObject> temp = comp.iterator(); temp.hasNext();){
|
||||
vector.add(temp.next().asString());
|
||||
}
|
||||
return vector;
|
||||
}
|
||||
|
||||
public Vector<Integer> fetchIntegerVector(String path, String method) {
|
||||
Vector<Integer> vector = new Vector<Integer>();
|
||||
PyObject result = core.scriptService.callScript(path, "", method);
|
||||
Iterable<PyObject> comp = (Iterable<PyObject>)result.asIterable();
|
||||
for (Iterator<PyObject> temp = comp.iterator(); temp.hasNext();){
|
||||
vector.add(temp.next().asInt());
|
||||
}
|
||||
return vector;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user