Skip to content

Commit 78e8d05

Browse files
committed
Release 2.0.0
1 parent adb530d commit 78e8d05

31 files changed

+435
-446
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
jdk: [ 8, 11, 17 ]
17+
jdk: [ 8, 11, 17, 21 ]
1818
steps:
1919
- uses: actions/checkout@v4
2020
- name: Set up JDK

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish
2+
on:
3+
push:
4+
branches: [ master ]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
environment: deployment
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Set up JDK
14+
uses: actions/setup-java@v4
15+
with:
16+
distribution: 'temurin'
17+
java-version: 21
18+
cache: 'gradle'
19+
20+
- name: Grant execute permission for gradlew
21+
run: chmod +x gradlew
22+
23+
- name: Publish
24+
run: ./gradlew clean build publish
25+
env:
26+
ETERNAL_CODE_MAVEN_USERNAME: ${{ secrets.ETERNAL_CODE_MAVEN_USERNAME }}
27+
ETERNAL_CODE_MAVEN_PASSWORD: ${{ secrets.ETERNAL_CODE_MAVEN_PASSWORD }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Project exclude paths
22
*.gradle/
33
*build/
4-
.idea/
4+
.idea/
5+
run

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ Framework Core
2020
<dependency>
2121
<groupId>dev.rollczi</groupId>
2222
<artifactId>liteskullapi</artifactId>
23-
<version>1.3.0</version>
23+
<version>2.0.0</version>
2424
</dependency>
2525
```
2626
```groovy
27-
implementation 'dev.rollczi:liteskullapi:1.3.0'
27+
implementation("dev.rollczi:liteskullapi:2.0.0")
2828
```
2929
### How use LiteSkullAPI?
3030
```java

build.gradle

Lines changed: 0 additions & 65 deletions
This file was deleted.

build.gradle.kts

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
plugins {
2+
id("java-library")
3+
id("maven-publish")
4+
id("com.github.johnrengelman.shadow") version "8.1.1"
5+
}
6+
7+
group = "dev.rollczi"
8+
version = "2.0.0"
9+
10+
repositories {
11+
mavenCentral()
12+
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
13+
maven("https://maven.enginehub.org/repo/")
14+
}
15+
16+
java {
17+
sourceCompatibility = JavaVersion.VERSION_1_8
18+
targetCompatibility = JavaVersion.VERSION_1_8
19+
}
20+
21+
dependencies {
22+
compileOnly("org.jetbrains:annotations:26.0.2")
23+
compileOnly("org.spigotmc:spigot-api:1.21.4-R0.1-SNAPSHOT")
24+
compileOnly("com.mojang:authlib:1.5.25")
25+
26+
testImplementation("org.awaitility:awaitility:4.3.0")
27+
testImplementation("org.spigotmc:spigot-api:1.21.4-R0.1-SNAPSHOT")
28+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.4")
29+
testImplementation("org.assertj:assertj-core:3.27.3")
30+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.4")
31+
}
32+
33+
publishing {
34+
java {
35+
withSourcesJar()
36+
withJavadocJar()
37+
}
38+
39+
repositories {
40+
mavenLocal()
41+
42+
maven(
43+
name = "eternalcode",
44+
url = "https://repo.eternalcode.pl",
45+
username = "ETERNAL_CODE_MAVEN_USERNAME",
46+
password = "ETERNAL_CODE_MAVEN_PASSWORD",
47+
snapshots = true,
48+
beta = true,
49+
)
50+
}
51+
52+
publications {
53+
create<MavenPublication>("maven") {
54+
artifactId = "liteskullapi"
55+
from(project.components["java"])
56+
}
57+
}
58+
}
59+
60+
fun RepositoryHandler.maven(
61+
name: String,
62+
url: String,
63+
username: String,
64+
password: String,
65+
snapshots: Boolean = true,
66+
beta: Boolean = false
67+
) {
68+
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
69+
70+
if (isSnapshot && !snapshots) {
71+
return
72+
}
73+
74+
val isBeta = version.toString().contains("-BETA")
75+
76+
if (isBeta && !beta) {
77+
return
78+
}
79+
80+
this.maven {
81+
this.name =
82+
if (isSnapshot) "${name}Snapshots"
83+
else "${name}Releases"
84+
85+
this.url =
86+
if (isSnapshot) uri("$url/snapshots")
87+
else uri("$url/releases")
88+
89+
this.credentials {
90+
this.username = System.getenv(username)
91+
this.password = System.getenv(password)
92+
}
93+
}
94+
}
95+
96+
tasks.getByName<Test>("test") {
97+
useJUnitPlatform()
98+
maxParallelForks = Runtime.getRuntime().availableProcessors()
99+
100+
tasks.withType<JavaCompile>().configureEach {
101+
options.isFork = true
102+
options.compilerArgs.add("-parameters")
103+
}
104+
}

example-plugin/build.gradle.kts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,55 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
22

33
plugins {
4-
id("java-library")
4+
id("java")
5+
id("com.gradleup.shadow") version "8.3.6"
56
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
67
id("xyz.jpenilla.run-paper") version "2.3.1"
7-
id("com.github.johnrengelman.shadow")
88
}
99

1010
group = "dev.rollczi"
11-
version = "1.3.0"
11+
version = "2.0.0"
1212

1313
repositories {
1414
mavenCentral()
15-
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
15+
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
16+
}
1617

18+
tasks.withType<JavaCompile> {
19+
options.encoding = "UTF-8"
1720
}
1821

1922
dependencies {
20-
compileOnly("org.spigotmc:spigot-api:1.19.1-R0.1-SNAPSHOT")
23+
compileOnly("org.spigotmc:spigot-api:1.21.4-R0.1-SNAPSHOT")
2124
implementation(rootProject.project)
2225

2326
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.4")
2427
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.4")
2528
}
2629

2730
bukkit {
28-
main = "dev.rollcz.skullplugin.SkullPlugin"
31+
main = "dev.rollczi.skullplugin.SkullPlugin"
2932
apiVersion = "1.13"
3033
author = "Rollczi"
3134
name = "LiteSkullApiTest"
3235
version = "${project.version}"
3336
commands.create("give-skull")
3437
}
3538

36-
tasks.withType<ShadowJar> {
37-
archiveFileName.set("LiteSkullAPIPlugin v${project.version} (MC 1.8.8-1.19x).jar")
38-
39-
exclude("org/intellij/lang/annotations/**","org/jetbrains/annotations/**","org/checkerframework/**","META-INF/**","javax/**")
39+
tasks.runServer {
40+
minecraftVersion("1.21.5")
41+
allJvmArgs = listOf("-DPaper.IgnoreJavaVersion=true")
42+
javaLauncher = javaToolchains.launcherFor {
43+
languageVersion.set(JavaLanguageVersion.of(21))
44+
}
45+
}
4046

41-
mergeServiceFiles()
42-
minimize()
47+
tasks.withType<ShadowJar> {
48+
archiveFileName.set("LiteSkullAPIPlugin v${project.version} (MC 1.8.8-1.21x).jar")
4349

4450
val prefix = "dev.rollczi.skullplugin.libs"
4551
listOf(
46-
"dev.rollczi.liteskullapi",
52+
"dev.rollczi.liteskullapi",
4753
).forEach { pack ->
4854
relocate(pack, "$prefix.$pack")
4955
}
@@ -52,7 +58,3 @@ tasks.withType<ShadowJar> {
5258
tasks.getByName<Test>("test") {
5359
useJUnitPlatform()
5460
}
55-
56-
tasks.withType<JavaCompile> {
57-
options.encoding = "UTF-8"
58-
}

example-plugin/src/main/java/dev/rollczi/skullplugin/SkullCommand.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ public SkullCommand(SkullAPI skullAPI) {
2020

2121
@Override
2222
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
23-
if (!(sender instanceof Player)) {
23+
if (!(sender instanceof Player player)) {
2424
return true;
2525
}
2626

27-
Player player = (Player) sender;
28-
29-
this.skullAPI.acceptSyncSkull(player.getName(), itemStack -> player.getInventory().addItem(itemStack));
30-
27+
String name = args.length > 0 ? args[0] : player.getName();
28+
this.skullAPI.acceptSkull(name, itemStack -> player.getInventory().addItem(itemStack));
3129
return true;
3230
}
3331

gradle/wrapper/gradle-wrapper.jar

122 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)