Skip to content

Commit

Permalink
Fix injector errors
Browse files Browse the repository at this point in the history
  • Loading branch information
md5sha256 committed Jan 1, 2025
1 parent 88b8f28 commit d32bf0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ tasks {
minecraftVersion("1.21.1")
downloadPlugins {
// Essentials
url("https://ci.ender.zone/job/EssentialsX/lastSuccessfulBuild/artifact/jars/EssentialsX-2.21.0-dev+151-f2af952.jar")
url("https://ci.ender.zone/job/EssentialsX/lastSuccessfulBuild/artifact/jars/EssentialsX-2.21.0-dev+153-8e53214.jar")
// Vault
github("MilkBowl", "Vault", "1.7.3", "Vault.jar")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.md5sha256.spigotutils.blocks.BlockPosition;
import com.github.md5sha256.spigotutils.blocks.ChunkPosition;
import com.google.inject.Inject;
import com.google.inject.assistedinject.AssistedInject;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
Expand Down Expand Up @@ -61,28 +62,31 @@ plant_world BINARY(16) NOT NULL,
private final File file;
private final DataSource dataSource;

@AssistedInject
@Inject
SQLResolver(@NotNull Plugin plugin,
@NotNull DrugRegistry drugRegistry,
@NotNull @Named("database") ExecutorService databaseExecutor) {
this.resolver = new ConfigurateResolver(plugin, drugRegistry);
this.executorService = databaseExecutor;
this.file = new File(plugin.getDataFolder(), "plants.db");
initFile();
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:sqlite://" + file.getAbsolutePath());
this.dataSource = new HikariDataSource(config);
init();
initDb();
}

private void init() {
private void initFile() {
if (!this.file.exists()) {
this.file.mkdirs();
try {
this.file.createNewFile();
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
}

private void initDb() {
try (Connection connection = getConnection();
PreparedStatement statement = connection.prepareStatement(CREATE_DRUG_PLANT)) {
statement.execute();
Expand Down

0 comments on commit d32bf0f

Please sign in to comment.