aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryson Steck <brysonsteck@protonmail.com>2023-05-27 00:22:51 -0600
committerBryson Steck <brysonsteck@protonmail.com>2023-05-27 00:22:51 -0600
commit88802ece0407cbf83ab5dbe50fe694ebfe98f2f3 (patch)
tree87930cfc68f7964f935c1b9102e333f9eda3ba42 /src
parent443a153024551171f431a9f18b41cb8a44d6574f (diff)
downloadServerCraft-88802ece0407cbf83ab5dbe50fe694ebfe98f2f3.tar
ServerCraft-88802ece0407cbf83ab5dbe50fe694ebfe98f2f3.tar.gz
ServerCraft-88802ece0407cbf83ab5dbe50fe694ebfe98f2f3.tar.bz2
create versioning system
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/xyz/brysonsteck/ServerCraft/controllers/InfoController.kt14
-rw-r--r--src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt2
-rw-r--r--src/main/resources/xyz/brysonsteck/ServerCraft/info.fxml2
3 files changed, 14 insertions, 4 deletions
diff --git a/src/main/kotlin/xyz/brysonsteck/ServerCraft/controllers/InfoController.kt b/src/main/kotlin/xyz/brysonsteck/ServerCraft/controllers/InfoController.kt
index dcf77ba..92c6674 100644
--- a/src/main/kotlin/xyz/brysonsteck/ServerCraft/controllers/InfoController.kt
+++ b/src/main/kotlin/xyz/brysonsteck/ServerCraft/controllers/InfoController.kt
@@ -4,12 +4,18 @@ import javafx.fxml.FXML
import javafx.application.Platform
import javafx.scene.Node
import javafx.scene.control.Hyperlink
+import javafx.scene.control.Label
import javafx.stage.Stage
import javafx.event.ActionEvent
import java.awt.Desktop
import java.net.URI
+import java.util.Properties
+import xyz.brysonsteck.ServerCraft.App
class InfoController {
+ @FXML
+ lateinit private var version: Label
+
private val emails = mapOf(
"bryson" to "me@brysonsteck.xyz"
)
@@ -20,6 +26,13 @@ class InfoController {
private val license = "https://www.gnu.org/licenses/gpl-3.0.html"
@FXML
+ public fun initialize() {
+ val props = Properties()
+ props.load(App().javaClass.getResourceAsStream("info.properties"))
+ version.text += props.getProperty("version")
+ }
+
+ @FXML
private fun openHyperlink(e: ActionEvent) {
val link = e.source as Hyperlink
link.isVisited = false
@@ -52,7 +65,6 @@ class InfoController {
}
}
split[0].equals("license") -> {
- println("license")
if (!os.contains("linux")) {
desktop.browse(URI(license))
} else {
diff --git a/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt b/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt
index f538458..14606f6 100644
--- a/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt
+++ b/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt
@@ -54,14 +54,12 @@ class Download: Runnable {
// Make sure response code is in the 200 range.
if (connection.responseCode / 100 != 2) {
- println(connection.responseCode)
status = Status.ERROR
}
// Check for valid content length.
contentLength = connection.getContentLength();
if (contentLength < 1) {
- println(connection.getContentLength())
status = Status.ERROR
}
diff --git a/src/main/resources/xyz/brysonsteck/ServerCraft/info.fxml b/src/main/resources/xyz/brysonsteck/ServerCraft/info.fxml
index a4d561a..d003ba8 100644
--- a/src/main/resources/xyz/brysonsteck/ServerCraft/info.fxml
+++ b/src/main/resources/xyz/brysonsteck/ServerCraft/info.fxml
@@ -27,7 +27,7 @@
<Font name="System Bold" size="28.0" />
</font>
</Label>
- <Label layoutX="146.0" layoutY="82.0" text="Version 1.0" />
+ <Label fx:id="version" layoutX="146.0" layoutY="82.0" text="Version " />
<ButtonBar layoutY="318.0" prefHeight="40.0" prefWidth="398.0">
<buttons>
<Button mnemonicParsing="false" onAction="#closeInfo" text="Close" />