-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArea.java
More file actions
45 lines (34 loc) · 928 Bytes
/
Copy pathArea.java
File metadata and controls
45 lines (34 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.*;
public class Area {
private String name;
private List<NPC> npcs;
private List<Monster> monsters;
private static Map<String, Area> areaMap = new TreeMap<>();
public Area(String name) {
this.name = name;
this.npcs = new ArrayList<>();
this.monsters = new ArrayList<>();
areaMap.put(name, this);
}
public static Area getAreaByName(String name) {
return areaMap.get(name);
}
public void addNPC(NPC name) {
npcs.add(name);
}
public void addMonster(Monster name) {
monsters.add(name);
}
public List<NPC> getNpcs() {
return this.npcs;
}
public List<Monster> getMonsters() {
return this.monsters;
}
public String getName() {
return this.name;
}
public String toString() {
return this.name;
}
}