Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'org.jetbrains.kotlin.jvm' version '1.7.0'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'net.kyori.blossom' version '1.2.0'
id 'cl.franciscosolis.blossom-extended' version '1.3.1'
id 'org.jetbrains.dokka' version '1.6.21'
}

Expand Down Expand Up @@ -65,8 +65,6 @@ java {
}

blossom {
replaceTokenIn('src/main/kotlin/xyz/theprogramsrc/simplecoreapi/velocity/VelocityLoader.kt')

replaceToken '@name@', rootProject.name
replaceToken '@version@', project.version.toString()
replaceToken '@description@', project.description
Expand Down Expand Up @@ -136,4 +134,4 @@ publishing {
}
}

publish.dependsOn clean, test, jar, shadowJar
publish.dependsOn clean, test, jar, shadowJar
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package xyz.theprogramsrc.simplecoreapi.global
import xyz.theprogramsrc.simplecoreapi.global.module.ModuleManager
import xyz.theprogramsrc.simplecoreapi.global.utils.ILogger
import xyz.theprogramsrc.simplecoreapi.global.utils.SoftwareType
import xyz.theprogramsrc.simplecoreapi.global.utils.update.GitHubUpdateChecker
import java.util.*

/**
Expand All @@ -26,12 +27,6 @@ class SimpleCoreAPI(logger: ILogger) {
*/
val moduleManager: ModuleManager?

/**
* SimpleCoreAPI Properties
* @return The [Properties] of SimpleCoreAPI
*/
val props: Properties = Properties()

/**
* The [SoftwareType] type running on the server
* @return The [SoftwareType] the server is running
Expand All @@ -40,15 +35,12 @@ class SimpleCoreAPI(logger: ILogger) {

init {
instance = this
val resource = SimpleCoreAPI::class.java.getResource("/simplecoreapi.properties")
if (resource != null) {
props.load(resource.openStream())
}

logger.info("SimpleCoreAPI v${getVersion()} - Git Commit: ${getShortHash()}")
if (getFullHash() != "unknown") {
GitHubUpdateChecker(logger, "TheProgramSrc/SimpleCoreAPI", getVersion()).checkWithPrint()
}

softwareType = SoftwareType.values().firstOrNull { it.check() } ?: SoftwareType.UNKNOWN
if(softwareType != SoftwareType.UNKNOWN && softwareType.display != null) {
logger.info("Running API with software ${softwareType.display}")
Expand All @@ -60,19 +52,19 @@ class SimpleCoreAPI(logger: ILogger) {
* Gets the short version of the commit hash
* @return The short commit hash
*/
fun getShortHash(): String = props.getProperty("git-short", "unknown")
fun getShortHash(): String = "@git_short@"

/**
* Gets the full version of the commit hash
* @return The full commit hash
*/
fun getFullHash(): String = props.getProperty("git-full", "unknown")
fun getFullHash(): String = "@git_full@"

/**
* Gets the version of SimpleCoreAPI
* @return The version of SimpleCoreAPI
*/
fun getVersion(): String = props.getProperty("version", "unknown")
fun getVersion(): String = "@version@"

/**
* Checks if the current [SoftwareType] is the one specified
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package xyz.theprogramsrc.simplecoreapi.global.module

import org.apache.commons.io.FileUtils
import xyz.theprogramsrc.simplecoreapi.global.GitHubUpdateChecker
import xyz.theprogramsrc.simplecoreapi.global.exceptions.*
import xyz.theprogramsrc.simplecoreapi.global.utils.ILogger
import xyz.theprogramsrc.simplecoreapi.global.utils.update.GitHubUpdateChecker
import java.io.File
import java.io.FileInputStream
import java.io.IOException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.theprogramsrc.simplecoreapi.global
package xyz.theprogramsrc.simplecoreapi.global.utils.update

import com.google.gson.JsonObject
import com.google.gson.JsonParser
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/simplecoreapi.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package xyz.theprogramsrc.simplecoreapi.global

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import xyz.theprogramsrc.simplecoreapi.global.utils.update.GitHubUpdateChecker
import xyz.theprogramsrc.simplecoreapi.global.utils.logger.JavaLogger
import xyz.theprogramsrc.simplecoreapi.global.utils.logger.SLF4JLogger
import java.util.logging.Logger
Expand All @@ -20,4 +21,4 @@ internal class GitHubUpdateCheckerTest {
fun updatesAvailableTest() {
assertEquals(true, check2.checkForUpdates())
}
}
}