Interface StringMapSerializationHelper

All Known Subinterfaces:
ArenaPersistentStorage, PersistentStorage, PlayerProperties

public interface StringMapSerializationHelper
Extends another class with some helper methods to simplify the parsing/writing of non-String types.
  • Method Details

    • get

      Optional<String> get(String key)
      Gets the String value of the internal map.
      Parameters:
      key - The key that contains to the value
      Returns:
      The value of the key. May be empty if it doesn't exist
    • set

      void set(String key, String value)
      Set an entry to the internal map.

      It is not possible to have multiple entries with the same key. Existing ones automatically get replaced with this new one.

      Parameters:
      key - The key of the value with which you may identify the value later on
      value - The value that you want to store
    • getInt

      default Optional<Integer> getInt(String key)
      Gets the Integer value of the internal map.

      It actually gets stored as a String internally. Helper.parseInt(String) is being used to parse it.

      Parameters:
      key - The key that contains to the value
      Returns:
      The value of the key. May be empty if it doesn't exist
    • getLong

      default Optional<Long> getLong(String key)
      Gets the Long value of the internal map.

      It actually gets stored as a String internally. Helper.parseLong(String) (String)} is being used to parse it.

      Parameters:
      key - The key that contains to the value
      Returns:
      The value of the key. May be empty if it doesn't exist
    • getBoolean

      default Optional<Boolean> getBoolean(String key)
      Gets the Boolean value of the internal map.

      It actually gets stored as a String internally. Some checks are being made to make sure that it's actually a boolean.

      Parameters:
      key - The key that contains to the value
      Returns:
      The value of the key. May be empty if it doesn't exist
    • getDouble

      default Optional<Double> getDouble(String key)
      Gets the Double value of the internal map.

      It actually gets stored as a String internally. Helper.parseDouble(String) is being used to parse it.

      Parameters:
      key - The key that contains to the value
      Returns:
      The value of the key. May be empty if it doesn't exist
    • getItemStack

      default Optional<ItemStack> getItemStack(String key)
      Gets the ItemStack value of the internal map.

      It actually gets stored as a String internally. Helper.parseItemStack(String) is being used to parse it.

      Parameters:
      key - The key that contains to the value
      Returns:
      The value of the key. May be empty if it doesn't exist
    • set

      default void set(String key, Number value)
      Sets a number as the value for the given key.

      It is not possible to have multiple entries with the same key. Existing ones automatically get replaced with this new one.

      Parameters:
      key - The key of the value with which you may identify the value later on
      value - The value that you want to store
    • set

      default void set(String key, ItemStack value)
      Sets an ItemStack as the value for the given key.

      It is not possible to have multiple entries with the same key. Existing ones automatically get replaced with this new one.

      Parameters:
      key - The key of the value with which you may identify the value later on
      value - The value that you want to store
    • set

      default void set(String key, boolean value)
      Sets a boolean as the value for the given key.

      It is not possible to have multiple entries with the same key. Existing ones automatically get replaced with this new one.

      Parameters:
      key - The key of the value with which you may identify the value later on
      value - The value that you want to store