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 theisSave
parameter is set totrue
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PermissionMap
static PermissionMap
static PermissionMap
toJSON
(boolean displayName, boolean isSave) Converts the permissions data to aJSONArray
Methods inherited from class com.gmt2001.datastore2.datatype.AbstractDatabaseMap
attach, clear, compute, computeIfAbsent, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll
Methods inherited from class java.util.HashMap
clone, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
SPECIALPERMISSIONS
Special permissions which are only included intoJSON(boolean, boolean)
if theisSave
parameter is set totrue
-
-
Constructor Details
-
PermissionMap
public PermissionMap()
-
-
Method Details
-
fromMap
- Parameters:
map
- aMap
of<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
-true
to encode the display name of the value;false
to encode the numeric valueisSave
-true
to includecanRestartBot
,canManageUsers
, and other special permissions- Returns:
- the permissions data as a
JSONArray
-