diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 8c8a4c0..95825c6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -9,6 +9,7 @@ diff --git a/README.md b/README.md new file mode 100644 index 0000000..e3648b4 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +environment +----------- + + ```shell + docker network create scrow 2>/dev/null || true + docker run -d --network scrow -it --rm --name mongo -p 27017:27017 mongo + docker run -d --network scrow -e ME_CONFIG_MONGODB_SERVER=mongo -e ME_CONFIG_MONGODB_AUTH_PASSWORD='' -e ME_CONFIG_MONGODB_AUTH_USERNAME='' --name mongo-express -p 8081:8081 mongo-express + ``` + +modules +------- + +* APIs + ---- + +* core-api contains api for all java development +* core-bukkit-api contains api for bukkit development + * depends on core-api + +* implementations + --------------- + the `-impl` suffix indicates that this module implements the API with the same prefix. + So `core-impl` implements `core-api`. + * core-bukkit-impl is a spigot plugin. It shades core-impl. \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index b97a06a..4b2a8a6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("java") - id("java-library") + id("io.freefair.lombok") version "9.2.0" apply false } group = "de.kentoj.scrow" @@ -10,22 +10,27 @@ repositories { mavenCentral() } -dependencies { - testImplementation(platform("org.junit:junit-bom:5.10.0")) - testImplementation("org.junit.jupiter:junit-jupiter") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") +subprojects { + apply(plugin = "java") + apply(plugin = "io.freefair.lombok") - // https://mvnrepository.com/artifact/org.jetbrains/annotations - api("org.jetbrains:annotations:26.0.2-1") + repositories { + mavenCentral() + } - // https://projectreactor.io/docs/core/release/reference/gettingStarted.html - api(platform("io.projectreactor:reactor-bom:2025.0.3")) - api("io.projectreactor:reactor-core") + dependencies { + // https://mvnrepository.com/artifact/org.jetbrains/annotations + implementation("org.jetbrains:annotations:26.0.2-1") - // https://mvnrepository.com/artifact/com.google.guava/guava - api("com.google.guava:guava:33.5.0-jre") -} + // https://projectreactor.io/docs/core/release/reference/gettingStarted.html + implementation(platform("io.projectreactor:reactor-bom:2025.0.3")) + implementation("io.projectreactor:reactor-core") -tasks.test { - useJUnitPlatform() + // https://mvnrepository.com/artifact/com.google.guava/guava + implementation("com.google.guava:guava:33.5.0-jre") + + // https://www.mongodb.com/docs/drivers/java/sync/current/get-started/ + implementation(platform("org.mongodb:mongodb-driver-bom:5.6.3")) + implementation("org.mongodb:mongodb-driver-sync") + } } \ No newline at end of file diff --git a/core-impl/src/main/java/de/kentoj/scrow/economy/EconomyServiceImpl.java b/core-impl/src/main/java/de/kentoj/scrow/economy/EconomyServiceImpl.java new file mode 100644 index 0000000..a8a036a --- /dev/null +++ b/core-impl/src/main/java/de/kentoj/scrow/economy/EconomyServiceImpl.java @@ -0,0 +1,4 @@ +package de.kentoj.scrow.economy; + +public class EconomyServiceImpl { +} diff --git a/core-impl/src/main/java/de/kentoj/scrow/economy/Main.java b/core-impl/src/main/java/de/kentoj/scrow/economy/Main.java new file mode 100644 index 0000000..2fa6244 --- /dev/null +++ b/core-impl/src/main/java/de/kentoj/scrow/economy/Main.java @@ -0,0 +1,8 @@ +package de.kentoj.scrow.economy; + +public class Main { + public static void main(String[] args) { + var a = new MongoDbHelper(); + a.close(); + } +} diff --git a/core-impl/src/main/java/de/kentoj/scrow/economy/MongoDbHelper.java b/core-impl/src/main/java/de/kentoj/scrow/economy/MongoDbHelper.java new file mode 100644 index 0000000..409d889 --- /dev/null +++ b/core-impl/src/main/java/de/kentoj/scrow/economy/MongoDbHelper.java @@ -0,0 +1,25 @@ +package de.kentoj.scrow.economy; + +import com.mongodb.client.MongoClient; +import com.mongodb.client.MongoClients; +import com.mongodb.client.MongoDatabase; +import lombok.Getter; + +import java.io.Closeable; + +public class MongoDbHelper implements Closeable { + + private final MongoClient con; + @Getter + private final MongoDatabase database; + + public MongoDbHelper() { + con = MongoClients.create("mongodb://:@localhost:27017/db?ssl=false"); + database = con.getDatabase("scrow"); + } + + @Override + public void close() { + con.close(); + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 7f32556..cb02752 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,3 @@ rootProject.name = "core" -include("core-api") \ No newline at end of file +include("core-api") +include("core-impl") \ No newline at end of file