mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 20:07:32 +00:00
Added getPartyMembers() method to Iplayer
This commit is contained in:
1 parent
111f16647d
commit
6e43c34e91
1 file changed
+18
@@ -39,6 +39,7 @@ import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
import noppes.npcs.api.handler.data.IMagicData;
|
||||
import noppes.npcs.api.handler.data.IParty;
|
||||
import noppes.npcs.api.handler.data.IPlayerAttributes;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
@@ -61,6 +62,7 @@ import noppes.npcs.controllers.data.PlayerQuestData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestData;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
|
||||
import noppes.npcs.scripted.ScriptSound;
|
||||
@@ -877,4 +879,20 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
|
||||
return data.actionManager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IPlayer[] getPartyMembers(){
|
||||
Party party = this.getData().getPlayerParty();
|
||||
if (party == null) {
|
||||
throw new CustomNPCsException("Player is not in party");
|
||||
}
|
||||
List<IPlayer> list = new ArrayList<>();
|
||||
for(int i = 0; i < party.getPlayerNamesList().size();i++){
|
||||
IPlayer player = NpcAPI.Instance().getPlayer(party.getPlayerNamesList().get(i));
|
||||
if (player == null) continue;
|
||||
list.add(player);
|
||||
}
|
||||
return (IPlayer[]) list.toArray(new IPlayer[list.size()]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user