Package org.dreambot.api.settings
Class ScriptSettings
- java.lang.Object
-
- org.dreambot.api.settings.ScriptSettings
-
public class ScriptSettings extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ScriptSettings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
load(java.lang.Class<T> clazz, java.lang.String... fileLocationSteps)
Loads a given class from a settings object, location base is scripts.pathstatic boolean
save(java.lang.Object obj, java.lang.String... fileLocationSteps)
Saves a given object using GSON pretty print to the given file.
-
-
-
Method Detail
-
load
public static <T> T load(java.lang.Class<T> clazz, java.lang.String... fileLocationSteps)
Loads a given class from a settings object, location base is scripts.path- Parameters:
clazz
- Class of the object you're loading, must have empty constructorfileLocationSteps
- Steps in the file location, eg: "MyScript","SubFolder","MySettings.json- Returns:
- A new instance of your object created from the file settings.
-
save
public static boolean save(java.lang.Object obj, java.lang.String... fileLocationSteps)
Saves a given object using GSON pretty print to the given file.- Parameters:
obj
- Object instance to save.fileLocationSteps
- Steps in the file location, eg: "MyScript","SubFolder","MySettings.json- Returns:
- true if it saves with no exceptions, false if it fails to create folders or throws exceptions
-
-