Skip to content

Commit 22f6e1f

Browse files
committed
Replace GsonFile with core FileIO library
1 parent 13b602b commit 22f6e1f

5 files changed

Lines changed: 10 additions & 91 deletions

File tree

build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ dependencies {
3434

3535
compileOnly("net.thenextlvl:worlds:3.12.2") { isTransitive = false }
3636

37-
implementation("dev.faststats.metrics:bukkit:0.14.0")
37+
implementation("net.thenextlvl.core:files:4.0.0-pre1")
3838
implementation("net.thenextlvl.version-checker:modrinth-paper:1.0.1")
3939
implementation("net.thenextlvl:i18n:1.2.0")
4040
implementation("net.thenextlvl:nbt:4.3.4")
41+
42+
implementation("dev.faststats.metrics:bukkit:0.14.0")
4143
implementation("org.bstats:bstats-bukkit:3.1.0")
4244

4345
implementation(project(":api"))

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
gameVersions=1.21.11
2-
version=1.3.4
2+
version=1.3.5

src/main/java/net/thenextlvl/perworlds/PerWorldsPlugin.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.thenextlvl.perworlds;
22

3+
import core.file.FileIO;
4+
import core.file.formats.GsonFile;
35
import dev.faststats.bukkit.BukkitMetrics;
46
import dev.faststats.core.ErrorTracker;
57
import dev.faststats.core.chart.Chart;
@@ -15,7 +17,6 @@
1517
import net.thenextlvl.perworlds.listener.RespawnListener;
1618
import net.thenextlvl.perworlds.listener.TeleportListener;
1719
import net.thenextlvl.perworlds.listener.WorldListener;
18-
import net.thenextlvl.perworlds.model.config.GsonFile;
1920
import net.thenextlvl.perworlds.model.config.PluginConfig;
2021
import net.thenextlvl.perworlds.version.PluginVersionChecker;
2122
import org.bstats.bukkit.Metrics;
@@ -77,9 +78,9 @@ public final class PerWorldsPlugin extends JavaPlugin {
7778
private final PaperGroupProvider provider = new PaperGroupProvider(this);
7879
private final boolean groupsExist = Files.exists(provider.getDataFolder());
7980

80-
private final GsonFile<PluginConfig> config = new GsonFile<>(
81+
private final FileIO<PluginConfig> config = new GsonFile<>(
8182
getDataPath().resolve("config.json"), new PluginConfig()
82-
).saveIfAbsent(this);
83+
).validate().save();
8384

8485
public PerWorldsPlugin() throws IOException {
8586
}
@@ -192,7 +193,7 @@ private void registerCommands() {
192193
});
193194
}
194195

195-
public GsonFile<PluginConfig> configFile() {
196+
public FileIO<PluginConfig> configFile() {
196197
return config;
197198
}
198199

src/main/java/net/thenextlvl/perworlds/model/config/GsonFile.java

Lines changed: 0 additions & 84 deletions
This file was deleted.

src/main/java/net/thenextlvl/perworlds/model/config/PluginConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public boolean migrateToGroup(final PerWorldsPlugin plugin, final WorldGroup gro
2626
if (current.equals(group) || current.hasPlayerData(player)) return;
2727
current.loadPlayerData(player, false);
2828
});
29-
plugin.configFile().save(plugin);
29+
plugin.configFile().save();
3030
return true;
3131
}
3232

0 commit comments

Comments
 (0)