mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 07:35:11 +00:00
API Changes:
-Implemented interfaces for all jobs & roles. ScriptPlayer: -Added getData() function, which returns player data objects. IPlayerData: New class that holds all player data for modification. -Holds dialog, bank, quest, transport, faction, item giver, and mail data. -Also holds companion data, with functions has/set/getCompanion, and a getCompanionID function to differentiate companions.
This commit is contained in:
1 parent
587f63396f
commit
63a1525ee2
66 files changed
+1418
-207
No files matched your search
@@ -1,13 +1,22 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.controllers.TransportController;
|
||||
import noppes.npcs.scripted.interfaces.handler.IPlayerTransportData;
|
||||
import noppes.npcs.scripted.interfaces.handler.data.ITransportLocation;
|
||||
|
||||
public class PlayerTransportData{
|
||||
public class PlayerTransportData implements IPlayerTransportData {
|
||||
private final PlayerData parent;
|
||||
public HashSet<Integer> transports = new HashSet<Integer>();
|
||||
|
||||
public PlayerTransportData(PlayerData parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void loadNBTData(NBTTagCompound compound) {
|
||||
HashSet<Integer> dialogsRead = new HashSet<Integer>();
|
||||
if(compound == null)
|
||||
@@ -35,5 +44,34 @@ public class PlayerTransportData{
|
||||
|
||||
compound.setTag("TransportData", list);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasTransport(int id) {
|
||||
return transports.contains(id);
|
||||
}
|
||||
|
||||
public void addTransport(int id) {
|
||||
transports.add(id);
|
||||
}
|
||||
|
||||
public void addTransport(ITransportLocation location) {
|
||||
transports.add(location.getId());
|
||||
}
|
||||
|
||||
public ITransportLocation getTransport(int id) {
|
||||
return TransportController.getInstance().getTransport(id);
|
||||
}
|
||||
|
||||
public ITransportLocation[] getTransports() {
|
||||
ArrayList<ITransportLocation> list = new ArrayList<>();
|
||||
for (int id : transports) {
|
||||
ITransportLocation location = TransportController.getInstance().getTransport(id);
|
||||
list.add(location);
|
||||
}
|
||||
|
||||
return list.toArray(new ITransportLocation[0]);
|
||||
}
|
||||
|
||||
public void removeTransport(int id) {
|
||||
transports.remove(id);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user