Interface ArenaPersistentStorage
- All Superinterfaces:
- PersistentStorage,- StringMapSerializationHelper
   It also may be synchronized between arenas. Access it using RemoteArena.getPersistentStorage().
   For local arenas, you may use Arena.getPersistentStorage().
 
- 
Nested Class SummaryNested classes/interfaces inherited from interface de.marcely.bedwars.tools.PersistentStoragePersistentStorage.Holder
- 
Method SummaryModifier and TypeMethodDescriptionvoiddeserialize(Reader reader) Deserializes the JSON object string fromserialize(Writer).Gets the value of the key.getArena()Gets the RemoteArena to which this instance matches.getKeys()Gets all the keys that exist within this storage.booleanGet whether the key-value pair shall be synchronized between servers.booleanRemoves everything we know about a given key-value pair.voidSerializes this every entry of this instance into a JsonObject String.voidSets the value for the key.voidsetSynchronizedFlag(String key, boolean synchronize) Define whether a certain key-value pair shall be synchronized between servers.Methods inherited from interface de.marcely.bedwars.tools.PersistentStoragesaveAsyncMethods inherited from interface de.marcely.bedwars.tools.StringMapSerializationHelpergetBoolean, getDouble, getInt, getItemStack, getLong, set, set, set
- 
Method Details- 
getArenaRemoteArena getArena()Gets the RemoteArena to which this instance matches.You may use RemoteArena.getLocal()to access the local instance, if this instance matches a local arena.- Returns:
- The matching arena
 
- 
getKeysGets all the keys that exist within this storage.Note that this may not include all of them if the RemoteArena.isLocal()ofgetArena()returns false. Reason being, that it is possible to disable the synchronization usingsetSynchronizedFlag(String, boolean).- Specified by:
- getKeysin interface- PersistentStorage
- Returns:
- All known keys
 
- 
getGets the value of the key.Note that this may return an empty result if the RemoteArena.isLocal()ofgetArena()returns false, even if the key exists on the server that handles the arena. Reason being, that it is possible to disable the synchronization usingsetSynchronizedFlag(String, boolean).- Specified by:
- getin interface- StringMapSerializationHelper
- Parameters:
- key- The key that contains to the value
- Returns:
- The value that matches the key. May be empty if there's no value
 
- 
setSets the value for the key.Note that you should set setSynchronizedFlag(String, boolean)before you set the value. Without specified, the key is being synchronized between servers by default.Following limitations exist: 
 - Key may not be longer than 255 characters
 - Key must only persist of the following characters:a-Z 0-9 ?!_-'#:@
 - Value may not be longer than 65534 characters- Specified by:
- setin interface- PersistentStorage
- Specified by:
- setin interface- StringMapSerializationHelper
- Parameters:
- key- The key of the value with which you may identify the value later on
- value- The value that you want to store
- Throws:
- IllegalArgumentException- If the limitations aren't met
 
- 
removeRemoves everything we know about a given key-value pair.- Specified by:
- removein interface- PersistentStorage
- Parameters:
- key- The key that we want to remove
- Returns:
- trueif it has been found and removed
 
- 
setSynchronizedFlagDefine whether a certain key-value pair shall be synchronized between servers.This is only interesting for servers that actually make use of the Enhanced ProxySync addon. By default, it is enabled for all arenas. However, you may disable it for certain key-value pairs to reduce traffic. You should, however, set this before you actually set the value. - Parameters:
- key- The key of the key-value pair
- synchronize- Whether synchronization accross servers shall be disabled or enabled for the key
- Throws:
- UnsupportedOperationException- If you are trying to access this for arenas that are remote
 
- 
getSynchronizedFlagGet whether the key-value pair shall be synchronized between servers.This is only interesting for servers that actually make use of the Enhanced ProxySync addon. By default, it is enabled for all arenas. However, you may disable it for certain key-value pairs to reduce traffic. You should, however, set this before you actually set the value. - Parameters:
- key- The key of the key-value pair
- Returns:
- trueif they are being synchronized between servers
 
- 
serializeSerializes this every entry of this instance into a JsonObject String.Mainly used for internal purposes. - Parameters:
- writer- The writer to which the JSON string will be written into
- Throws:
- UnsupportedOperationException- If you are trying to access this for arenas that are remote
 
- 
deserializeDeserializes the JSON object string fromserialize(Writer).Mainly used for internal purposes. - Parameters:
- reader- The reader that holds the JsonObject that we want to deserialize
- Throws:
- Exception- JsonObject has an invalid format
- UnsupportedOperationException- If you are trying to access this for arenas that are remote
 
 
-