Package com.aliucord

Class SettingsUtilsJSON

  • All Implemented Interfaces:

    
    public final class SettingsUtilsJSON
    
                        

    Utility class to store and retrieve preferences

    • Constructor Detail

      • SettingsUtilsJSON

        SettingsUtilsJSON(String plugin)
    • Method Detail

      • resetFile

         final Boolean resetFile()

        Resets All Settings

        Returns:

        true if successful, else false

      • toggleBool

         final Boolean toggleBool(String key, Boolean defVal)

        Toggles Boolean and returns it

        Parameters:
        key - Key of the value
        defVal - Default Value if setting doesn't exist
        Returns:

        Toggled boolean

      • remove

        @Synchronized() final Boolean remove(String key)

        Removes Item from settings

        Parameters:
        key - Key of the value
        Returns:

        True if removed, else false

      • exists

         final Boolean exists(String key)

        Check if Key exists in settings

        Parameters:
        key - Key of the value
        Returns:

        True if found, else false

      • getBool

         final Boolean getBool(String key, Boolean defValue)

        Get a boolean from the preferences

        Parameters:
        key - Key of the value
        defValue - Default value
        Returns:

        Value if found, else the defValue

      • setBool

         final Unit setBool(String key, Boolean value)

        Set a boolean item

        Parameters:
        key - Key of the item
        value - Value
      • getInt

         final Integer getInt(String key, Integer defValue)

        Get an int from the preferences

        Parameters:
        key - Key of the value
        defValue - Default value
        Returns:

        Value if found, else the defValue

      • setInt

         final Unit setInt(String key, Integer value)

        Set an int item

        Parameters:
        key - Key of the item
        value - Value
      • getFloat

         final Float getFloat(String key, Float defValue)

        Get a float from the preferences

        Parameters:
        key - Key of the value
        defValue - Default value
        Returns:

        Value if found, else the defValue

      • setFloat

         final Unit setFloat(String key, Float value)

        Set a float item

        Parameters:
        key - Key of the item
        value - Value
      • getLong

         final Long getLong(String key, Long defValue)

        Get a long from the preferences

        Parameters:
        key - Key of the value
        defValue - Default value
        Returns:

        Value if found, else the defValue

      • setLong

         final Unit setLong(String key, Long value)

        Set a long item

        Parameters:
        key - Key of the item
        value - Value
      • getString

         final String getString(String key, String defValue)

        Get a String from the preferences

        Parameters:
        key - Key of the value
        defValue - Default value
        Returns:

        Value if found, else the defValue

      • getObject

         final <T extends Any> T getObject(String key, T defValue)

        Get an Object from the preferences

        Parameters:
        key - Key of the value
        defValue - Default value
        Returns:

        Value if found, else the defValue

      • getObject

         final <T extends Any> T getObject(String key, T defValue, Type type)

        Get an Object from the preferences

        Parameters:
        key - Key of the value
        defValue - Default value
        type - Type of the object
        Returns:

        Value if found, else the defValue