Skip to content

Commit

Permalink
Merge pull request #2 from Jack253-png/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Jack253-png authored Oct 14, 2023
2 parents 4999e63 + 5f1fc72 commit 78070c7
Show file tree
Hide file tree
Showing 56 changed files with 723 additions and 768 deletions.
14 changes: 13 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ plugins {
id 'java'
id 'application'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.9.20-RC'
}

group 'com.mcreater'
Expand Down Expand Up @@ -97,6 +98,7 @@ dependencies {
implementation project(":core")
implementation project(":shell")
annotationProcessor 'org.projectlombok:lombok:1.18.26'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

ext {
Expand All @@ -105,7 +107,7 @@ ext {

application {
mainClassName = javaMainClass
applicationDefaultJvmArgs = ["-Xmx512M"]
applicationDefaultJvmArgs = ["-XX:+UseZGC", "-Xmx1G"]
}

task sourcesJar(type: Jar, dependsOn: classes) {
Expand Down Expand Up @@ -155,4 +157,14 @@ publishing {
}
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
12 changes: 12 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ buildscript {
plugins {
id 'java'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm'
}

group 'com.mcreater'
Expand Down Expand Up @@ -57,6 +58,7 @@ dependencies {
implementation "com.github.oshi:oshi-core:5.8.5"
annotationProcessor 'org.projectlombok:lombok:1.18.26'
implementation('org.nanohttpd:nanohttpd:2.3.1')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

test {
Expand Down Expand Up @@ -109,4 +111,14 @@ publishing {
repositories {
maven { url uri(new File(rootProject.projectDir.getAbsolutePath(), "maven").getAbsolutePath()) }
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
115 changes: 0 additions & 115 deletions core/src/main/java/com/mcreater/amclcore/MetaData.java

This file was deleted.

137 changes: 137 additions & 0 deletions core/src/main/java/com/mcreater/amclcore/MetaData.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package com.mcreater.amclcore

import com.mcreater.amclcore.util.PropertyUtil
import kotlin.math.max

class MetaData {
enum class Channel(val realname: String) {
RELEASE(""),
CANDIDATE("rc"),
BETA("beta"),
ALPHA("alpha")
}

companion object {
/**
* AMCL/AMCLCore azure application id<br></br>
* AMCL/AMCLCore azure 应用ID
*/
const val oauthDefaultClientId = "1a969022-f24f-4492-a91c-6f4a6fcb373c"

/**
* client id override, using command line -Damclcore.oauth.clientid.override=YOUR_CLIENTID<br></br>
* 客户端ID 覆盖, 使用命令行 -Damclcore.oauth.clientid.override=你的客户端ID
*/
const val oauthClientIdOverridePropertyName = "amclcore.oauth.clientid.override"

@JvmStatic
fun getOauthDefaultClientId(): String {
return PropertyUtil.readProperty(oauthClientIdOverridePropertyName, oauthDefaultClientId)
}

/**
* Launcher name<br></br>
* 启动器名字
*/
const val launcherName = "AMCLCore"

/**
* Launcher version<br></br>
* 启动器版本
*/
const val launcherVersion = "0.1"

/**
* Launcher version channel<br></br>
* 启动器版本类型
*/
val launcherBuildChannelRaw = Channel.ALPHA

/**
* Launcher internal version (>= 1)
* 启动器内部版本 (>= 1)
*/
const val launcherBuildInternalVersion = 2

/**
* launcher name override, using command line -Damclcore.name.override=YOUR_LAUNCHERNAME<br></br>
* 启动器名称覆盖,使用命令行 -Damclcore.name.override=你的启动器名称
*/
const val launcherNameOverridePropertyName = "amclcore.name.override"

@JvmStatic
fun getLauncherName(): String {
return PropertyUtil.readProperty(launcherNameOverridePropertyName, launcherName)
}

/**
* launcher version override, using command line -Damclcore.version.override=YOUR_LAUNCHERVERSION<br></br>
* 启动器版本覆盖,使用命令行 -Damclcore.version.override=你的启动器版本
*/
const val launcherVersionOverridePropertyName = "amclcore.version.override"

@JvmStatic
fun getLauncherVersion(): String {
return PropertyUtil.readProperty(launcherVersionOverridePropertyName, launcherVersion)
}

/**
* launcher build channel override, using command line -Damclcore.build.channel=YOUR_LAUNCHERBUILDCHANNEL<br></br>
* 启动器版本类型覆盖,使用命令行 -Damclcore.build.channel=你的启动器版本类型
*/
const val launcherBuildChannelOverridePropertyName = "amclcore.version.build.channel.override"

@JvmStatic
fun getLauncherBuildChannel(): Channel {
return PropertyUtil.readPropertyEnum(
Channel::class.java,
launcherBuildChannelOverridePropertyName,
launcherBuildChannelRaw
)
}

/**
* launcher build interal version override, using command line -Damclcore.build.internal.override=YOUR_LAUNCHERBUILDINTERNALVERSION<br></br>
* 启动器内部构建版本覆盖,使用命令行 -Damclcore.build.internal.override=你的内部构建版本号
*/
const val launcherBuildInternalVersionOverridePropertyName = "amclcore.version.build.internal.override"

@JvmStatic
fun getLauncherBuildInternalVersion(): Int {
return max(
PropertyUtil.readPropertyInteger(
launcherBuildInternalVersionOverridePropertyName,
launcherBuildInternalVersion
).toDouble(), 1.0
)
.toInt()
}

@JvmStatic
fun getLauncherFullVersion(): String {
return if (getLauncherBuildChannel() == Channel.RELEASE) {
getLauncherVersion()
} else String.format(
"%s-%s%d",
getLauncherVersion(),
getLauncherBuildChannel().name,
getLauncherBuildInternalVersion()
)
}

@JvmStatic
fun getLauncherFullName(): String {
return java.lang.String.join(" ", getLauncherName(), getLauncherFullVersion())
}

/**
* ansi enable override, using command line -Damclcore.ansi.override=BOOLEAN<br></br>启用ANSI覆盖, 使用命令行 -Damclcore.ansi.override=BOOLEAN
*/
const val useAnsiOutputOverridePropertyName = "amclcore.ansi.override"

@JvmStatic
fun isUseAnsiOutputOverride(): Boolean {
return PropertyUtil.readPropertyBoolean(useAnsiOutputOverridePropertyName, true)
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.mcreater.amclcore.annotations

@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class ConfigModel

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.mcreater.amclcore.annotations

@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class OAuthLoginModel

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.mcreater.amclcore.annotations

@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class RequestModel
Loading

0 comments on commit 78070c7

Please sign in to comment.