-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
1,034 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
name: 'DeathRun Build' | ||
on: | ||
push: | ||
branches: [ "ver/latest" ] | ||
pull_request: | ||
branches: [ "ver/latest" ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- name: 'Checkout' | ||
uses: 'actions/checkout@v3' | ||
- name: 'Install Java Development Kit (17)' | ||
uses: actions/setup-java@v3 | ||
uses: 'actions/setup-java@v3' | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: 'Build (Maven)' | ||
run: 'mvn clean package' | ||
- name: Upload (API) | ||
uses: actions/upload-artifact@v3 | ||
- name: 'Assign Permissions' | ||
run: 'chmod +x ./gradlew' | ||
- name: 'Build (Gradle)' | ||
run: './gradlew core:build' | ||
- name: 'Upload (API)' | ||
uses: 'actions/upload-artifact@v3' | ||
with: | ||
name: 'DeathRun (API)' | ||
path: 'api/target/*.jar' | ||
- name: Upload (Core) | ||
uses: actions/upload-artifact@v3 | ||
path: 'api/build/libs/*.jar' | ||
- name: 'Upload (Core)' | ||
uses: 'actions/upload-artifact@v3' | ||
with: | ||
name: 'DeathRun (Core)' | ||
path: 'core/target/*.jar' | ||
path: 'core/build/libs/*.jar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
*.iml | ||
**/*.iml | ||
.idea/** | ||
target/** | ||
**/target/** | ||
**/build/ | ||
**/.gradle/ | ||
**.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import com.palantir.gradle.gitversion.VersionDetails | ||
import groovy.lang.Closure | ||
import java.lang.String.format | ||
import java.lang.String.valueOf | ||
|
||
plugins { | ||
id("java") | ||
id("net.kyori.blossom") version "1.3.1" | ||
id("com.palantir.git-version") version "3.0.0" | ||
id("com.github.johnrengelman.shadow") version "8.1.1" | ||
} | ||
|
||
val versionDetails: Closure<VersionDetails> by extra | ||
fun projectVersion(): String = if (versionDetails().branchName == "ver/latest") | ||
valueOf(project.version) else format("%s (git/%s)", project.version, versionDetails().gitHash) | ||
|
||
project.group = project.parent?.group!! | ||
project.version = project.parent?.version!! | ||
|
||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(17)) | ||
} | ||
|
||
blossom { | ||
replaceToken("{version}", projectVersion()) | ||
replaceToken("{gitBranch}", versionDetails().branchName) | ||
replaceToken("{gitCommitHash}", versionDetails().gitHashFull) | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven("https://repo.papermc.io/repository/maven-public/") | ||
} | ||
|
||
dependencies { | ||
|
||
/* Minecraft */ | ||
compileOnly("com.destroystokyo.paper:paper-api:${project.parent?.property("minecraft.version")}") | ||
|
||
/* JetBrains Annotations */ | ||
compileOnly("org.jetbrains:annotations:${project.parent?.property("jetbrains.annotations.version")}") | ||
annotationProcessor("org.jetbrains:annotations:${project.parent?.property("jetbrains.annotations.version")}") | ||
|
||
} | ||
|
||
tasks { | ||
|
||
withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
shadowJar { | ||
archiveFileName.set("${project.parent?.name}-${project.name}-${project.version}.jar") | ||
} | ||
|
||
build { | ||
finalizedBy("finalize") | ||
} | ||
|
||
register("finalize") { | ||
doLast { | ||
file("build/libs/${project.name}-${project.version}.jar").delete() | ||
} | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,82 @@ | ||
package pl.mrstudios.deathrun.api; | ||
|
||
import org.bukkit.plugin.PluginDescriptionFile; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import pl.mrstudios.deathrun.api.arena.IArena; | ||
import pl.mrstudios.deathrun.api.arena.trap.ITrapRegistry; | ||
|
||
public class API { | ||
import static com.google.common.base.Preconditions.checkArgument; | ||
import static com.google.common.base.Preconditions.checkNotNull; | ||
import static org.jetbrains.annotations.ApiStatus.Internal; | ||
import static org.jetbrains.annotations.ApiStatus.ScheduledForRemoval; | ||
|
||
private final @NotNull IArena arena; | ||
private final @NotNull ITrapRegistry trapRegistry; | ||
public record API( | ||
@NotNull IArena arenaInstance, | ||
@NotNull ITrapRegistry trapRegistryInstance | ||
) { | ||
|
||
private final @NotNull String version; | ||
@Deprecated( | ||
forRemoval = true, | ||
since = "1.3.0" | ||
) | ||
@ScheduledForRemoval(inVersion = "1.4.0") | ||
public @NotNull IArena getArena() { | ||
return this.arenaInstance(); | ||
} | ||
|
||
public API( | ||
@NotNull IArena arena, | ||
@NotNull ITrapRegistry trapRegistry, | ||
@NotNull PluginDescriptionFile pluginDescriptionFile | ||
) { | ||
@Deprecated( | ||
forRemoval = true, | ||
since = "1.3.0" | ||
) | ||
@ScheduledForRemoval(inVersion = "1.4.0") | ||
public @NotNull ITrapRegistry getTrapRegistry() { | ||
return this.trapRegistryInstance(); | ||
} | ||
|
||
setInstance(this); | ||
@Deprecated( | ||
forRemoval = true, | ||
since = "1.3.0" | ||
) | ||
@ScheduledForRemoval(inVersion = "1.4.0") | ||
public @NotNull String getVersion() { | ||
return pluginVersion(); | ||
} | ||
|
||
this.arena = arena; | ||
this.trapRegistry = trapRegistry; | ||
this.version = pluginDescriptionFile.getVersion(); | ||
@Deprecated( | ||
forRemoval = true, | ||
since = "1.3.0" | ||
) | ||
@ScheduledForRemoval(inVersion = "1.4.0") | ||
public static @Nullable API instance; | ||
|
||
/* Version Related */ | ||
public @NotNull String pluginVersion() { | ||
return "{version}"; | ||
} | ||
|
||
public @NotNull IArena getArena() { | ||
return arena; | ||
public @NotNull String pluginGitBranch() { | ||
return "{gitBranch}"; | ||
} | ||
|
||
public @NotNull ITrapRegistry getTrapRegistry() { | ||
return trapRegistry; | ||
public @NotNull String pluginGitCommit() { | ||
return "{gitCommitHash}"; | ||
} | ||
|
||
public @NotNull String getVersion() { | ||
return version; | ||
/* Static Methods */ | ||
public static @NotNull API apiInstance() { | ||
return checkNotNull(instance, "Instance of API is not initialized yet!"); | ||
} | ||
|
||
public static @NotNull API instance; | ||
|
||
protected static void setInstance(@NotNull API api) { | ||
instance = api; | ||
@Internal | ||
public static void createInstance( | ||
@NotNull IArena arenaInstance, | ||
@NotNull ITrapRegistry trapRegistryInstance | ||
) { | ||
checkArgument(instance == null, "Instance of API is already initialized!"); | ||
instance = new API( | ||
arenaInstance, | ||
trapRegistryInstance | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
api/src/main/java/pl/mrstudios/deathrun/api/arena/trap/annotations/Serializable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
package pl.mrstudios.deathrun.api.arena.trap.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.FIELD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@Target(FIELD) | ||
@Retention(RUNTIME) | ||
public @interface Serializable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
project.group = "pl.mrstudios.deathrun" | ||
project.version = "1.3.0" |
Oops, something went wrong.