#1125 Create infrastructure for Limbo persistence + restore 5.2 JSON storage
- Introduce configurable storage mechanism - LimboPersistence wraps a LimboPersistenceHandler, of which there are multiple implementations - Outside of the limbo.persistence package, classes only talk to LimboPersistence - Restore the way of persisting to JSON from 5.2 (SeparateFilePersistenceHandler) - Add handling for stored limbo players - Merge any existing LimboPlayers together with the goal of only keeping one version of a LimboPlayer: there is no way for a player to be online without triggering the creation of a LimboPlayer first, so we can guarantee that the in-memory LimboPlayer is the most up-to-date, i.e. when restoring limbo data we don't have to check against the disk. - Create and delete LimboPlayers at the same time when LimboPlayers are added or removed from the in-memory map - Catch all exceptions in LimboPersistence so a handler throwing an unexpected exception does not stop the limbo process (#1070) - Extend debug command /authme debug limbo to show LimboPlayer information on disk, too
This commit is contained in:
@@ -7,6 +7,7 @@ import ch.jalu.configme.properties.Property;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import fr.xephi.authme.data.limbo.AllowFlightRestoreType;
|
||||
import fr.xephi.authme.data.limbo.WalkFlySpeedRestoreType;
|
||||
import fr.xephi.authme.data.limbo.persistence.LimboPersistenceType;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -17,6 +18,15 @@ import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||
*/
|
||||
public final class LimboSettings implements SettingsHolder {
|
||||
|
||||
@Comment({
|
||||
"Besides storing the data in memory, you can define if/how the data should be persisted",
|
||||
"on disk. This is useful in case of a server crash, so next time the server starts we can",
|
||||
"properly restore things like OP status, ability to fly, and walk/fly speed.",
|
||||
"DISABLED: no disk storage, INDIVIDUAL_FILES: each player data in its own file"
|
||||
})
|
||||
public static final Property<LimboPersistenceType> LIMBO_PERSISTENCE_TYPE =
|
||||
newProperty(LimboPersistenceType.class, "limbo.persistence", LimboPersistenceType.INDIVIDUAL_FILES);
|
||||
|
||||
@Comment({
|
||||
"Whether the player is allowed to fly: RESTORE, ENABLE, DISABLE.",
|
||||
"RESTORE sets back the old property from the player."
|
||||
@@ -50,7 +60,7 @@ public final class LimboSettings implements SettingsHolder {
|
||||
"Before a user logs in, various properties are temporarily removed from the player,",
|
||||
"such as OP status, ability to fly, and walk/fly speed.",
|
||||
"Once the user is logged in, we add back the properties we previously saved.",
|
||||
"In this section, you may define how the properties should be restored."
|
||||
"In this section, you may define how these properties should be handled."
|
||||
};
|
||||
return ImmutableMap.of("limbo", limboExplanation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user