Class MemorySection

    • Method Detail

      • getKeys

        @NotNull
        public @NotNull Set<String> getKeys​(boolean deep)
        Description copied from interface: ConfigurationSection
        Gets a set containing all keys in this section.

        If deep is set to true, then this will contain all the keys within any child ConfigurationSections (and their children, etc). These will be in a valid path notation for you to use.

        If deep is set to false, then this will contain only the keys of any direct children, and not their own children.

        Specified by:
        getKeys in interface ConfigurationSection
        Parameters:
        deep - Whether or not to get a deep list, as opposed to a shallow list.
        Returns:
        Set of keys contained within this ConfigurationSection.
      • getValues

        @NotNull
        public @NotNull Map<String,​Object> getValues​(boolean deep)
        Description copied from interface: ConfigurationSection
        Gets a Map containing all keys and their values for this section.

        If deep is set to true, then this will contain all the keys and values within any child ConfigurationSections (and their children, etc). These keys will be in a valid path notation for you to use.

        If deep is set to false, then this will contain only the keys and values of any direct children, and not their own children.

        Specified by:
        getValues in interface ConfigurationSection
        Parameters:
        deep - Whether or not to get a deep list, as opposed to a shallow list.
        Returns:
        Map of keys and values of this section.
      • contains

        public boolean contains​(@NotNull
                                @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if this ConfigurationSection contains the given path.

        If the value for the requested path does not exist but a default value has been specified, this will return true.

        Specified by:
        contains in interface ConfigurationSection
        Parameters:
        path - Path to check for existence.
        Returns:
        True if this section contains the requested path, either via default or being set.
      • contains

        public boolean contains​(@NotNull
                                @NotNull String path,
                                boolean ignoreDefault)
        Description copied from interface: ConfigurationSection
        Checks if this ConfigurationSection contains the given path.

        If the value for the requested path does not exist, the boolean parameter of true has been specified, a default value for the path exists, this will return true.

        If a boolean parameter of false has been specified, true will only be returned if there is a set value for the specified path.

        Specified by:
        contains in interface ConfigurationSection
        Parameters:
        path - Path to check for existence.
        ignoreDefault - Whether or not to ignore if a default value for the specified path exists.
        Returns:
        True if this section contains the requested path, or if a default value exist and the boolean parameter for this method is true.
      • isSet

        public boolean isSet​(@NotNull
                             @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if this ConfigurationSection has a value set for the given path.

        If the value for the requested path does not exist but a default value has been specified, this will still return false.

        Specified by:
        isSet in interface ConfigurationSection
        Parameters:
        path - Path to check for existence.
        Returns:
        True if this section contains the requested path, regardless of having a default.
      • get

        @Nullable
        public @Nullable Object get​(@NotNull
                                    @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested Object by path.

        If the Object does not exist but a default value has been specified, this will return the default value. If the Object does not exist and no default value was specified, this will return null.

        Specified by:
        get in interface ConfigurationSection
        Parameters:
        path - Path of the Object to get.
        Returns:
        Requested Object.
      • getString

        @Nullable
        public @Nullable String getString​(@NotNull
                                          @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested String by path.

        If the String does not exist but a default value has been specified, this will return the default value. If the String does not exist and no default value was specified, this will return null.

        Specified by:
        getString in interface ConfigurationSection
        Parameters:
        path - Path of the String to get.
        Returns:
        Requested String.
      • isString

        public boolean isString​(@NotNull
                                @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a String.

        If the path exists but is not a String, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a String and return appropriately.

        Specified by:
        isString in interface ConfigurationSection
        Parameters:
        path - Path of the String to check.
        Returns:
        Whether or not the specified path is a String.
      • getInt

        public int getInt​(@NotNull
                          @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested int by path.

        If the int does not exist but a default value has been specified, this will return the default value. If the int does not exist and no default value was specified, this will return 0.

        Specified by:
        getInt in interface ConfigurationSection
        Parameters:
        path - Path of the int to get.
        Returns:
        Requested int.
      • getInt

        public int getInt​(@NotNull
                          @NotNull String path,
                          int def)
        Description copied from interface: ConfigurationSection
        Gets the requested int by path, returning a default value if not found.

        If the int does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

        Specified by:
        getInt in interface ConfigurationSection
        Parameters:
        path - Path of the int to get.
        def - The default value to return if the path is not found or is not an int.
        Returns:
        Requested int.
      • isInt

        public boolean isInt​(@NotNull
                             @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is an int.

        If the path exists but is not a int, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a int and return appropriately.

        Specified by:
        isInt in interface ConfigurationSection
        Parameters:
        path - Path of the int to check.
        Returns:
        Whether or not the specified path is an int.
      • getBoolean

        public boolean getBoolean​(@NotNull
                                  @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested boolean by path.

        If the boolean does not exist but a default value has been specified, this will return the default value. If the boolean does not exist and no default value was specified, this will return false.

        Specified by:
        getBoolean in interface ConfigurationSection
        Parameters:
        path - Path of the boolean to get.
        Returns:
        Requested boolean.
      • getBoolean

        public boolean getBoolean​(@NotNull
                                  @NotNull String path,
                                  boolean def)
        Description copied from interface: ConfigurationSection
        Gets the requested boolean by path, returning a default value if not found.

        If the boolean does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

        Specified by:
        getBoolean in interface ConfigurationSection
        Parameters:
        path - Path of the boolean to get.
        def - The default value to return if the path is not found or is not a boolean.
        Returns:
        Requested boolean.
      • isBoolean

        public boolean isBoolean​(@NotNull
                                 @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a boolean.

        If the path exists but is not a boolean, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a boolean and return appropriately.

        Specified by:
        isBoolean in interface ConfigurationSection
        Parameters:
        path - Path of the boolean to check.
        Returns:
        Whether or not the specified path is a boolean.
      • getDouble

        public double getDouble​(@NotNull
                                @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested double by path.

        If the double does not exist but a default value has been specified, this will return the default value. If the double does not exist and no default value was specified, this will return 0.

        Specified by:
        getDouble in interface ConfigurationSection
        Parameters:
        path - Path of the double to get.
        Returns:
        Requested double.
      • getDouble

        public double getDouble​(@NotNull
                                @NotNull String path,
                                double def)
        Description copied from interface: ConfigurationSection
        Gets the requested double by path, returning a default value if not found.

        If the double does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

        Specified by:
        getDouble in interface ConfigurationSection
        Parameters:
        path - Path of the double to get.
        def - The default value to return if the path is not found or is not a double.
        Returns:
        Requested double.
      • isDouble

        public boolean isDouble​(@NotNull
                                @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a double.

        If the path exists but is not a double, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a double and return appropriately.

        Specified by:
        isDouble in interface ConfigurationSection
        Parameters:
        path - Path of the double to check.
        Returns:
        Whether or not the specified path is a double.
      • getLong

        public long getLong​(@NotNull
                            @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested long by path.

        If the long does not exist but a default value has been specified, this will return the default value. If the long does not exist and no default value was specified, this will return 0.

        Specified by:
        getLong in interface ConfigurationSection
        Parameters:
        path - Path of the long to get.
        Returns:
        Requested long.
      • getLong

        public long getLong​(@NotNull
                            @NotNull String path,
                            long def)
        Description copied from interface: ConfigurationSection
        Gets the requested long by path, returning a default value if not found.

        If the long does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

        Specified by:
        getLong in interface ConfigurationSection
        Parameters:
        path - Path of the long to get.
        def - The default value to return if the path is not found or is not a long.
        Returns:
        Requested long.
      • isLong

        public boolean isLong​(@NotNull
                              @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a long.

        If the path exists but is not a long, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a long and return appropriately.

        Specified by:
        isLong in interface ConfigurationSection
        Parameters:
        path - Path of the long to check.
        Returns:
        Whether or not the specified path is a long.
      • getList

        @Nullable
        public @Nullable List<?> getList​(@NotNull
                                         @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return null.

        Specified by:
        getList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List.
      • isList

        public boolean isList​(@NotNull
                              @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a List.

        If the path exists but is not a List, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a List and return appropriately.

        Specified by:
        isList in interface ConfigurationSection
        Parameters:
        path - Path of the List to check.
        Returns:
        Whether or not the specified path is a List.
      • getStringList

        @NotNull
        public @NotNull List<String> getStringList​(@NotNull
                                                   @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of String by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a String if possible, but may miss any values out if they are not compatible.

        Specified by:
        getStringList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of String.
      • getIntegerList

        @NotNull
        public @NotNull List<Integer> getIntegerList​(@NotNull
                                                     @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Integer by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Integer if possible, but may miss any values out if they are not compatible.

        Specified by:
        getIntegerList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Integer.
      • getBooleanList

        @NotNull
        public @NotNull List<Boolean> getBooleanList​(@NotNull
                                                     @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Boolean by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Boolean if possible, but may miss any values out if they are not compatible.

        Specified by:
        getBooleanList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Boolean.
      • getDoubleList

        @NotNull
        public @NotNull List<Double> getDoubleList​(@NotNull
                                                   @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Double by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Double if possible, but may miss any values out if they are not compatible.

        Specified by:
        getDoubleList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Double.
      • getFloatList

        @NotNull
        public @NotNull List<Float> getFloatList​(@NotNull
                                                 @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Float by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Float if possible, but may miss any values out if they are not compatible.

        Specified by:
        getFloatList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Float.
      • getLongList

        @NotNull
        public @NotNull List<Long> getLongList​(@NotNull
                                               @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Long by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Long if possible, but may miss any values out if they are not compatible.

        Specified by:
        getLongList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Long.
      • getByteList

        @NotNull
        public @NotNull List<Byte> getByteList​(@NotNull
                                               @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Byte by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Byte if possible, but may miss any values out if they are not compatible.

        Specified by:
        getByteList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Byte.
      • getCharacterList

        @NotNull
        public @NotNull List<Character> getCharacterList​(@NotNull
                                                         @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Character by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Character if possible, but may miss any values out if they are not compatible.

        Specified by:
        getCharacterList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Character.
      • getShortList

        @NotNull
        public @NotNull List<Short> getShortList​(@NotNull
                                                 @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Short by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Short if possible, but may miss any values out if they are not compatible.

        Specified by:
        getShortList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Short.
      • getMapList

        @NotNull
        public @NotNull List<Map<?,​?>> getMapList​(@NotNull
                                                        @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested List of Maps by path.

        If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

        This method will attempt to cast any values into a Map if possible, but may miss any values out if they are not compatible.

        Specified by:
        getMapList in interface ConfigurationSection
        Parameters:
        path - Path of the List to get.
        Returns:
        Requested List of Maps.
      • getObject

        @Nullable
        public <T> T getObject​(@NotNull
                               @NotNull String path,
                               @NotNull
                               @NotNull Class<T> clazz)
        Description copied from interface: ConfigurationSection
        Gets the requested object at the given path. If the Object does not exist but a default value has been specified, this will return the default value. If the Object does not exist and no default value was specified, this will return null. Note: For example #getObject(path, String.class) is not equivalent to #getString(path) because #getString(path) converts internally all Objects to Strings. However, #getObject(path, Boolean.class) is equivalent to #getBoolean(path) for example.
        Specified by:
        getObject in interface ConfigurationSection
        Type Parameters:
        T - the type of the requested object
        Parameters:
        path - the path to the object.
        clazz - the type of the requested object
        Returns:
        Requested object
      • getObject

        @Nullable
        public <T> T getObject​(@NotNull
                               @NotNull String path,
                               @NotNull
                               @NotNull Class<T> clazz,
                               @Nullable
                               T def)
        Description copied from interface: ConfigurationSection
        Gets the requested object at the given path, returning a default value if not found If the Object does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration. Note: For example #getObject(path, String.class, def) is not equivalent to #getString(path, def) because #getString(path, def) converts internally all Objects to Strings. However, #getObject(path, Boolean.class, def) is equivalent to #getBoolean(path, def) for example.
        Specified by:
        getObject in interface ConfigurationSection
        Type Parameters:
        T - the type of the requested object
        Parameters:
        path - the path to the object.
        clazz - the type of the requested object
        def - the default object to return if the object is not present at the path
        Returns:
        Requested object
      • getVector

        @Nullable
        public @Nullable Vector getVector​(@NotNull
                                          @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested Vector by path.

        If the Vector does not exist but a default value has been specified, this will return the default value. If the Vector does not exist and no default value was specified, this will return null.

        Specified by:
        getVector in interface ConfigurationSection
        Parameters:
        path - Path of the Vector to get.
        Returns:
        Requested Vector.
      • isVector

        public boolean isVector​(@NotNull
                                @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a Vector.

        If the path exists but is not a Vector, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a Vector and return appropriately.

        Specified by:
        isVector in interface ConfigurationSection
        Parameters:
        path - Path of the Vector to check.
        Returns:
        Whether or not the specified path is a Vector.
      • getOfflinePlayer

        @Nullable
        public @Nullable OfflinePlayer getOfflinePlayer​(@NotNull
                                                        @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested OfflinePlayer by path.

        If the OfflinePlayer does not exist but a default value has been specified, this will return the default value. If the OfflinePlayer does not exist and no default value was specified, this will return null.

        Specified by:
        getOfflinePlayer in interface ConfigurationSection
        Parameters:
        path - Path of the OfflinePlayer to get.
        Returns:
        Requested OfflinePlayer.
      • isOfflinePlayer

        public boolean isOfflinePlayer​(@NotNull
                                       @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is an OfflinePlayer.

        If the path exists but is not a OfflinePlayer, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a OfflinePlayer and return appropriately.

        Specified by:
        isOfflinePlayer in interface ConfigurationSection
        Parameters:
        path - Path of the OfflinePlayer to check.
        Returns:
        Whether or not the specified path is an OfflinePlayer.
      • getItemStack

        @Nullable
        public @Nullable ItemStack getItemStack​(@NotNull
                                                @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested ItemStack by path.

        If the ItemStack does not exist but a default value has been specified, this will return the default value. If the ItemStack does not exist and no default value was specified, this will return null.

        Specified by:
        getItemStack in interface ConfigurationSection
        Parameters:
        path - Path of the ItemStack to get.
        Returns:
        Requested ItemStack.
      • isItemStack

        public boolean isItemStack​(@NotNull
                                   @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is an ItemStack.

        If the path exists but is not a ItemStack, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a ItemStack and return appropriately.

        Specified by:
        isItemStack in interface ConfigurationSection
        Parameters:
        path - Path of the ItemStack to check.
        Returns:
        Whether or not the specified path is an ItemStack.
      • getColor

        @Nullable
        public @Nullable Color getColor​(@NotNull
                                        @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested Color by path.

        If the Color does not exist but a default value has been specified, this will return the default value. If the Color does not exist and no default value was specified, this will return null.

        Specified by:
        getColor in interface ConfigurationSection
        Parameters:
        path - Path of the Color to get.
        Returns:
        Requested Color.
      • isColor

        public boolean isColor​(@NotNull
                               @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a Color.

        If the path exists but is not a Color, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a Color and return appropriately.

        Specified by:
        isColor in interface ConfigurationSection
        Parameters:
        path - Path of the Color to check.
        Returns:
        Whether or not the specified path is a Color.
      • getLocation

        @Nullable
        public @Nullable Location getLocation​(@NotNull
                                              @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested Location by path.

        If the Location does not exist but a default value has been specified, this will return the default value. If the Location does not exist and no default value was specified, this will return null.

        Specified by:
        getLocation in interface ConfigurationSection
        Parameters:
        path - Path of the Location to get.
        Returns:
        Requested Location.
      • isLocation

        public boolean isLocation​(@NotNull
                                  @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a Location.

        If the path exists but is not a Location, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a Location and return appropriately.

        Specified by:
        isLocation in interface ConfigurationSection
        Parameters:
        path - Path of the Location to check.
        Returns:
        Whether or not the specified path is a Location.
      • getConfigurationSection

        @Nullable
        public @Nullable ConfigurationSection getConfigurationSection​(@NotNull
                                                                      @NotNull String path)
        Description copied from interface: ConfigurationSection
        Gets the requested ConfigurationSection by path.

        If the ConfigurationSection does not exist but a default value has been specified, this will return the default value. If the ConfigurationSection does not exist and no default value was specified, this will return null.

        Specified by:
        getConfigurationSection in interface ConfigurationSection
        Parameters:
        path - Path of the ConfigurationSection to get.
        Returns:
        Requested ConfigurationSection.
      • isConfigurationSection

        public boolean isConfigurationSection​(@NotNull
                                              @NotNull String path)
        Description copied from interface: ConfigurationSection
        Checks if the specified path is a ConfigurationSection.

        If the path exists but is not a ConfigurationSection, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a ConfigurationSection and return appropriately.

        Specified by:
        isConfigurationSection in interface ConfigurationSection
        Parameters:
        path - Path of the ConfigurationSection to check.
        Returns:
        Whether or not the specified path is a ConfigurationSection.