Fix event scripts' getEligibleParty

Cannot return a JavaScript array straight up
(otherwise you'll get a PolyglotMap):
it has to be converted first from inside the script.
This commit is contained in:
P0nk
2021-05-21 19:09:40 +02:00
parent bcefd42093
commit 095008a20f
41 changed files with 47 additions and 47 deletions

View File

@@ -713,21 +713,21 @@ public class EventManager {
public List<MaplePartyCharacter> getEligibleParty(MapleParty party) {
if (party == null) {
return(new ArrayList<>());
return new ArrayList<>();
}
try {
Object p = iv.invokeFunction("getEligibleParty", party.getPartyMembersOnline());
Object o = iv.invokeFunction("getEligibleParty", party.getPartyMembersOnline());
if(p != null) {
final List<MaplePartyCharacter> lmpc = new ArrayList<>((List<MaplePartyCharacter>) p);
party.setEligibleMembers(lmpc);
return lmpc;
if (o instanceof MaplePartyCharacter[] partyChrs) {
final List<MaplePartyCharacter> eligibleParty = new ArrayList<>(Arrays.asList(partyChrs));
party.setEligibleMembers(eligibleParty);
return eligibleParty;
}
} catch (ScriptException | NoSuchMethodException ex) {
ex.printStackTrace();
}
return(new ArrayList<>());
return new ArrayList<>();
}
public void clearPQ(EventInstanceManager eim) {