Skip to content

Commit 1faf94a

Browse files
Merge pull request #8 from OneLiteFeatherNET/develop
The pull request adds the latest changes from develop to master. So we can create our first release
2 parents e4b6b29 + 48a773e commit 1faf94a

File tree

20 files changed

+641
-16
lines changed

20 files changed

+641
-16
lines changed

.github/workflows/main-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Checkout Repository
2121
uses: actions/checkout@v4
2222
- name: Validate Gradle Wrapper
23-
uses: gradle/wrapper-validation-action@v3
23+
uses: gradle/actions/wrapper-validation@v4
2424
- name: Setup Java
2525
uses: actions/setup-java@v4
2626
with:

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Guira
2+
3+
Guira is a lightweight Java library designed to help you implement flexible and robust setup processes for games, minigames, or any other custom features on a [Minestom](https://github.com/Minestom/Minestom) server. Rather than enforcing a fixed setup structure, Guira empowers you to define exactly what your setup should contain—such as maps, teams, rules, or any other configuration—by letting you design your own setup data types and logic. The library provides a solid and extensible foundation for storing, tracking, and managing this setup data, making it easy to build tailored setup flows for a wide range of server scenarios.
4+
5+
## Installation
6+
7+
Add the following to your `build.gradle.kts`:
8+
9+
```kotlin
10+
dependencies {
11+
compileOnly("net.onelitefeather.guira:guira:<version>>")
12+
}
13+
```
14+
15+
## Usage Example
16+
17+
```java
18+
// Create a new SetupDataService instance
19+
SetupDataService<MySetupData> service = SetupDataService.create();
20+
21+
// Add setup data
22+
UUID uuid = UUID.randomUUID();
23+
MySetupData data = new MySetupData(uuid, ...);
24+
service.add(uuid, data);
25+
26+
// Retrieve setup data
27+
Optional<MySetupData> retrieved = service.get(uuid);
28+
29+
// Remove setup data
30+
service.remove(uuid);
31+
```
32+
33+
### Event Handling
34+
35+
Guira provides events such as `SetupCreateEvent` and `SetupFinishEvent` for managing the setup process lifecycle.
36+
37+
> [!NOTE]
38+
> **Guira does NOT automatically fire any of the provided events (`SetupCreateEvent`, `SetupFinishEvent`, etc).**
39+
> You are responsible for triggering and handling these events in your own code/context (e.g., your Minestom server plugin or application).
40+
41+
## License
42+
43+
This project is licensed under the [Apache License 2.0](LICENSE).

build.gradle.kts

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,81 @@
11
plugins {
22
java
3+
jacoco
4+
`java-library`
5+
`maven-publish`
6+
alias(libs.plugins.publishdata)
37
}
48

59
group = "net.onelitefeather.guira"
6-
version = "1.0-SNAPSHOT"
10+
version = "0.1.0"
711

8-
repositories {
9-
mavenCentral()
12+
java {
13+
toolchain {
14+
languageVersion.set(JavaLanguageVersion.of(21))
15+
}
1016
}
1117

1218
dependencies {
13-
testImplementation(platform("org.junit:junit-bom:5.10.0"))
14-
testImplementation("org.junit.jupiter:junit-jupiter")
19+
compileOnly(libs.minestom)
20+
compileOnly(libs.jetbrains.annotation)
21+
compileOnly(libs.aves)
22+
23+
testImplementation(libs.minestom)
24+
testImplementation(libs.minestom.test)
25+
testImplementation(libs.aves)
26+
testImplementation(libs.junit.api)
27+
testRuntimeOnly(libs.junit.engine)
28+
}
29+
30+
publishData {
31+
addMainRepo("https://repo.onelitefeather.dev/onelitefeather-releases")
32+
addMasterRepo("https://repo.onelitefeather.dev/onelitefeather-releases")
33+
addSnapshotRepo("https://repo.onelitefeather.dev/onelitefeather-snapshots")
34+
publishTask("jar")
35+
}
36+
37+
tasks {
38+
compileJava {
39+
options.encoding = "UTF-8"
40+
options.release.set(21)
41+
}
42+
43+
compileTestJava {
44+
options.encoding = "UTF-8"
45+
options.release.set(21)
46+
}
47+
48+
test {
49+
finalizedBy(jacocoTestReport)
50+
useJUnitPlatform()
51+
jvmArgs("-Dminestom.inside-test=true")
52+
testLogging {
53+
events("passed", "skipped", "failed")
54+
}
55+
}
56+
}
57+
58+
publishing {
59+
publications {
60+
create<MavenPublication>("maven") {
61+
// configure the publication as defined previously.
62+
publishData.configurePublication(this)
63+
version = publishData.getVersion(false)
64+
}
65+
}
66+
repositories {
67+
maven {
68+
authentication {
69+
credentials(PasswordCredentials::class) {
70+
username = System.getenv("ONELITEFEATHER_MAVEN_USERNAME")
71+
password = System.getenv("ONELITEFEATHER_MAVEN_PASSWORD")
72+
}
73+
}
74+
75+
name = "OneLiteFeatherRepository"
76+
// Get the detected repository from the publish data
77+
url = uri(publishData.getRepository())
78+
}
79+
}
1580
}
1681

17-
tasks.test {
18-
useJUnitPlatform()
19-
}

gradle/wrapper/gradle-wrapper.jar

59 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
118118

119119

120120
# Determine the Java command to use to start the JVM.
@@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
213213
set -- \
214214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215215
-classpath "$CLASSPATH" \
216-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217217
"$@"
218218

219219
# Stop when "xargs" is not available.

gradlew.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
set CLASSPATH=
7474

7575

7676
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
77+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7878

7979
:end
8080
@rem End local scope for the variables with windows NT shell

renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"config:recommended"
55
],
66
"rebaseWhen": "conflicted",
7-
"label": [
7+
"labels": [
88
"renovate"
99
]
1010
}

settings.gradle.kts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
1-
rootProject.name = "Guira"
1+
rootProject.name = "guira"
2+
3+
pluginManagement {
4+
repositories {
5+
gradlePluginPortal()
6+
maven("https://eldonexus.de/repository/maven-public/")
7+
}
8+
}
9+
10+
dependencyResolutionManagement {
11+
repositories {
12+
mavenCentral()
13+
maven {
14+
name = "OneLiteFeatherRepository"
15+
url = uri("https://repo.onelitefeather.dev/onelitefeather")
16+
if (System.getenv("CI") != null) {
17+
credentials {
18+
username = System.getenv("ONELITEFEATHER_MAVEN_USERNAME")
19+
password = System.getenv("ONELITEFEATHER_MAVEN_PASSWORD")
20+
}
21+
} else {
22+
credentials(PasswordCredentials::class)
23+
authentication {
24+
create<BasicAuthentication>("basic")
25+
}
26+
}
27+
}
28+
}
29+
versionCatalogs {
30+
create("libs") {
31+
version("minestom", "1.5.1")
32+
version("aves", "1.6.1")
33+
version("junit", "5.12.2")
34+
version("publishdata", "1.4.0")
35+
version("jetbrains.annotation", "26.0.2")
36+
37+
library("minestom", "net.onelitefeather.microtus", "Microtus").versionRef("minestom")
38+
library("minestom.test", "net.onelitefeather.microtus.testing", "testing").versionRef("minestom")
39+
40+
library("aves", "de.icevizion.lib", "aves").versionRef("aves")
41+
42+
library("junit.api", "org.junit.jupiter", "junit-jupiter-api").versionRef("junit")
43+
library("junit.engine", "org.junit.jupiter", "junit-jupiter-engine").versionRef("junit")
44+
library("jetbrains.annotation", "org.jetbrains", "annotations").versionRef("jetbrains.annotation")
45+
46+
plugin("publishdata", "de.chojo.publishdata").versionRef("publishdata")
47+
}
48+
}
49+
}
250

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package net.onelitefeather.guira;
2+
3+
import de.icevizion.aves.map.BaseMap;
4+
import net.onelitefeather.guira.data.SetupData;
5+
import org.jetbrains.annotations.Contract;
6+
import org.jetbrains.annotations.NotNull;
7+
import org.jetbrains.annotations.Nullable;
8+
import org.jetbrains.annotations.UnmodifiableView;
9+
10+
import java.util.Map;
11+
import java.util.Optional;
12+
import java.util.UUID;
13+
14+
/**
15+
* The (@link SetupDataService} is responsible for managing setup data during a runtime session.
16+
* It allows adding, removing, and retrieving setup data associated with a unique identifier (UUID).
17+
*
18+
* @param <T> the type of setup data
19+
* @author thEvilReaper
20+
* @version 1.0.0
21+
* @since 0.1.0
22+
*/
23+
public interface SetupDataService<T extends SetupData<? extends BaseMap>> {
24+
25+
/**
26+
* Creates a new instance of SetupDataService.
27+
*
28+
* @param <T> the type of setup data
29+
* @return a new instance of SetupDataService
30+
*/
31+
@Contract(pure = true)
32+
static @NotNull <T extends SetupData<? extends BaseMap>> SetupDataService<T> create() {
33+
return new SetupDataServiceImpl<>();
34+
}
35+
36+
/**
37+
* Adds a new setup data to the service.
38+
*
39+
* @param uuid the unique identifier for the setup data
40+
* @param data the setup data to add
41+
*/
42+
void add(@NotNull UUID uuid, @NotNull T data);
43+
44+
/**
45+
* Removes the setup data associated with the given UUID.
46+
*
47+
* @param uuid the unique identifier for the setup data
48+
* @return an optional containing the removed setup data, or empty if not found
49+
*/
50+
@NotNull Optional<@Nullable T> remove(@NotNull UUID uuid);
51+
52+
/**
53+
* Retrieves the setup data associated with the given UUID.
54+
*
55+
* @param uuid the unique identifier for the setup data
56+
* @return an optional containing the setup data, or empty if not found
57+
*/
58+
@NotNull Optional<@Nullable T> get(@NotNull UUID uuid);
59+
60+
/**
61+
* Returns an unmodifiable view of the setup data map.
62+
*
63+
* @return an unmodifiable view
64+
*/
65+
@NotNull
66+
@UnmodifiableView
67+
Map<UUID, T> getView();
68+
}

0 commit comments

Comments
 (0)