Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit bebd700

Browse files
authored
GH-22 Release 1.3.0 update.
1 parent 6d9e904 commit bebd700

50 files changed

Lines changed: 1034 additions & 561 deletions

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
name: 'DeathRun Build'
22
on:
33
push:
4-
branches: [ "ver/latest" ]
54
pull_request:
6-
branches: [ "ver/latest" ]
75
jobs:
86
build:
9-
runs-on: ubuntu-latest
7+
runs-on: 'ubuntu-latest'
108
steps:
119
- name: 'Checkout'
1210
uses: 'actions/checkout@v3'
1311
- name: 'Install Java Development Kit (17)'
14-
uses: actions/setup-java@v3
12+
uses: 'actions/setup-java@v3'
1513
with:
1614
java-version: '17'
1715
distribution: 'temurin'
18-
cache: maven
19-
- name: 'Build (Maven)'
20-
run: 'mvn clean package'
21-
- name: Upload (API)
22-
uses: actions/upload-artifact@v3
16+
- name: 'Assign Permissions'
17+
run: 'chmod +x ./gradlew'
18+
- name: 'Build (Gradle)'
19+
run: './gradlew core:build'
20+
- name: 'Upload (API)'
21+
uses: 'actions/upload-artifact@v3'
2322
with:
2423
name: 'DeathRun (API)'
25-
path: 'api/target/*.jar'
26-
- name: Upload (Core)
27-
uses: actions/upload-artifact@v3
24+
path: 'api/build/libs/*.jar'
25+
- name: 'Upload (Core)'
26+
uses: 'actions/upload-artifact@v3'
2827
with:
2928
name: 'DeathRun (Core)'
30-
path: 'core/target/*.jar'
29+
path: 'core/build/libs/*.jar'

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.iml
22
**/*.iml
33
.idea/**
4-
target/**
5-
**/target/**
4+
**/build/
5+
**/.gradle/
6+
**.jar

api/build.gradle.kts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import com.palantir.gradle.gitversion.VersionDetails
2+
import groovy.lang.Closure
3+
import java.lang.String.format
4+
import java.lang.String.valueOf
5+
6+
plugins {
7+
id("java")
8+
id("net.kyori.blossom") version "1.3.1"
9+
id("com.palantir.git-version") version "3.0.0"
10+
id("com.github.johnrengelman.shadow") version "8.1.1"
11+
}
12+
13+
val versionDetails: Closure<VersionDetails> by extra
14+
fun projectVersion(): String = if (versionDetails().branchName == "ver/latest")
15+
valueOf(project.version) else format("%s (git/%s)", project.version, versionDetails().gitHash)
16+
17+
project.group = project.parent?.group!!
18+
project.version = project.parent?.version!!
19+
20+
java {
21+
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
22+
}
23+
24+
blossom {
25+
replaceToken("{version}", projectVersion())
26+
replaceToken("{gitBranch}", versionDetails().branchName)
27+
replaceToken("{gitCommitHash}", versionDetails().gitHashFull)
28+
}
29+
30+
repositories {
31+
mavenCentral()
32+
maven("https://repo.papermc.io/repository/maven-public/")
33+
}
34+
35+
dependencies {
36+
37+
/* Minecraft */
38+
compileOnly("com.destroystokyo.paper:paper-api:${project.parent?.property("minecraft.version")}")
39+
40+
/* JetBrains Annotations */
41+
compileOnly("org.jetbrains:annotations:${project.parent?.property("jetbrains.annotations.version")}")
42+
annotationProcessor("org.jetbrains:annotations:${project.parent?.property("jetbrains.annotations.version")}")
43+
44+
}
45+
46+
tasks {
47+
48+
withType<JavaCompile> {
49+
options.encoding = "UTF-8"
50+
}
51+
52+
shadowJar {
53+
archiveFileName.set("${project.parent?.name}-${project.name}-${project.version}.jar")
54+
}
55+
56+
build {
57+
finalizedBy("finalize")
58+
}
59+
60+
register("finalize") {
61+
doLast {
62+
file("build/libs/${project.name}-${project.version}.jar").delete()
63+
}
64+
}
65+
66+
}

api/pom.xml

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,82 @@
11
package pl.mrstudios.deathrun.api;
22

3-
import org.bukkit.plugin.PluginDescriptionFile;
43
import org.jetbrains.annotations.NotNull;
4+
import org.jetbrains.annotations.Nullable;
55
import pl.mrstudios.deathrun.api.arena.IArena;
66
import pl.mrstudios.deathrun.api.arena.trap.ITrapRegistry;
77

