From 78cc54bdc48e3a93d1ab020621205f759f9b5c33 Mon Sep 17 00:00:00 2001 From: Arazadaz Date: Mon, 5 Feb 2024 19:35:38 -0600 Subject: [PATCH] Conversion of DDVault into a Singleton class --- .../java/com/arazadaz/dd/core/DDVault.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/arazadaz/dd/core/DDVault.java b/src/main/java/com/arazadaz/dd/core/DDVault.java index caeddd4..7f4de2f 100644 --- a/src/main/java/com/arazadaz/dd/core/DDVault.java +++ b/src/main/java/com/arazadaz/dd/core/DDVault.java @@ -14,10 +14,25 @@ //Dynamic Difficulty Vault public class DDVault { - public static ArrayList userOrigins = new ArrayList<>(); - public static OriginID spawnOrigin; + private DDVault singletonInstance; - public static HashMap> > difficultyModifiers; + public ArrayList userOrigins = new ArrayList<>(); + public OriginID spawnOrigin; + + public HashMap> > difficultyModifiers; + + + private DDVault(){ + + } + + public DDVault createDDVault(){ + if(singletonInstance!=null){ + singletonInstance = new DDVault(); + return singletonInstance; + } + else return null; + } }