mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-08 07:36:42 +02:00
Allow to fill data with defaults on newly created configs
This commit is contained in:
@@ -82,6 +82,10 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
||||
|
||||
public abstract void finishWrite();
|
||||
|
||||
protected void fillWithDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public StorageQueue.RequestState getRequestState(long timestamp)
|
||||
{
|
||||
if (savetime == 0 || savetime < timestamp || (timestamp < 0 && savetime > 0))
|
||||
@@ -108,6 +112,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
||||
return writer;
|
||||
}
|
||||
|
||||
|
||||
private class StorageObjectDataWriter extends AbstractDelayedYamlFileWriter
|
||||
{
|
||||
public StorageObjectDataWriter()
|
||||
@@ -176,6 +181,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
||||
loaded.set(true);
|
||||
if (exception instanceof FileNotFoundException)
|
||||
{
|
||||
fillWithDefaults();
|
||||
writer.schedule();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user