Package tv.phantombot.panel.PanelUser
Class PermissionMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
com.gmt2001.datastore2.datatype.AbstractDatabaseMap<String,PanelUserHandler.Permission>
tv.phantombot.panel.PanelUser.PermissionMap
- All Implemented Interfaces:
AttachableDataType,Serializable,Cloneable,Map<String,PanelUserHandler.Permission>
Class to allow a
HashMap of <String, Permission> to be used in PermissionConverter
Also provides conversion methods
- Author:
- gmt2001
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionSpecial permissions which are only included intoJSON(boolean, boolean)if theisSaveparameter is set totrue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PermissionMapstatic PermissionMapstatic PermissionMaptoJSON(boolean displayName, boolean isSave) Converts the permissions data to aJSONArrayMethods inherited from class com.gmt2001.datastore2.datatype.AbstractDatabaseMap
attach, clear, compute, computeIfAbsent, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAllMethods inherited from class java.util.HashMap
clone, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
SPECIALPERMISSIONS
Special permissions which are only included intoJSON(boolean, boolean)if theisSaveparameter is set totrue
-
-
Constructor Details
-
PermissionMap
public PermissionMap()
-
-
Method Details
-
fromMap
- Parameters:
map- aMapof<String, Permission>- Returns:
- a
PermissionMap
-
fromJSON
- Parameters:
json- the stringifiedJSONArray- Returns:
- a
PermissionMap
-
fromJSON
- Parameters:
permissionsJSON- theJSONArray- Returns:
- a
PermissionMap
-
toJSON
Converts the permissions data to aJSONArray- Parameters:
displayName-trueto encode the display name of the value;falseto encode the numeric valueisSave-trueto includecanRestartBot,canManageUsers, and other special permissions- Returns:
- the permissions data as a
JSONArray
-