aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/kotlin/xyz/brysonsteck/serverfordummies/App.kt2
-rw-r--r--app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt48
-rw-r--r--app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/PrimaryController.kt (renamed from app/src/main/kotlin/xyz/brysonsteck/serverfordummies/PrimaryController.kt)22
-rw-r--r--app/src/main/kotlin/xyz/brysonsteck/serverfordummies/server/Download.kt (renamed from app/src/main/kotlin/xyz/brysonsteck/serverfordummies/Download.kt)2
-rw-r--r--app/src/main/resources/xyz/brysonsteck/serverfordummies/app-256x256.pngbin74811 -> 0 bytes
-rw-r--r--app/src/main/resources/xyz/brysonsteck/serverfordummies/app.pngbin598693 -> 75026 bytes
-rw-r--r--app/src/main/resources/xyz/brysonsteck/serverfordummies/info.fxml6
-rw-r--r--app/src/main/resources/xyz/brysonsteck/serverfordummies/primary.fxml2
8 files changed, 53 insertions, 29 deletions
diff --git a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/App.kt b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/App.kt
index 0a3cab9..3ff7c46 100644
--- a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/App.kt
+++ b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/App.kt
@@ -15,7 +15,7 @@ class App : Application() {
override fun start(stage: Stage) {
var scene = Scene(loadFXML("primary"), 963.0, 713.0)
- stage.icons.add(Image(this.javaClass.getResourceAsStream("app-256x256.png")))
+ stage.icons.add(Image(this.javaClass.getResourceAsStream("app.png")))
stage.setResizable(false)
stage.title = "Server For Dummies"
stage.scene = scene
diff --git a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt
index 5f98c83..a0b7915 100644
--- a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt
+++ b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt
@@ -23,38 +23,46 @@ class InfoController {
private fun openHyperlink(e: ActionEvent) {
val link = e.source as Hyperlink
link.isVisited = false
- val split = link.id.split('_')
+ val split = link.id.split('_').toMutableList()
+ split.add("")
+ val os = System.getProperty("os.name").lowercase()
val desktop = Desktop.getDesktop()
- if (desktop.isSupported(Desktop.Action.BROWSE)) {
- println("hi")
- try {
- when {
- split[1].equals("email") -> {
- println("email")
- desktop.browse(URI("mailto:" + websites[split[0]]))
+ try {
+ when {
+ split[1].equals("email") -> {
+ if (!os.contains("linux")) {
+ desktop.browse(URI("mailto:" + emails[split[0]]))
+ } else {
+ Runtime.getRuntime().exec("xdg-open mailto:" + emails[split[0]])
}
- split[1].equals("website") -> {
- println("website")
+ }
+ split[1].equals("website") -> {
+ if (!os.contains("linux")) {
desktop.browse(URI(websites[split[0]]))
+ } else {
+ Runtime.getRuntime().exec("xdg-open " + websites[split[0]])
}
- split[0].equals("source") -> {
- println("source")
+ }
+ split[0].equals("source") -> {
+ if (!os.contains("linux")) {
desktop.browse(URI(source))
+ } else {
+ Runtime.getRuntime().exec("xdg-open " + source)
}
- split[0].equals("license") -> {
- println("license")
+ }
+ split[0].equals("license") -> {
+ println("license")
+ if (!os.contains("linux")) {
desktop.browse(URI(license))
- }
- else -> {
- println("unknown")
+ } else {
+ Runtime.getRuntime().exec("xdg-open " + license)
}
}
- } catch (e: Exception) {
- println(e)
}
+ } catch (e: Exception) {
+ println(e)
}
- println("done")
}
@FXML
diff --git a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/PrimaryController.kt b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/PrimaryController.kt
index f5eab39..81a860e 100644
--- a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/PrimaryController.kt
+++ b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/PrimaryController.kt
@@ -1,4 +1,4 @@
-package xyz.brysonsteck.serverfordummies
+package xyz.brysonsteck.serverfordummies.controllers
import kotlinx.coroutines.*
import kotlinx.coroutines.javafx.JavaFx
@@ -52,8 +52,8 @@ import javafx.stage.Stage
import javafx.event.EventHandler
import org.rauschig.jarchivelib.*
-import Download
import xyz.brysonsteck.serverfordummies.server.Server
+import xyz.brysonsteck.serverfordummies.server.Download
import xyz.brysonsteck.serverfordummies.App
class PrimaryController {
@@ -218,7 +218,7 @@ class PrimaryController {
private fun onInfo() {
val stage = Stage()
val scene = Scene(FXMLLoader(App().javaClass.getResource("info.fxml")).load(), 398.0, 358.0)
- stage.icons.add(Image(App().javaClass.getResourceAsStream("app-256x256.png")))
+ stage.icons.add(Image(App().javaClass.getResourceAsStream("app.png")))
stage.setResizable(false)
stage.initModality(Modality.APPLICATION_MODAL);
stage.title = "About ServerCraft"
@@ -400,6 +400,10 @@ class PrimaryController {
var line = br.readLine()
while (line != null) {
if (asyncResult) {
+ withContext(Dispatchers.JavaFx) {
+ statusBar.text = "Killing Minecraft server..."
+ startButton.isDisable = true
+ }
proc.destroy()
}
println(line);
@@ -420,6 +424,7 @@ class PrimaryController {
parentPane.isDisable = false
buildButton.isDisable = false
defaultsButton.isDisable = false
+ startButton.isDisable = false
startButton.text = "Start Server"
started = false
}
@@ -430,6 +435,7 @@ class PrimaryController {
var result = false
val resources = App().javaClass.getResource("icons/warning.png")
val dialog = Stage()
+ dialog.icons.add(Image(this.javaClass.getResourceAsStream("app.png")))
dialog.setResizable(false)
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.title = directory
@@ -467,12 +473,19 @@ class PrimaryController {
eula.onMouseClicked = EventHandler<MouseEvent>() {
val desktop = Desktop.getDesktop()
if (desktop.isSupported(Desktop.Action.BROWSE)) {
- println("made it!")
+ // most likely running on Windows or macOS
try {
desktop.browse(URI("https://account.mojang.com/documents/minecraft_eula"))
} catch (e: Exception) {
println(e)
}
+ } else {
+ // assume running on linux
+ try {
+ Runtime.getRuntime().exec("xdg-open https://account.mojang.com/documents/minecraft_eula");
+ } catch (e: Exception) {
+ println(e)
+ }
}
}
ButtonBar.setButtonData(eula, ButtonBar.ButtonData.LEFT)
@@ -491,6 +504,7 @@ class PrimaryController {
var result = false
val resources = App().javaClass.getResource("icons/$type.png")
val dialog = Stage()
+ dialog.icons.add(Image(this.javaClass.getResourceAsStream("app.png")))
dialog.setResizable(false)
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.title = directory
diff --git a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/Download.kt b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/server/Download.kt
index b98b511..d7e5aed 100644
--- a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/Download.kt
+++ b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/server/Download.kt
@@ -1,3 +1,5 @@
+package xyz.brysonsteck.serverfordummies.server
+
import java.io.*;
import java.net.*;
import java.util.*;
diff --git a/app/src/main/resources/xyz/brysonsteck/serverfordummies/app-256x256.png b/app/src/main/resources/xyz/brysonsteck/serverfordummies/app-256x256.png
deleted file mode 100644
index a21cb9b..0000000
--- a/app/src/main/resources/xyz/brysonsteck/serverfordummies/app-256x256.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/resources/xyz/brysonsteck/serverfordummies/app.png b/app/src/main/resources/xyz/brysonsteck/serverfordummies/app.png
index 342258e..ceb633a 100644
--- a/app/src/main/resources/xyz/brysonsteck/serverfordummies/app.png
+++ b/app/src/main/resources/xyz/brysonsteck/serverfordummies/app.png
Binary files differ
diff --git a/app/src/main/resources/xyz/brysonsteck/serverfordummies/info.fxml b/app/src/main/resources/xyz/brysonsteck/serverfordummies/info.fxml
index 4c82385..1457d46 100644
--- a/app/src/main/resources/xyz/brysonsteck/serverfordummies/info.fxml
+++ b/app/src/main/resources/xyz/brysonsteck/serverfordummies/info.fxml
@@ -48,8 +48,8 @@
<Insets bottom="13.0" left="13.0" right="13.0" top="13.0" />
</padding>
</Label>
- <Hyperlink fx:id="license" layoutX="127.0" layoutY="101.0" onAction="#openHyperlink" text="License" />
- <Hyperlink fx:id="source" layoutX="189.0" layoutY="101.0" onAction="#openHyperlink" text="Source Code" />
+ <Hyperlink fx:id="license" layoutX="127.0" layoutY="110.0" onAction="#openHyperlink" text="License" />
+ <Hyperlink fx:id="source" layoutX="189.0" layoutY="110.0" onAction="#openHyperlink" text="Source Code" />
</children>
<padding>
<Insets bottom="13.0" left="13.0" right="13.0" top="13.0" />
@@ -61,7 +61,7 @@
<content>
<Pane prefHeight="200.0" prefWidth="200.0">
<children>
- <Label layoutX="107.0" layoutY="101.0" text="Want to join the list? Contribute!" textAlignment="CENTER" />
+ <Label layoutX="78.0" layoutY="109.0" text="Want to join the list? Contribute with a PR!" textAlignment="CENTER" />
<VBox>
<children>
<Label text="Bryson Steck" VBox.vgrow="ALWAYS">
diff --git a/app/src/main/resources/xyz/brysonsteck/serverfordummies/primary.fxml b/app/src/main/resources/xyz/brysonsteck/serverfordummies/primary.fxml
index 43ee1a0..2cedc4f 100644
--- a/app/src/main/resources/xyz/brysonsteck/serverfordummies/primary.fxml
+++ b/app/src/main/resources/xyz/brysonsteck/serverfordummies/primary.fxml
@@ -20,7 +20,7 @@
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
-<Pane fx:id="primary" maxHeight="713.0" maxWidth="963.0" minHeight="713.0" minWidth="963.0" prefHeight="713.0" prefWidth="963.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="xyz.brysonsteck.serverfordummies.PrimaryController">
+<Pane fx:id="primary" maxHeight="713.0" maxWidth="963.0" minHeight="713.0" minWidth="963.0" prefHeight="713.0" prefWidth="963.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="xyz.brysonsteck.serverfordummies.controllers.PrimaryController">
<children>
<HBox fx:id="directoryPane" prefHeight="39.0" prefWidth="963.0">
<children>