Interface PropertyConfiguration


public interface PropertyConfiguration
Interface representing user or group configuration. Implementation is either using file or MySQL, if it's enabled.
  • Method Details

    • setProperty

      void setProperty(String groupOrUser, String property, String server, String world, String value)
      Sets property value of group or user to specified value. If world or server is not null, value will be inserted as a per-world or per-server setting. If both world and server are null, value is inserted as a global setting.
      Parameters:
      groupOrUser - Name of group or user, depending on what this instance handles
      property - Name of property to set
      server - Name of server to apply setting to, null for global setting
      world - Name of world to apply setting to, null for global setting
      value - Value of the property
    • getProperty

      String[] getProperty(String groupOrUser, String property, String server, String world)
      Gets property of group or user. If server or world are not null, per-server / per-world settings are checked first to try to find a match. If no match is found, global value is returned. Returned value is an array with 2 elements, with first argument being value and second being source. If nothing is found, empty array is returned.
      Parameters:
      groupOrUser - Name of group or user, depending on what this instance handles
      property - Name of property to get
      server - Server the player is currently in, to allow check for per-server settings
      world - World the player is currently in, to allow check for per-world settings
      Returns:
      Array with 2 elements with value being first, source second if found, empty array if nothing was found.
    • remove

      void remove(String groupOrUser)
      Removes all data applied to specified group or user.
      Parameters:
      groupOrUser - Name of group or user, depending on what this instance handles
    • getGlobalSettings

      Map<String,Object> getGlobalSettings(String groupOrUser)
      Returns map of global settings applied to specified group or user. Map key is property name, value is property value.
      Parameters:
      groupOrUser - Name of group or user, depending on what this instance handles
      Returns:
      Map of global settings of specified group or user
    • getPerWorldSettings

      Map<String,Map<String,Object>> getPerWorldSettings(String groupOrUser)
      Returns map of per-world settings of specified group or user. Map key is world name, value is property name-value map in that world.
      Parameters:
      groupOrUser - Name of group or user, depending on what this instance handles
      Returns:
      Map of per-world settings of specified group or user
    • getPerServerSettings

      Map<String,Map<String,Object>> getPerServerSettings(String groupOrUser)
      Returns map of per-server settings of specified group or user. Map key is server name, value is property name-value map in that server.
      Parameters:
      groupOrUser - Name of group or user, depending on what this instance handles
      Returns:
      Map of per-server settings of specified group or user
    • getAllEntries

      Set<String> getAllEntries()
      Returns set of all groups or users that have anything configured, either globally or in some world or server.
      Returns:
      Set of all entries with something configured
    • convertMap

      default Map<String,Map<String,Object>> convertMap(Map<String,Map<String,Map<String,Object>>> map, String groupOrUser)
      Converts per-world or per-server map into a per-world or per-server map with values only belonging to entered group or user. In other words, extracts settings belonging to group or user from the map.
      Parameters:
      map - Original per-world or per-server setting map
      groupOrUser - Name of group or user, depending on what this instance handles
      Returns:
      Converted map only containing data of specified group or user
    • toString

      default String toString(Object obj)
      Converts object into string. For most objects, Object.toString() is called. For lists, entries are connected with "\n".
      Parameters:
      obj - Object to convert
      Returns:
      Converted string
    • fromString

      default Object fromString(String string)
      Converts string into object. If string contains "\n", a list is created using "\n" as a separator. Otherwise, inserted string is returned.
      Parameters:
      string - String to convert
      Returns:
      Converted object