public interface NucleusUserPreferenceService
Modifier and Type | Interface and Description |
---|---|
static interface |
NucleusUserPreferenceService.Keys
|
static interface |
NucleusUserPreferenceService.PreferenceKey<T>
Represents a
NucleusUserPreferenceService.PreferenceKey |
Modifier and Type | Method and Description |
---|---|
boolean |
canAccess(org.spongepowered.api.entity.living.player.User user,
NucleusUserPreferenceService.PreferenceKey<?> key)
Gets whether a
User can use a given NucleusUserPreferenceService.PreferenceKey |
java.lang.String |
getDescription(NucleusUserPreferenceService.PreferenceKey<?> key)
The description of the preference.
|
<T> java.util.Optional<T> |
getPreferenceFor(org.spongepowered.api.entity.living.player.User user,
NucleusUserPreferenceService.PreferenceKey<T> key)
Gets the preference associated with the
NucleusUserPreferenceService.PreferenceKey for the
supplied User , if any is set. |
NucleusUserPreferenceService.Keys |
keys()
Gets the user preference keys available for this user.
|
void |
removePreferenceFor(org.spongepowered.api.entity.living.player.User user,
NucleusUserPreferenceService.PreferenceKey<?> key)
Removes a preference associated with a user, reverting it to a default
value as determined by the consumer of the preference (which will usually
take the value of
NucleusUserPreferenceService.PreferenceKey.getDefaultValue() , if any is
supplied). |
<T> void |
setPreferenceFor(org.spongepowered.api.entity.living.player.User user,
NucleusUserPreferenceService.PreferenceKey<T> key,
T value)
Sets the preference associated with the
NucleusUserPreferenceService.PreferenceKey for the
supplied User . |
NucleusUserPreferenceService.Keys keys()
NucleusUserPreferenceService.Keys
<T> java.util.Optional<T> getPreferenceFor(org.spongepowered.api.entity.living.player.User user, NucleusUserPreferenceService.PreferenceKey<T> key)
NucleusUserPreferenceService.PreferenceKey
for the
supplied User
, if any is set.T
- The type of preference this isuser
- The User
key
- The NucleusUserPreferenceService.PreferenceKey
to check against.<T> void setPreferenceFor(org.spongepowered.api.entity.living.player.User user, NucleusUserPreferenceService.PreferenceKey<T> key, T value)
NucleusUserPreferenceService.PreferenceKey
for the
supplied User
.T
- The type of preference this isuser
- The User
key
- The NucleusUserPreferenceService.PreferenceKey
value to setvalue
- The value to setvoid removePreferenceFor(org.spongepowered.api.entity.living.player.User user, NucleusUserPreferenceService.PreferenceKey<?> key)
NucleusUserPreferenceService.PreferenceKey.getDefaultValue()
, if any is
supplied).user
- The User
key
- The NucleusUserPreferenceService.PreferenceKey
boolean canAccess(org.spongepowered.api.entity.living.player.User user, NucleusUserPreferenceService.PreferenceKey<?> key)
User
can use a given NucleusUserPreferenceService.PreferenceKey
user
- The userkey
- The keyjava.lang.String getDescription(NucleusUserPreferenceService.PreferenceKey<?> key)
key
- The NucleusUserPreferenceService.PreferenceKey
to check