File tree Expand file tree Collapse file tree
shared/src/main/java/net/pistonmaster/pistonqueue/shared/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,9 @@ target/*
1717.kotlin
1818.gradle
1919** /build /
20+ ** /run /
2021! src /** /build /
22+ ! src /** /run /
2123
2224# Ignore Gradle GUI config
2325gradle-app.setting
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ private static void manageBan(String playerName) {
109109 private static void loadData () {
110110 generateFile ();
111111 convertLegacyDataIfNeeded ();
112+ ensureFileInitialized ();
112113 dataConfig = YamlConfigurations .update (dataFile , StorageData .class );
113114 }
114115
@@ -184,4 +185,14 @@ private static void convertLegacyDataIfNeeded() {
184185 e .printStackTrace ();
185186 }
186187 }
188+
189+ private static void ensureFileInitialized () {
190+ try {
191+ if (Files .size (dataFile ) == 0 ) {
192+ YamlConfigurations .save (dataFile , StorageData .class , new StorageData ());
193+ }
194+ } catch (IOException e ) {
195+ e .printStackTrace ();
196+ }
197+ }
187198}
You can’t perform that action at this time.
0 commit comments