Every Many files model annotated as ManyFiles annotation. A primary section is not required.
Every Many files model must implement FileModel interface.
Methods: serialize() and deserialize(Map<String, Object> args) are important to Bukkit serialization system.
@ManyFiles(primarySection = "user", parentDirectory = "arenas")
@SerializableAs("UserCoins") //This is alias for Bukkit serialization (optional)
public class UserCoins implements FileModel, ConfigurationSerializable {
@Id
private UUID uuid;
private double coins;
public UserCoins (String name, double coins) {
this.name = name;
this.coins = coins;
}
@Override
public Dao getDao() {
return new ManyYamlFileDao(this);
}
@Override
@NonNull
public Map<String, Object> serialize() {
Map<String, Object> data = new LinkedHashMap<>();
data.put("uuid", uuid);
data.put("coins", coins);
return data;
}
public static UserCoins deserialize(Map<String, Object> args) {
return new UserCoins((UUID) args.get("uuid"),
(double) args.get("coins"));
}
}