Passage Jobs.name en privé
Clement Colmerauer

Clement Colmerauer commited on 2024-12-13 10:01:41
Showing 12 changed files, with 13 additions and 6 deletions.

... ...
@@ -6,9 +6,8 @@ import java.util.HashMap;
6 6
 
7 7
 public enum Jobs   
8 8
 {
9
-    ADVENTURER
9
+    ADVENTURER("ADVENTURER")
10 10
     { 
11
-        public String name = "ADVENTURER";
12 11
         public HashMap<Ability, Integer[]> getAbilityPerLevel(){ 
13 12
             return new HashMap(Map.ofEntries(
14 13
             entry(Ability.ALC, new Integer[]{0,0,1,1,1}),
... ...
@@ -20,9 +19,8 @@ public enum Jobs
20 19
         ));
21 20
         } 
22 21
     },
23
-    ARCHER
22
+    ARCHER("ARCHER")
24 23
     {
25
-        public String name = "ARCHER";
26 24
         public HashMap<Ability, Integer[]> getAbilityPerLevel(){
27 25
             return new HashMap(Map.ofEntries(
28 26
             entry(Ability.ALC, new Integer[]{0,0,0,0,0}),
... ...
@@ -34,9 +32,8 @@ public enum Jobs
34 32
         ));
35 33
         } 
36 34
     },
37
-    DWARF
35
+    DWARF("DWARF")
38 36
     {
39
-        public String name = "DWARF";
40 37
         public HashMap<Ability, Integer[]> getAbilityPerLevel(){
41 38
             return new HashMap(Map.ofEntries(
42 39
             entry(Ability.ALC, new Integer[]{4,4,5,5,5}),
... ...
@@ -49,6 +46,16 @@ public enum Jobs
49 46
         }
50 47
     };
51 48
 
49
+    private final String name;
50
+
51
+    private Jobs(String name) {
52
+        this.name = name;
53
+    }
54
+
55
+    public String toString()
56
+    {
57
+        return this.name;
58
+    }
52 59
 
53 60
     public abstract HashMap<Ability, Integer[]> getAbilityPerLevel();
54 61
 }
55 62
\ No newline at end of file
56 63