8-
public class API {
8+
import static com.google.common.base.Preconditions.checkArgument;
9+
import static com.google.common.base.Preconditions.checkNotNull;
10+
import static org.jetbrains.annotations.ApiStatus.Internal;
11+
import static org.jetbrains.annotations.ApiStatus.ScheduledForRemoval;
912

10-
private final @NotNull IArena arena;
11-
private final @NotNull ITrapRegistry trapRegistry;
13+
public record API(
14+
@NotNull IArena arenaInstance,
15+
@NotNull ITrapRegistry trapRegistryInstance
16+
) {
1217

13-
private final @NotNull String version;
18+
@Deprecated(
19+
forRemoval = true,
20+
since = "1.3.0"
21+
)
22+
@ScheduledForRemoval(inVersion = "1.4.0")
23+
public @NotNull IArena getArena() {
24+
return this.arenaInstance();
25+
}
1426

15-
public API(
16-
@NotNull IArena arena,
17-
@NotNull ITrapRegistry trapRegistry,
18-
@NotNull PluginDescriptionFile pluginDescriptionFile
19-
) {
27+
@Deprecated(
28+
forRemoval = true,
29+
since = "1.3.0"
30+
)
31+
@ScheduledForRemoval(inVersion = "1.4.0")
32+
public @NotNull ITrapRegistry getTrapRegistry() {
33+
return this.trapRegistryInstance();
34+
}
2035

21-
setInstance(this);
36+
@Deprecated(
37+
forRemoval = true,
38+
since = "1.3.0"
39+
)
40+
@ScheduledForRemoval(inVersion = "1.4.0")
41+
public @NotNull String getVersion() {
42+
return pluginVersion();
43+
}
2244

23-
this.arena = arena;
24-
this.trapRegistry = trapRegistry;
25-
this.version = pluginDescriptionFile.getVersion();
45+
@Deprecated(
46+
forRemoval = true,
47+
since = "1.3.0"
48+
)
49+
@ScheduledForRemoval(inVersion = "1.4.0")
50+
public static @Nullable API instance;
2651

52+
/* Version Related */
53+
public @NotNull String pluginVersion() {
54+
return "{version}";
2755
}
2856

29-
public @NotNull IArena getArena() {
30-
return arena;
57+
public @NotNull String pluginGitBranch() {
58+
return "{gitBranch}";
3159
}
3260

33-
public @NotNull ITrapRegistry getTrapRegistry() {
34-
return trapRegistry;
61+
public @NotNull String pluginGitCommit() {
62+
return "{gitCommitHash}";
3563
}
3664

37-
public @NotNull String getVersion() {
38-
return version;
65+
/* Static Methods */
66+
public static @NotNull API apiInstance() {
67+
return checkNotNull(instance, "Instance of API is not initialized yet!");
3968
}
4069

41-
public static @NotNull API instance;
42-
43-
protected static void setInstance(@NotNull API api) {
44-
instance = api;
70+
@Internal
71+
public static void createInstance(
72+
@NotNull IArena arenaInstance,
73+
@NotNull ITrapRegistry trapRegistryInstance
74+
) {
75+
checkArgument(instance == null, "Instance of API is already initialized!");
76+
instance = new API(
77+
arenaInstance,
78+
trapRegistryInstance
79+
);
4580
}
4681

4782
}

api/src/main/java/pl/mrstudios/deathrun/api/arena/booster/IBooster.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
public interface IBooster {
99

10-
int slot();
11-
float power();
12-
int delay();
10+
@NotNull Integer slot();
11+
@NotNull Float power();
12+
@NotNull Integer delay();
1313
@NotNull IBoosterItem item();
1414
@NotNull IBoosterItem delayItem();
1515
@NotNull Direction direction();

api/src/main/java/pl/mrstudios/deathrun/api/arena/checkpoint/ICheckpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public interface ICheckpoint {
99

10-
int id();
10+
@NotNull Integer id();
1111
@NotNull Location spawn();
1212
@NotNull List<Location> locations();
1313

api/src/main/java/pl/mrstudios/deathrun/api/arena/trap/ITrapRegistry.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,24 @@
33
import org.jetbrains.annotations.NotNull;
44
import org.jetbrains.annotations.Nullable;
55

6+
import java.util.Collection;
67
import java.util.Set;
78

9+
import static org.jetbrains.annotations.ApiStatus.ScheduledForRemoval;
10+
811
public interface ITrapRegistry {
912

1013
@Nullable Class<? extends ITrap> get(@NotNull String identifier);
1114

1215
void register(@NotNull Class<? extends ITrap> trapClass);
13-
1416
void register(@NotNull String identifier, @NotNull Class<? extends ITrap> trapClass);
1517

18+
@Deprecated(
19+
since = "1.3.0",
20+
forRemoval = true
21+
) @ScheduledForRemoval(inVersion = "1.4.0")
1622
@NotNull Set<String> list();
1723

24+
@NotNull Collection<String> trapRegistryKeys();
25+
1826
}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package pl.mrstudios.deathrun.api.arena.trap.annotations;
22

3-
import java.lang.annotation.ElementType;
43
import java.lang.annotation.Retention;
5-
import java.lang.annotation.RetentionPolicy;
64
import java.lang.annotation.Target;
75

8-
@Target(ElementType.FIELD)
9-
@Retention(RetentionPolicy.RUNTIME)
6+
import static java.lang.annotation.ElementType.FIELD;
7+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
8+
9+
@Target(FIELD)
10+
@Retention(RUNTIME)
1011
public @interface Serializable {}

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
project.group = "pl.mrstudios.deathrun"
2+
project.version = "1.3.0"

0 commit comments

Comments
 (0)