diff --git a/src/main/java/com/syncleus/aethermud/npc/Npc.java b/src/main/java/com/syncleus/aethermud/npc/Npc.java index e06adb451b55a986482cb73da96515626450b6ce..c467bdc2bc27b768852f29ef5a8bf072f0f266d4 100644 --- a/src/main/java/com/syncleus/aethermud/npc/Npc.java +++ b/src/main/java/com/syncleus/aethermud/npc/Npc.java @@ -22,24 +22,25 @@ import com.syncleus.aethermud.stats.Stats; import com.syncleus.aethermud.storage.graphdb.StatsData; import com.syncleus.aethermud.world.model.Area; +import java.util.List; import java.util.Set; public interface Npc { - Set<AetherMudMessage> getCriticalAttackMessages(); + List<AetherMudMessage> getCriticalAttackMessages(); - void setCriticalAttackMessages(Set<AetherMudMessage> criticalAttackMessages); + void setCriticalAttackMessages(List<AetherMudMessage> criticalAttackMessages); - Set<AetherMudMessage> getBattleMessages(); + List<AetherMudMessage> getBattleMessages(); - void setBattleMessages(Set<AetherMudMessage> battleMessages); + void setBattleMessages(List<AetherMudMessage> battleMessages); - Set<AetherMudMessage> getIdleMessages(); + List<AetherMudMessage> getIdleMessages(); - void setIdleMessages(Set<AetherMudMessage> idleMessages); + void setIdleMessages(List<AetherMudMessage> idleMessages); - Set<AetherMudMessage> getAttackMessages(); + List<AetherMudMessage> getAttackMessages(); - void setAttackMessages(Set<AetherMudMessage> attackMessages); + void setAttackMessages(List<AetherMudMessage> attackMessages); String getName(); @@ -49,17 +50,17 @@ public interface Npc { void setTemperament(Temperament temperament); - Set<Area> getRoamAreas(); + List<Area> getRoamAreas(); - void setRoamAreas(Set<Area> roamAreas); + void setRoamAreas(List<Area> roamAreas); - Set<String> getValidTriggers(); + List<String> getValidTriggers(); - void setValidTriggers(Set<String> validTriggers); + void setValidTriggers(List<String> validTriggers); - Set<SpawnRule> getSpawnRules(); + List<SpawnRule> getSpawnRules(); - void setSpawnRules(Set<SpawnRule> spawnRules); + void setSpawnRules(List<SpawnRule> spawnRules); Loot getLoot(); diff --git a/src/main/java/com/syncleus/aethermud/npc/NpcBuilder.java b/src/main/java/com/syncleus/aethermud/npc/NpcBuilder.java index 3226c68626f64dedb3097a33914c110b2d0c311b..09679468b08234a173ddf88b5ba5115f4b8e2305 100644 --- a/src/main/java/com/syncleus/aethermud/npc/NpcBuilder.java +++ b/src/main/java/com/syncleus/aethermud/npc/NpcBuilder.java @@ -15,6 +15,7 @@ */ package com.syncleus.aethermud.npc; +import com.google.common.collect.Sets; import com.syncleus.aethermud.common.AetherMudMessage; import com.syncleus.aethermud.core.GameManager; import com.syncleus.aethermud.items.Loot; @@ -25,6 +26,7 @@ import com.syncleus.aethermud.storage.graphdb.StatsData; import com.syncleus.aethermud.storage.graphdb.NpcData; import com.syncleus.aethermud.world.model.Area; +import java.util.HashSet; import java.util.Set; import static com.google.common.base.Preconditions.checkNotNull; @@ -76,15 +78,15 @@ public class NpcBuilder { this.colorName = npcData.getColorName(); this.stats = new StatsPojo(npcData.getStats()); this.dieMessage = npcData.getDieMessage(); - this.roamAreas = npcData.getRoamAreas(); - this.validTriggers = npcData.getValidTriggers(); + this.roamAreas = new HashSet<>(npcData.getRoamAreas()); + this.validTriggers = Sets.newHashSet(npcData.getValidTriggers()); this.loot = npcData.getLoot(); - this.spawnRules = npcData.getSpawnRules(); + this.spawnRules = Sets.newHashSet(npcData.getSpawnRules()); this.temperament = npcData.getTemperament(); - this.attackMessages = npcData.getAttackMessages(); - this.criticalAttackMessages = npcData.getCriticalAttackMessages(); - this.battleMessages = npcData.getBattleMessages(); - this.idleMessages = npcData.getIdleMessages(); + this.attackMessages = Sets.newHashSet(npcData.getAttackMessages()); + this.criticalAttackMessages = Sets.newHashSet(npcData.getCriticalAttackMessages()); + this.battleMessages = Sets.newHashSet(npcData.getBattleMessages()); + this.idleMessages = Sets.newHashSet(npcData.getIdleMessages()); } public NpcBuilder setGameManager(GameManager gameManager) { diff --git a/src/main/java/com/syncleus/aethermud/npc/NpcPojo.java b/src/main/java/com/syncleus/aethermud/npc/NpcPojo.java index 1c3613208a0d16f52cd2ca9ffca3f214110d6b34..703d4160257bfafdb0773adf7e6cc5969d4b357c 100644 --- a/src/main/java/com/syncleus/aethermud/npc/NpcPojo.java +++ b/src/main/java/com/syncleus/aethermud/npc/NpcPojo.java @@ -23,6 +23,9 @@ import com.syncleus.aethermud.stats.StatsPojo; import com.syncleus.aethermud.storage.graphdb.StatsData; import com.syncleus.aethermud.world.model.Area; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import java.util.Set; public class NpcPojo implements Npc { @@ -32,51 +35,51 @@ public class NpcPojo implements Npc { private StatsPojo stats; private String dieMessage; private Temperament temperament; - private Set<Area> roamAreas; - private Set<String> validTriggers; - private Set<SpawnRule> spawnRules; + private List<Area> roamAreas; + private List<String> validTriggers; + private List<SpawnRule> spawnRules; private Loot loot; // The messages used when dealing damage - private Set<AetherMudMessage> attackMessages; + private List<AetherMudMessage> attackMessages; // The messages used when landing critical attacks - private Set<AetherMudMessage> criticalAttackMessages; + private List<AetherMudMessage> criticalAttackMessages; // Things the NPC randomly says during battle - private Set<AetherMudMessage> battleMessages; + private List<AetherMudMessage> battleMessages; // Things that npcs say randomly when idle - private Set<AetherMudMessage> idleMessages; + private List<AetherMudMessage> idleMessages; public NpcPojo() { } - public Set<AetherMudMessage> getCriticalAttackMessages() { + public List<AetherMudMessage> getCriticalAttackMessages() { return criticalAttackMessages; } - public void setCriticalAttackMessages(Set<AetherMudMessage> criticalAttackMessages) { + public void setCriticalAttackMessages(List<AetherMudMessage> criticalAttackMessages) { this.criticalAttackMessages = criticalAttackMessages; } - public Set<AetherMudMessage> getBattleMessages() { + public List<AetherMudMessage> getBattleMessages() { return battleMessages; } - public void setBattleMessages(Set<AetherMudMessage> battleMessages) { + public void setBattleMessages(List<AetherMudMessage> battleMessages) { this.battleMessages = battleMessages; } - public Set<AetherMudMessage> getIdleMessages() { + public List<AetherMudMessage> getIdleMessages() { return idleMessages; } - public void setIdleMessages(Set<AetherMudMessage> idleMessages) { + public void setIdleMessages(List<AetherMudMessage> idleMessages) { this.idleMessages = idleMessages; } - public Set<AetherMudMessage> getAttackMessages() { + public List<AetherMudMessage> getAttackMessages() { return attackMessages; } - public void setAttackMessages(Set<AetherMudMessage> attackMessages) { + public void setAttackMessages(List<AetherMudMessage> attackMessages) { this.attackMessages = attackMessages; } @@ -122,27 +125,19 @@ public class NpcPojo implements Npc { this.temperament = temperament; } - public Set<Area> getRoamAreas() { - return roamAreas; - } - - public void setRoamAreas(Set<Area> roamAreas) { - this.roamAreas = roamAreas; - } - - public Set<String> getValidTriggers() { + public List<String> getValidTriggers() { return validTriggers; } - public void setValidTriggers(Set<String> validTriggers) { + public void setValidTriggers(List<String> validTriggers) { this.validTriggers = validTriggers; } - public Set<SpawnRule> getSpawnRules() { + public List<SpawnRule> getSpawnRules() { return spawnRules; } - public void setSpawnRules(Set<SpawnRule> spawnRules) { + public void setSpawnRules(List<SpawnRule> spawnRules) { this.spawnRules = spawnRules; } @@ -153,5 +148,15 @@ public class NpcPojo implements Npc { public void setLoot(Loot loot) { this.loot = loot; } + + @Override + public List<Area> getRoamAreas() { + return roamAreas; + } + + @Override + public void setRoamAreas(List<Area> roamAreas) { + this.roamAreas = roamAreas; + } } diff --git a/src/main/java/com/syncleus/aethermud/storage/graphdb/NpcData.java b/src/main/java/com/syncleus/aethermud/storage/graphdb/NpcData.java index ce6ba2c8a41a24412c27b54b5ec9316a76f21ae2..70b8b91a87680cb894b710366b9a0a9f31de11f9 100644 --- a/src/main/java/com/syncleus/aethermud/storage/graphdb/NpcData.java +++ b/src/main/java/com/syncleus/aethermud/storage/graphdb/NpcData.java @@ -15,6 +15,7 @@ */ package com.syncleus.aethermud.storage.graphdb; +import com.google.api.client.util.Sets; import com.syncleus.aethermud.common.AetherMudMessage; import com.syncleus.aethermud.common.ColorizedTextTemplate; import com.syncleus.aethermud.items.Loot; @@ -30,33 +31,35 @@ import org.apache.commons.beanutils.PropertyUtils; import org.apache.tinkerpop.gremlin.structure.Direction; import java.lang.reflect.InvocationTargetException; +import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; public abstract class NpcData extends AbstractVertexFrame implements Npc { @Property("criticalAttackMessages") - public abstract Set<AetherMudMessage> getCriticalAttackMessages(); + public abstract List<AetherMudMessage> getCriticalAttackMessages(); @Property("criticalAttackMessages") - public abstract void setCriticalAttackMessages(Set<AetherMudMessage> criticalAttackMessages); + public abstract void setCriticalAttackMessages(List<AetherMudMessage> criticalAttackMessages); @Property("battleMessages") - public abstract Set<AetherMudMessage> getBattleMessages(); + public abstract List<AetherMudMessage> getBattleMessages(); @Property("battleMessages") - public abstract void setBattleMessages(Set<AetherMudMessage> battleMessages); + public abstract void setBattleMessages(List<AetherMudMessage> battleMessages); @Property("idleMessages") - public abstract Set<AetherMudMessage> getIdleMessages(); + public abstract List<AetherMudMessage> getIdleMessages(); @Property("idleMessages") - public abstract void setIdleMessages(Set<AetherMudMessage> idleMessages); + public abstract void setIdleMessages(List<AetherMudMessage> idleMessages); @Property("attackMessages") - public abstract Set<AetherMudMessage> getAttackMessages(); + public abstract List<AetherMudMessage> getAttackMessages(); @Property("attackMessages") - public abstract void setAttackMessages(Set<AetherMudMessage> attackMessages); + public abstract void setAttackMessages(List<AetherMudMessage> attackMessages); @Property("name") public abstract String getName(); @@ -71,22 +74,22 @@ public abstract class NpcData extends AbstractVertexFrame implements Npc { public abstract void setTemperament(Temperament temperament); @Property("roamAreas") - public abstract Set<Area> getRoamAreas(); + public abstract List<Area> getRoamAreas(); @Property("roamAreas") - public abstract void setRoamAreas(Set<Area> roamAreas); + public abstract void setRoamAreas(List<Area> roamAreas); @Property("validTriggers") - public abstract Set<String> getValidTriggers(); + public abstract List<String> getValidTriggers(); @Property("validTriggers") - public abstract void setValidTriggers(Set<String> validTriggers); + public abstract void setValidTriggers(List<String> validTriggers); @Property("spawnRules") - public abstract Set<SpawnRule> getSpawnRules(); + public abstract List<SpawnRule> getSpawnRules(); @Property("spawnRules") - public abstract void setSpawnRules(Set<SpawnRule> spawnRules); + public abstract void setSpawnRules(List<SpawnRule> spawnRules); @Property("loot") public abstract Loot getLoot();