-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
72 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>me.hsgamer</groupId> | ||
<artifactId>topper-spigot</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>topper-spigot-agent-storage-simple</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>me.hsgamer</groupId> | ||
<artifactId>topper-spigot-config</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>me.hsgamer</groupId> | ||
<artifactId>topper-agent-storage-simple</artifactId> | ||
<version>${project.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.xerial</groupId> | ||
<artifactId>sqlite-jdbc</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>com.mysql</groupId> | ||
<artifactId>mysql-connector-j</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
</project> |
30 changes: 30 additions & 0 deletions
30
...src/main/java/me/hsgamer/topper/spigot/agent/storage/simple/SpigotDataStorageBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package me.hsgamer.topper.spigot.agent.storage.simple; | ||
|
||
import io.github.projectunified.minelib.scheduler.common.task.Task; | ||
import io.github.projectunified.minelib.scheduler.global.GlobalScheduler; | ||
import me.hsgamer.hscore.bukkit.config.BukkitConfig; | ||
import me.hsgamer.hscore.config.proxy.ConfigGenerator; | ||
import me.hsgamer.topper.agent.storage.simple.builder.DataStorageBuilder; | ||
import me.hsgamer.topper.agent.storage.simple.config.DatabaseConfig; | ||
import me.hsgamer.topper.agent.storage.simple.converter.FlatEntryConverter; | ||
import me.hsgamer.topper.agent.storage.simple.converter.SqlEntryConverter; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import java.io.File; | ||
|
||
public class SpigotDataStorageBuilder<K, V> extends DataStorageBuilder<K, V> { | ||
public SpigotDataStorageBuilder(JavaPlugin plugin, File holderBaseFolder, FlatEntryConverter<K, V> flatEntryConverter, SqlEntryConverter<K, V> sqlEntryConverter) { | ||
super( | ||
runnable -> { | ||
Task task = GlobalScheduler.get(plugin).runLater(runnable, 40L); | ||
return task::cancel; | ||
}, | ||
runnable -> GlobalScheduler.get(plugin).run(runnable), | ||
BukkitConfig::new, | ||
() -> ConfigGenerator.newInstance(DatabaseConfig.class, new BukkitConfig(plugin, "database.yml")), | ||
holderBaseFolder, | ||
flatEntryConverter, | ||
sqlEntryConverter | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters