Package me.neznamy.tab.api
Interface PropertyConfiguration
public interface PropertyConfiguration
Interface representing user or group configuration.
Implementation is either using file or MySQL, if it's enabled.
-
Method Summary
Modifier and TypeMethodDescriptionConverts per-world or per-server map into a per-world or per-server map with values only belonging to entered group or user.default ObjectfromString(String string) Converts string into object.Returns set of all groups or users that have anything configured, either globally or in some world or server.getGlobalSettings(String groupOrUser) Returns map of global settings applied to specified group or user.getPerServerSettings(String groupOrUser) Returns map of per-server settings of specified group or user.getPerWorldSettings(String groupOrUser) Returns map of per-world settings of specified group or user.String[]getProperty(String groupOrUser, String property, String server, String world) Gets property of group or user.voidRemoves all data applied to specified group or user.voidSets property value of group or user to specified value.default StringConverts object into string.
-
Method Details
-
setProperty
Sets property value of group or user to specified value. Ifworldorserveris notnull, value will be inserted as a per-world or per-server setting. If bothworldandserverarenull, value is inserted as a global setting.- Parameters:
groupOrUser- Name of group or user, depending on what this instance handlesproperty- Name of property to setserver- Name of server to apply setting to,nullfor global settingworld- Name of world to apply setting to,nullfor global settingvalue- Value of the property
-
getProperty
Gets property of group or user. Ifserverorworldare notnull, 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 handlesproperty- Name of property to getserver- Server the player is currently in, to allow check for per-server settingsworld- 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
Removes all data applied to specified group or user.- Parameters:
groupOrUser- Name of group or user, depending on what this instance handles
-
getGlobalSettings
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
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
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
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, convertMapObject>> (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 mapgroupOrUser- Name of group or user, depending on what this instance handles- Returns:
- Converted map only containing data of specified group or user
-
toString
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
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
-