Skip to content

Commit

Permalink
Conversion of DDVault into a Singleton class
Browse files Browse the repository at this point in the history
  • Loading branch information
arazadaz committed Feb 6, 2024
1 parent eb2b9b5 commit 78cc54b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/main/java/com/arazadaz/dd/core/DDVault.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,25 @@
//Dynamic Difficulty Vault
public class DDVault {

public static ArrayList<OriginID> userOrigins = new ArrayList<>();
public static OriginID spawnOrigin;
private DDVault singletonInstance;

public static HashMap<DifficultyType, ArrayList<Predicate<DDContext>> > difficultyModifiers;
public ArrayList<OriginID> userOrigins = new ArrayList<>();
public OriginID spawnOrigin;

public HashMap<DifficultyType, ArrayList<Predicate<DDContext>> > difficultyModifiers;


private DDVault(){

}

public DDVault createDDVault(){
if(singletonInstance!=null){
singletonInstance = new DDVault();
return singletonInstance;
}
else return null;
}


}

0 comments on commit 78cc54b

Please sign in to comment.