Interface PlayerProperties
- All Superinterfaces:
StringMapSerializationHelper
-
Method Summary
Modifier and TypeMethodDescriptionWill look for the property with that key.Returns the uuid of the player behind these properties.ShopItem[]
Parses the entryDefaultPlayerProperty.SHOPDESIGN_HYPIXELV2_QUICKBUY
and returns all the items stored in the quick buy.Returns all keys/ids of the properties that are currently stored in this object.boolean
Any changes made to this instance will not be saved, even if tried.Removes the property from the internal storage.remove
(String key, AttributeChangeCause cause) Removes the property from the internal storage.Combinesget(String)
withset(String, String)
.replace
(String key, String value, AttributeChangeCause cause) Combinesget(String)
withset(String, String)
.default void
save()
Asynchronously saves these achievements.void
Asynchronously saves these achievements.default void
Will set the value of the property with that key.void
set
(String key, String value, AttributeChangeCause cause) Will set the value of the property with that key
Ignores whether the key is uppercase or undercase
You may only use the following chars for the key: a-z, 0-9, :, _
It's safe to use UTF8 for the value.
Values are limited to 8192 bytes, otherwise an exception will be thrownvoid
setShopHypixelV2QuickBuyItems
(ShopItem[] items) Serializes and sets the entryDefaultPlayerProperty.SHOPDESIGN_HYPIXELV2_QUICKBUY
for all the items that are stored in the quick buy.Methods inherited from interface de.marcely.bedwars.tools.StringMapSerializationHelper
getBoolean, getDouble, getInt, getItemStack, getLong, set, set, set
-
Method Details
-
getPlayerUUID
UUID getPlayerUUID()Returns the uuid of the player behind these properties.- Returns:
- The UUID of the player who owns the properties
-
get
Will look for the property with that key.Ignores whether the key is uppercase or undercase.
- Specified by:
get
in interfaceStringMapSerializationHelper
- Parameters:
key
- The key/id of the property- Returns:
- The optional value of the property
-
getStoredKeys
Collection<String> getStoredKeys()Returns all keys/ids of the properties that are currently stored in this object.- Returns:
- All keys/ids set
-
set
Will set the value of the property with that key.Ignores whether the key is uppercase or undercase.
You may only use the following chars for the key: a-z, 0-9, :, _
It's safe to use UTF8 for the value. Values are limited to 8192 bytes, otherwise an exception will be thrown.
Keep in mind that the
PlayerPropertyChangeEvent
is likely being dispatched with this.- Specified by:
set
in interfaceStringMapSerializationHelper
- Parameters:
key
- The key/id of the propertyvalue
- The new value- Throws:
IllegalArgumentException
- When key or value don't fit the format
-
set
Will set the value of the property with that key
Ignores whether the key is uppercase or undercase
You may only use the following chars for the key: a-z, 0-9, :, _
It's safe to use UTF8 for the value.
Values are limited to 8192 bytes, otherwise an exception will be thrown- Parameters:
key
- The key/id of the propertyvalue
- The new valuecause
- The technical cause for setting this- Throws:
IllegalArgumentException
- When key or value don't fit the format
-
replace
Combinesget(String)
withset(String, String)
.- Parameters:
key
- The key/id of the propertyvalue
- The new value- Returns:
- The previous value
- Throws:
IllegalArgumentException
- When key or value don't fit the format
-
replace
Combinesget(String)
withset(String, String)
.- Parameters:
key
- The key/id of the propertyvalue
- The new valuevaluecause
- The technical cause for setting this- Returns:
- The previous value
- Throws:
IllegalArgumentException
- When key or value don't fit the format
-
remove
Removes the property from the internal storage.Keep in mind that the
PlayerPropertyChangeEvent
is likely being dispatched with this.- Parameters:
key
- The key/id of the property- Returns:
- The value of the removed property
-
remove
Removes the property from the internal storage.- Parameters:
key
- The key/id of the propertyvaluecause
- The technical cause for setting this- Returns:
- The value of the removed property
-
isReadOnly
boolean isReadOnly()Any changes made to this instance will not be saved, even if tried.While it is possible to change the values, MBedwars' auto-saving and
save()
will not actually do anything and any changes will be lost with the next loading.Reasons for read-only are:
- We failed to load it fully (due to an error). Reasons for that may include e.g. a disconnection to the storage server.
- The player might be online on another server and we don't want to intercept with whatever the other server is doing. Although cross-server support can be obtained using the ProxySync addon and making sure that player-data-syncing is enabled within it, in which case this instance won't be set as read-only.
- Returns:
- Whether this instance is read-only and changes won't be saved
-
save
default void save()Asynchronously saves these achievements.It's usually not needed to call this method when the player is currently on the server as the plugin will already handle it.
-
save
Asynchronously saves these achievements.It's usually not needed to call this method when the player is currently on the server as the plugin will already handle it.
Important: The callback doesn't get synced to the main thread.
- Parameters:
callback
- Gets called when the operation was finished
-
getShopHypixelV2QuickBuyItems
ShopItem[] getShopHypixelV2QuickBuyItems()Parses the entryDefaultPlayerProperty.SHOPDESIGN_HYPIXELV2_QUICKBUY
and returns all the items stored in the quick buy.In case the entry does not exist (he has never opened the HyPixelV2 shop layout before), or the data got corrupted, a new random set of items is being generated given by the currently configured pages.
Entries in the array may be null. Those represent air.
- Returns:
- All the items stored in the HyPixelV2 quick buy
- See Also:
-
setShopHypixelV2QuickBuyItems
Serializes and sets the entryDefaultPlayerProperty.SHOPDESIGN_HYPIXELV2_QUICKBUY
for all the items that are stored in the quick buy.You may not pass
null
. To reset the items, simply remove the property key usingremove(String)
.It is legt for entries to be null. Those represent air
Note that those changes (likely) do not apply in case the shop is currently open.
- Parameters:
items
- All the items stored in the HyPixelV2 quick buy- See Also:
-