Skip to content

Commit 14aff41

Browse files
Feature/initial impl (#1)
* Add vector * make vector static * Setup tests * add BlockVector * add color de-serializer * test dummy * add unit test utils * Implement vector tests * migrate to color record * implement blockvector deserialization test * remove toml list in block vector test * add deserialization test for color * fix block vector * Add potion effect type * implement test for color de-serialization * Fix tests * Add firework effect * Add pattern * implemented bounding box de-serializer * implemented attribute modifier de-serializer * Add unit tests for location * Fix merge * Add player serialization * add inventory like de-serializer * Add readme and publishing * Final cleanup --------- Co-authored-by: Florian Fülling <[email protected]>
1 parent 79b1bab commit 14aff41

File tree

148 files changed

+3266
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+3266
-3
lines changed

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: RainbowDashLabs
4+
patreon: eldoriaplugins
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: eldoriaplugins
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/javadocs.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Javadocs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up JDK 18
15+
uses: actions/setup-java@v3
16+
with:
17+
distribution: adopt
18+
java-version: 18
19+
- name: Build Javadocs
20+
run: |
21+
echo "Building javadocs with gradle"
22+
./gradlew clean javadoc
23+
echo "Moving to javadocs directory:"
24+
cd build/docs/javadoc
25+
echo "Creating .nojekyll to have Github pages deploy html as is:"
26+
touch .nojekyll
27+
- name: Deploy
28+
uses: JamesIves/[email protected]
29+
with:
30+
branch: gh-pages # The branch the action should deploy to.
31+
folder: build/docs/javadoc # The folder the action should deploy.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish to Nexus
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev*
8+
- feature/*
9+
- fix/*
10+
jobs:
11+
build:
12+
environment: build
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/[email protected]
17+
- name: Set up JDK 18
18+
uses: actions/setup-java@v3
19+
with:
20+
distribution: temurin
21+
java-version: 18
22+
- name: Build with Gradle
23+
run: ./gradlew --build-cache build
24+
- name: Test with Gradle
25+
run: ./gradlew test
26+
- name: Publish to eldonexus
27+
run: ./gradlew publishMavenPublicationToEldoNexusRepository
28+
env:
29+
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
30+
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}

.github/workflows/verify.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Verify state
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/[email protected]
11+
- name: Set up JDK 18
12+
uses: actions/setup-java@v3
13+
with:
14+
distribution: temurin
15+
java-version: 18
16+
- name: Build with Gradle
17+
run: ./gradlew --build-cache build
18+
- name: Test with Gradle
19+
run: ./gradlew test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# .idea/modules.xml
1919
# .idea/*.iml
2020
# .idea/modules
21-
# *.iml
21+
*.iml
2222
# *.ipr
2323

2424
# CMake
File renamed without changes.

Readme.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/eldoriarpg/jackson-bukkit/verify.yml?branch=main&style=for-the-badge&label=Building)
2+
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/eldoriarpg/jackson-bukkit/publish_to_nexus.yml?branch=main&style=for-the-badge&label=Publishing) \
3+
![Sonatype Nexus (Releases)](https://img.shields.io/nexus/maven-releases/de.eldoria/jackson-bukkit?label=Release&logo=Release&server=https%3A%2F%2Feldonexus.de&style=for-the-badge)
4+
![Sonatype Nexus (Development)](https://img.shields.io/nexus/maven-dev/de.eldoria/jackson-bukkit?label=DEV&logo=Release&server=https%3A%2F%2Feldonexus.de&style=for-the-badge)
5+
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/de.eldoria/jackson-bukkit?color=orange&label=Snapshot&server=https%3A%2F%2Feldonexus.de&style=for-the-badge)
6+
7+
### [Javadocs](https://rainbowdashlabs.github.io/jackson-bukkit/)
8+
9+
## Dependency
10+
11+
**Gradle**
12+
13+
``` kotlin
14+
repositories {
15+
maven("https://eldonexus.de/repository/maven-public")
16+
}
17+
18+
dependencies {
19+
compileOnly("de.eldoria", "jackson-bukkit", "version")
20+
}
21+
```
22+
23+
**Maven**
24+
25+
``` xml
26+
<repository>
27+
<id>EldoNexus</id>
28+
<url>https://eldonexus.de/repository/maven-public/</url>
29+
</repository>
30+
31+
<dependency>
32+
<groupId>de.eldoria</groupId>
33+
<artifactId>jackson-bukkit</artifactId>
34+
<version>version</version>
35+
</dependency>
36+
```
37+
38+
## Usage
39+
40+
Simply add the JacksonBukkit module to the builder of your choice.
41+
42+
```java
43+
ObjectMapper JSON = JsonMapper.builder()
44+
.addModule(new JacksonBukkit())
45+
.build();
46+
47+
```
48+
49+
## Supported Classes
50+
51+
We support all classes implementing `ConfigurationSerializable`. To be precise we support the following classes:
52+
53+
- Vector
54+
- BlockVector
55+
- Color
56+
- ItemStack (Serialized as Base64 encoded bytes as recommended by [paper](https://jd.papermc.io/paper/1.19/org/bukkit/inventory/ItemStack.html#serializeAsBytes()))
57+
- PotionEffect
58+
- FireworkEffect
59+
- Pattern
60+
- BoundingBox
61+
- AttributeModifier
62+
- Location
63+
64+
**Additional Support for:**
65+
66+
- NamespacedKey
67+
- OfflinePlayer
68+
- Inventory via InventoryWrapper class

build.gradle.kts

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import org.gradle.internal.impldep.org.apache.commons.codec.CharEncoding
2+
13
plugins {
24
java
35
`maven-publish`
46
`java-library`
57
id("com.diffplug.spotless") version "6.16.0"
68
id("de.chojo.publishdata") version "1.2.4"
9+
id("io.papermc.paperweight.userdev") version "1.5.3"
710
}
811

912
group = "de.eldoria"
@@ -16,11 +19,26 @@ repositories {
1619
}
1720

1821
dependencies {
19-
compileOnly("org.spigotmc", "spigot-api", "1.16.5-R0.1-SNAPSHOT")
2022

21-
testImplementation("org.spigotmc", "spigot-api", "1.16.5-R0.1-SNAPSHOT")
23+
paperweight.paperDevBundle("1.19.4-R0.1-SNAPSHOT")
24+
25+
implementation(platform("com.fasterxml.jackson:jackson-bom:2.14.2"))
26+
27+
api("com.fasterxml.jackson.core", "jackson-core")
28+
29+
// minecraft testing
30+
testImplementation("com.github.seeseemelk", "MockBukkit-v1.19", "2.29.0")
31+
32+
// jackson testing
33+
implementation("com.fasterxml.jackson.core:jackson-databind")
34+
testImplementation("com.fasterxml.jackson.core:jackson-databind")
35+
testImplementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
36+
testImplementation("com.fasterxml.jackson.dataformat:jackson-dataformat-toml")
37+
38+
// junit and stuff
2239
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
2340
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
41+
testImplementation("org.mockito:mockito-core:5.2.0")
2442
}
2543

2644
spotless {
@@ -39,6 +57,10 @@ java {
3957
}
4058

4159
tasks {
60+
assemble {
61+
dependsOn(reobfJar)
62+
}
63+
4264
compileJava {
4365
options.encoding = "UTF-8"
4466
}
@@ -53,4 +75,60 @@ tasks {
5375
events("passed", "skipped", "failed")
5476
}
5577
}
78+
javadoc {
79+
val options = options as StandardJavadocDocletOptions
80+
options.encoding = CharEncoding.UTF_8
81+
options.links(
82+
"https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/latest/",
83+
"https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-annotations/latest",
84+
"https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/latest",
85+
"https://jd.papermc.io/paper/1.19/",
86+
)
87+
}
88+
}
89+
90+
publishData {
91+
useEldoNexusRepos()
92+
publishComponent("java")
93+
}
94+
95+
publishing {
96+
publications.create<MavenPublication>("maven") {
97+
publishData.configurePublication(this)
98+
pom {
99+
url.set("https://github.com/eldoriarpg/schematicbrushreborn")
100+
developers {
101+
developer {
102+
name.set("Florian Fülling")
103+
url.set("https://github.com/rainbowdashlabs")
104+
organization.set("EldoriaRPG")
105+
organizationUrl.set("https://github.com/eldoriarpg")
106+
}
107+
developer {
108+
name.set("Yannick Lamprecht")
109+
url.set("https://github.com/yannicklamprecht")
110+
}
111+
}
112+
licenses {
113+
license {
114+
name.set("MIT")
115+
url.set("https://github.com/eldoriarpg/bukkit-jackson/blob/main/LICENSE.md")
116+
}
117+
}
118+
}
119+
}
120+
121+
repositories {
122+
maven {
123+
authentication {
124+
credentials(PasswordCredentials::class) {
125+
username = System.getenv("NEXUS_USERNAME")
126+
password = System.getenv("NEXUS_PASSWORD")
127+
}
128+
}
129+
130+
setUrl(publishData.getRepository())
131+
name = "EldoNexus"
132+
}
133+
}
56134
}

create_test_files.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
touch $PWD/src/test/resources/json/$1.json
3+
touch $PWD/src/test/resources/json/$1_list.json
4+
touch $PWD/src/test/resources/yaml/$1.yaml
5+
touch $PWD/src/test/resources/yaml/$1_list.yaml
6+
touch $PWD/src/test/resources/toml/$1.toml
7+
touch $PWD/src/test/resources/toml/$1_list.toml

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ pluginManagement{
55
mavenLocal()
66
gradlePluginPortal()
77
maven("https://eldonexus.de/repository/maven-public/")
8+
maven("https://repo.papermc.io/repository/maven-public/")
89
}
910
}

0 commit comments

Comments
 (0)