window resizing works, need to refine further

This commit is contained in:
Bryson Steck 2025-02-17 14:37:14 -07:00
parent 9a16ada0f6
commit e674df1cd3
13 changed files with 721 additions and 710 deletions

View file

@ -1,19 +1,20 @@
package xyz.brysonsteck.ServerCraft package xyz.brysonsteck.ServerCraft
import javafx.application.Application; import javafx.application.Application
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader
import javafx.scene.Parent; import javafx.scene.Parent
import javafx.scene.Scene; import javafx.scene.Scene
import javafx.scene.image.Image import javafx.scene.image.Image
import javafx.stage.Stage; import javafx.stage.Stage
import java.awt.Desktop;
class App : Application() { class App : Application() {
override fun start(stage: Stage) { override fun start(stage: Stage) {
var scene = Scene(loadFXML("primary"), 963.0, 713.0) var scene = Scene(loadFXML("primary"), 963.0, 713.0)
// Application.setUserAgentStylesheet(CupertinoLight().getUserAgentStylesheet())
scene.stylesheets.add(this.javaClass.getResource("css/style.css").toExternalForm())
stage.icons.add(Image(this.javaClass.getResourceAsStream("app.png"))) stage.icons.add(Image(this.javaClass.getResourceAsStream("app.png")))
stage.setResizable(false) stage.setResizable(true)
stage.title = "ServerCraft" stage.title = "ServerCraft"
stage.scene = scene stage.scene = scene
stage.show() stage.show()
@ -27,5 +28,4 @@ class App : Application() {
public fun run() { public fun run() {
launch() launch()
} }
} }

View file

@ -1,27 +1,21 @@
package xyz.brysonsteck.ServerCraft.controllers package xyz.brysonsteck.ServerCraft.controllers
import java.awt.Desktop
import java.net.URI
import java.util.Properties
import javafx.event.ActionEvent
import javafx.fxml.FXML import javafx.fxml.FXML
import javafx.application.Platform
import javafx.scene.Node import javafx.scene.Node
import javafx.scene.control.Hyperlink import javafx.scene.control.Hyperlink
import javafx.scene.control.Label import javafx.scene.control.Label
import javafx.stage.Stage 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 import xyz.brysonsteck.ServerCraft.App
class InfoController { class InfoController {
@FXML @FXML lateinit private var version: Label
lateinit private var version: Label
private val emails = mapOf( private val emails = mapOf("bryson" to "me@brysonsteck.xyz")
"bryson" to "me@brysonsteck.xyz" private val websites = mapOf("bryson" to "https://brysonsteck.xyz")
)
private val websites = mapOf(
"bryson" to "https://brysonsteck.xyz"
)
private val source = "https://codeberg.org/brysonsteck/ServerCraft" private val source = "https://codeberg.org/brysonsteck/ServerCraft"
private val license = "https://www.gnu.org/licenses/gpl-3.0.html" private val license = "https://www.gnu.org/licenses/gpl-3.0.html"
@ -81,6 +75,6 @@ class InfoController {
private fun closeInfo(e: ActionEvent) { private fun closeInfo(e: ActionEvent) {
val source = e.getSource() as Node val source = e.getSource() as Node
val stage = source.getScene().getWindow() as Stage val stage = source.getScene().getWindow() as Stage
stage.close(); stage.close()
} }
} }

View file

@ -1,136 +1,76 @@
package xyz.brysonsteck.ServerCraft.controllers package xyz.brysonsteck.ServerCraft.controllers
import kotlinx.coroutines.*
import kotlinx.coroutines.javafx.JavaFx
import org.rauschig.jarchivelib.*
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.io.BufferedReader
import java.io.InputStreamReader import java.io.InputStreamReader
import java.awt.Checkbox
import java.awt.Desktop
import java.util.Properties
import java.net.URL import java.net.URL
import java.net.URI
import javafx.beans.value.ChangeListener
import javafx.beans.value.ObservableValue
import javafx.concurrent.Task
import javafx.beans.property.BooleanProperty
import javafx.collections.FXCollections import javafx.collections.FXCollections
import javafx.event.ActionEvent
import javafx.fxml.FXML import javafx.fxml.FXML
import javafx.fxml.FXMLLoader import javafx.fxml.FXMLLoader
import javafx.geometry.Insets import javafx.scene.Scene
import javafx.scene.control.Button import javafx.scene.control.Button
import javafx.scene.control.ChoiceBox
import javafx.scene.control.Label
import javafx.scene.control.TextField
import javafx.scene.control.Spinner
import javafx.scene.control.TitledPane
import javafx.scene.control.ButtonBar import javafx.scene.control.ButtonBar
import javafx.scene.control.CheckBox import javafx.scene.control.CheckBox
import javafx.scene.control.ChoiceBox
import javafx.scene.control.Label
import javafx.scene.control.ProgressBar import javafx.scene.control.ProgressBar
import javafx.scene.control.Hyperlink
import javafx.scene.control.ScrollPane import javafx.scene.control.ScrollPane
import javafx.scene.layout.Border import javafx.scene.control.Spinner
import javafx.scene.layout.BorderStroke import javafx.scene.control.TextField
import javafx.scene.layout.GridPane
import javafx.scene.layout.Pane
import javafx.scene.layout.HBox
import javafx.scene.layout.VBox
import javafx.scene.text.TextAlignment
import javafx.scene.text.Text
import javafx.scene.Scene
import javafx.scene.input.MouseEvent
import javafx.scene.image.Image import javafx.scene.image.Image
import javafx.scene.image.ImageView import javafx.scene.image.ImageView
import javafx.stage.FileChooser import javafx.scene.layout.HBox
import javafx.stage.FileChooser.ExtensionFilter import javafx.scene.layout.Pane
import javafx.stage.DirectoryChooser import javafx.stage.DirectoryChooser
import javafx.stage.Modality import javafx.stage.Modality
import javafx.stage.Stage import javafx.stage.Stage
import javafx.event.EventHandler import kotlinx.coroutines.*
import javafx.event.ActionEvent import kotlinx.coroutines.javafx.JavaFx
import org.rauschig.jarchivelib.* import org.rauschig.jarchivelib.*
import xyz.brysonsteck.ServerCraft.server.Server
import xyz.brysonsteck.ServerCraft.server.Download
import xyz.brysonsteck.ServerCraft.App import xyz.brysonsteck.ServerCraft.App
import xyz.brysonsteck.ServerCraft.dialogs.Dialog
import xyz.brysonsteck.ServerCraft.dialogs.CommonDialog import xyz.brysonsteck.ServerCraft.dialogs.CommonDialog
import xyz.brysonsteck.ServerCraft.dialogs.KillDialog import xyz.brysonsteck.ServerCraft.dialogs.Dialog
import xyz.brysonsteck.ServerCraft.dialogs.EulaDialog import xyz.brysonsteck.ServerCraft.dialogs.EulaDialog
import xyz.brysonsteck.ServerCraft.dialogs.KillDialog
import xyz.brysonsteck.ServerCraft.server.Download
import xyz.brysonsteck.ServerCraft.server.Server
class PrimaryController { class PrimaryController {
@FXML @FXML lateinit private var primary: Pane
lateinit private var primary: Pane @FXML lateinit private var currentDirectoryLabel: Label
@FXML @FXML lateinit private var worldNameField: TextField
lateinit private var currentDirectoryLabel: Label @FXML lateinit private var seedField: TextField
@FXML @FXML lateinit private var portSpinner: Spinner<kotlin.Int>
lateinit private var worldNameField: TextField @FXML lateinit private var difficultyBox: ChoiceBox<String>
@FXML @FXML lateinit private var gamemodeBox: ChoiceBox<String>
lateinit private var seedField: TextField @FXML lateinit private var worldTypeBox: ChoiceBox<String>
@FXML @FXML lateinit private var worldSettingsPane: HBox
lateinit private var portSpinner: Spinner<kotlin.Int> @FXML lateinit private var parentPane: Pane
@FXML @FXML lateinit private var directoryPane: Pane
lateinit private var difficultyBox: ChoiceBox<String> @FXML lateinit private var buttonBar: ButtonBar
@FXML @FXML lateinit private var flightCheckbox: CheckBox
lateinit private var gamemodeBox: ChoiceBox<String> @FXML lateinit private var netherCheckbox: CheckBox
@FXML @FXML lateinit private var structuresCheckbox: CheckBox
lateinit private var worldTypeBox: ChoiceBox<String> @FXML lateinit private var pvpCheckbox: CheckBox
@FXML @FXML lateinit private var whitelistCheckbox: CheckBox
lateinit private var worldSettingsPane: HBox @FXML lateinit private var cmdBlocksCheckbox: CheckBox
@FXML @FXML lateinit private var playerCountCheckbox: CheckBox
lateinit private var parentPane: Pane @FXML lateinit private var maxPlayerSpinner: Spinner<kotlin.Int>
@FXML @FXML lateinit private var maxSizeSpinner: Spinner<kotlin.Int>
lateinit private var directoryPane: Pane @FXML lateinit private var memorySpinner: Spinner<kotlin.Int>
@FXML @FXML lateinit private var spawnSpinner: Spinner<kotlin.Int>
lateinit private var buttonBar: ButtonBar @FXML lateinit private var simulationSpinner: Spinner<kotlin.Int>
@FXML @FXML lateinit private var renderSpinner: Spinner<kotlin.Int>
lateinit private var flightCheckbox: CheckBox @FXML lateinit private var maxTickSpinner: Spinner<kotlin.Int>
@FXML @FXML lateinit private var statusBar: Label
lateinit private var netherCheckbox: CheckBox @FXML lateinit private var progressBar: ProgressBar
@FXML @FXML lateinit private var startButton: Button
lateinit private var structuresCheckbox: CheckBox @FXML lateinit private var buildButton: Button
@FXML @FXML lateinit private var defaultsButton: Button
lateinit private var pvpCheckbox: CheckBox @FXML lateinit private var dropDownIcon: ImageView
@FXML @FXML lateinit private var console: Label
lateinit private var whitelistCheckbox: CheckBox @FXML lateinit private var scrollPane: ScrollPane
@FXML
lateinit private var cmdBlocksCheckbox: CheckBox
@FXML
lateinit private var playerCountCheckbox: CheckBox
@FXML
lateinit private var maxPlayerSpinner: Spinner<kotlin.Int>
@FXML
lateinit private var maxSizeSpinner: Spinner<kotlin.Int>
@FXML
lateinit private var memorySpinner: Spinner<kotlin.Int>
@FXML
lateinit private var spawnSpinner: Spinner<kotlin.Int>
@FXML
lateinit private var simulationSpinner: Spinner<kotlin.Int>
@FXML
lateinit private var renderSpinner: Spinner<kotlin.Int>
@FXML
lateinit private var maxTickSpinner: Spinner<kotlin.Int>
@FXML
lateinit private var statusBar: Label
@FXML
lateinit private var progressBar: ProgressBar
@FXML
lateinit private var startButton: Button
@FXML
lateinit private var buildButton: Button
@FXML
lateinit private var defaultsButton: Button
@FXML
lateinit private var dropDownIcon: ImageView
@FXML
lateinit private var console: Label
@FXML
lateinit private var scrollPane: ScrollPane
lateinit private var server: Server lateinit private var server: Server
lateinit private var killDialog: Dialog lateinit private var killDialog: Dialog
@ -150,38 +90,25 @@ class PrimaryController {
@FXML @FXML
public fun initialize() { public fun initialize() {
scrollPane.vvalueProperty().bind(console.heightProperty()); // scrollPane.vvalueProperty().bind(console.heightProperty());
difficultyBox.items = FXCollections.observableArrayList( difficultyBox.items =
"Peaceful", FXCollections.observableArrayList("Peaceful", "Easy", "Normal", "Hard", "Hardcore")
"Easy",
"Normal",
"Hard",
"Hardcore"
)
difficultyBox.value = "Normal" difficultyBox.value = "Normal"
difficultyBox.selectionModel.selectedIndexProperty().addListener { _, _, new -> difficultyBox.selectionModel.selectedIndexProperty().addListener { _, _, new ->
if (!loading) { if (!loading) {
onPropChange("difficulty", difficultyBox.items[new as Int]) onPropChange("difficulty", difficultyBox.items[new as Int])
} }
} }
gamemodeBox.items = FXCollections.observableArrayList( gamemodeBox.items =
"Survival", FXCollections.observableArrayList("Survival", "Creative", "Adventure", "Spectator")
"Creative",
"Adventure",
"Spectator"
)
gamemodeBox.value = "Survival" gamemodeBox.value = "Survival"
gamemodeBox.selectionModel.selectedIndexProperty().addListener { _, _, new -> gamemodeBox.selectionModel.selectedIndexProperty().addListener { _, _, new ->
if (!loading) { if (!loading) {
onPropChange("gamemode", gamemodeBox.items[new as Int]) onPropChange("gamemode", gamemodeBox.items[new as Int])
} }
} }
worldTypeBox.items = FXCollections.observableArrayList( worldTypeBox.items =
"Normal", FXCollections.observableArrayList("Normal", "Superflat", "Large Biomes", "Amplified")
"Superflat",
"Large Biomes",
"Amplified"
)
worldTypeBox.value = "Normal" worldTypeBox.value = "Normal"
worldTypeBox.selectionModel.selectedIndexProperty().addListener { _, _, new -> worldTypeBox.selectionModel.selectedIndexProperty().addListener { _, _, new ->
if (!loading) { if (!loading) {
@ -293,14 +220,17 @@ class PrimaryController {
spawnSpinner.valueFactory.value = server.getProp("spawn-protection").toIntOrNull() spawnSpinner.valueFactory.value = server.getProp("spawn-protection").toIntOrNull()
simulationSpinner.valueFactory.value = server.getProp("simulation-distance").toIntOrNull() simulationSpinner.valueFactory.value = server.getProp("simulation-distance").toIntOrNull()
maxTickSpinner.valueFactory.value = server.getProp("max-tick-time").toIntOrNull() maxTickSpinner.valueFactory.value = server.getProp("max-tick-time").toIntOrNull()
difficultyBox.value = if (parseBool(server.getProp("hardcore"))) { difficultyBox.value =
if (parseBool(server.getProp("hardcore"))) {
"Hardcore" "Hardcore"
} else { } else {
server.getProp("difficulty").replaceFirstChar { it.uppercase() } server.getProp("difficulty").replaceFirstChar { it.uppercase() }
} }
gamemodeBox.value = server.getProp("gamemode").replaceFirstChar { it.uppercase() } gamemodeBox.value = server.getProp("gamemode").replaceFirstChar { it.uppercase() }
worldTypeBox.value = server.getProp("level-type").removePrefix("minecraft:") worldTypeBox.value =
.split('_').joinToString(" ") { it.replaceFirstChar(Char::uppercaseChar)} server.getProp("level-type").removePrefix("minecraft:").split('_').joinToString(" ") {
it.replaceFirstChar(Char::uppercaseChar)
}
worldNameField.text = server.getProp("level-name") worldNameField.text = server.getProp("level-name")
seedField.text = server.getProp("level-seed") seedField.text = server.getProp("level-seed")
loading = false loading = false
@ -373,7 +303,13 @@ class PrimaryController {
@FXML @FXML
private fun onDefaults() { private fun onDefaults() {
val res = CommonDialog("info", "Reset all settings?", "Reset settings to defaults?\nThere is NO GOING BACK!").show() val res =
CommonDialog(
"info",
"Reset all settings?",
"Reset settings to defaults?\nThere is NO GOING BACK!"
)
.show()
if (res) { if (res) {
server.loadProps() server.loadProps()
applyProps() applyProps()
@ -387,7 +323,7 @@ class PrimaryController {
val scene = Scene(FXMLLoader(App().javaClass.getResource("info.fxml")).load(), 398.0, 358.0) val scene = Scene(FXMLLoader(App().javaClass.getResource("info.fxml")).load(), 398.0, 358.0)
stage.icons.add(Image(App().javaClass.getResourceAsStream("app.png"))) stage.icons.add(Image(App().javaClass.getResourceAsStream("app.png")))
stage.setResizable(false) stage.setResizable(false)
stage.initModality(Modality.APPLICATION_MODAL); stage.initModality(Modality.APPLICATION_MODAL)
stage.title = "About ServerCraft" stage.title = "About ServerCraft"
stage.scene = scene stage.scene = scene
stage.show() stage.show()
@ -399,7 +335,7 @@ class PrimaryController {
building = false building = false
statusBar.text = "Cancelling..." statusBar.text = "Cancelling..."
buildButton.isDisable = true buildButton.isDisable = true
return; return
} }
building = true building = true
worldSettingsPane.isDisable = true worldSettingsPane.isDisable = true
@ -429,19 +365,23 @@ class PrimaryController {
} }
// download files // download files
val downloads = mapOf( val downloads =
"Java 20" to "https://download.java.net/java/GA/jdk20.0.1/b4887098932d415489976708ad6d1a4b/9/GPL/${javaFile}", mapOf(
"BuildTools" to "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar", "Java 20" to
"https://download.java.net/java/GA/jdk20.0.1/b4887098932d415489976708ad6d1a4b/9/GPL/${javaFile}",
"BuildTools" to
"https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar",
) )
val destinations = mapOf ( val destinations =
"Java 20" to directory + "ServerCraft" + File.separator + "Java" + File.separator, mapOf(
"BuildTools" to directory + "ServerCraft" + File.separator + "Spigot" + File.separator "Java 20" to
directory + "ServerCraft" + File.separator + "Java" + File.separator,
"BuildTools" to
directory + "ServerCraft" + File.separator + "Spigot" + File.separator
) )
val spigotBuilt = File(destinations["BuildTools"]).exists() val spigotBuilt = File(destinations["BuildTools"]).exists()
val javaExtracted = File(destinations["Java 20"] + "jdk-20.0.1").exists() val javaExtracted = File(destinations["Java 20"] + "jdk-20.0.1").exists()
destinations.forEach { destinations.forEach { File(it.value).mkdir() }
File(it.value).mkdir()
}
downloads.forEach { downloads.forEach {
if (it.key == "Java 20" && javaExtracted) { if (it.key == "Java 20" && javaExtracted) {
return@forEach return@forEach
@ -455,7 +395,8 @@ class PrimaryController {
download.start() download.start()
while (download.status == Download.Status.DOWNLOADING) { while (download.status == Download.Status.DOWNLOADING) {
var prog = (download.downloaded.toDouble() / download.contentLength.toDouble()) var prog = (download.downloaded.toDouble() / download.contentLength.toDouble())
// for whatever reason I need to print something to the screen in order for it to update the progress bar // for whatever reason I need to print something to the screen in order for it to update
// the progress bar
withContext(Dispatchers.JavaFx) { log("Progress: ${prog * 100}%\n") } withContext(Dispatchers.JavaFx) { log("Progress: ${prog * 100}%\n") }
if (prog >= 0.01) { if (prog >= 0.01) {
withContext(Dispatchers.JavaFx) { progressBar.progress = prog } withContext(Dispatchers.JavaFx) { progressBar.progress = prog }
@ -463,7 +404,9 @@ class PrimaryController {
if (!building) download.status = Download.Status.CANCELLED if (!building) download.status = Download.Status.CANCELLED
Thread.sleep(300) Thread.sleep(300)
} }
withContext(Dispatchers.JavaFx) {log("Download of ${it.key} complete with status: ${download.status}\n")} withContext(Dispatchers.JavaFx) {
log("Download of ${it.key} complete with status: ${download.status}\n")
}
} }
// extract java archive // extract java archive
@ -473,13 +416,33 @@ class PrimaryController {
statusBar.text = "Extracting Java archive..." statusBar.text = "Extracting Java archive..."
log("Extracting Java archive to ${directory + "ServerCraft" + File.separator + "Java"}\n") log("Extracting Java archive to ${directory + "ServerCraft" + File.separator + "Java"}\n")
} }
var stream = archiver.stream(File(directory + "ServerCraft" + File.separator + "Java" + File.separator + javaFile)) var stream =
archiver.stream(
File(
directory +
"ServerCraft" +
File.separator +
"Java" +
File.separator +
javaFile
)
)
val dest = File(directory + "ServerCraft" + File.separator + "Java") val dest = File(directory + "ServerCraft" + File.separator + "Java")
var entries = 0.0 var entries = 0.0
while (stream.getNextEntry() != null && building) { while (stream.getNextEntry() != null && building) {
entries++ entries++
} }
stream = archiver.stream(File(directory + "ServerCraft" + File.separator + "Java" + File.separator + javaFile)) stream =
archiver.stream(
File(
directory +
"ServerCraft" +
File.separator +
"Java" +
File.separator +
javaFile
)
)
var entry = stream.getNextEntry() var entry = stream.getNextEntry()
var currentEntry = 0.0 var currentEntry = 0.0
do { do {
@ -498,7 +461,16 @@ class PrimaryController {
progressBar.progress = ProgressBar.INDETERMINATE_PROGRESS progressBar.progress = ProgressBar.INDETERMINATE_PROGRESS
statusBar.text = "Building Minecraft Server..." statusBar.text = "Building Minecraft Server..."
} }
val builder = ProcessBuilder("${directory}ServerCraft${File.separator}Java${File.separator}jdk-20.0.1${File.separator}bin${File.separator}java", "-jar", "BuildTools.jar", "--rev", "latest", "-o", ".." + File.separator + ".." + File.separator) val builder =
ProcessBuilder(
"${directory}ServerCraft${File.separator}Java${File.separator}jdk-20.0.1${File.separator}bin${File.separator}java",
"-jar",
"BuildTools.jar",
"--rev",
"latest",
"-o",
".." + File.separator + ".." + File.separator
)
builder.directory(File(directory + "ServerCraft" + File.separator + "Spigot")) builder.directory(File(directory + "ServerCraft" + File.separator + "Spigot"))
val proc = builder.start() val proc = builder.start()
val reader = InputStreamReader(proc.inputStream) val reader = InputStreamReader(proc.inputStream)
@ -514,7 +486,14 @@ class PrimaryController {
reader.read(cbuf, 0, 1000) reader.read(cbuf, 0, 1000)
currentline++ currentline++
if (currentline > 15) { if (currentline > 15) {
withContext(Dispatchers.JavaFx) {progressBar.progress = if (spigotBuilt) {currentline/1100.0} else {currentline/14122.0} } withContext(Dispatchers.JavaFx) {
progressBar.progress =
if (spigotBuilt) {
currentline / 1100.0
} else {
currentline / 14122.0
}
}
} }
} }
cbuf = CharArray(1000) cbuf = CharArray(1000)
@ -534,7 +513,8 @@ class PrimaryController {
defaultsButton.isDisable = false defaultsButton.isDisable = false
buildButton.text = "Build Server" buildButton.text = "Build Server"
buildButton.isDisable = false buildButton.isDisable = false
statusBar.text = if (building) { statusBar.text =
if (building) {
findServerJar() findServerJar()
buildButton.text = "Rebuild Server" buildButton.text = "Rebuild Server"
startButton.isDisable = false startButton.isDisable = false
@ -542,7 +522,7 @@ class PrimaryController {
} else { } else {
"Server build cancelled." "Server build cancelled."
} }
building = false; building = false
} }
} }
} }
@ -551,18 +531,19 @@ class PrimaryController {
private fun onStart() { private fun onStart() {
if (started) { if (started) {
killDialog.show() killDialog.show()
return; return
} }
if (!File(directory + "eula.txt").exists()) { if (!File(directory + "eula.txt").exists()) {
val res = EulaDialog().show() val res = EulaDialog().show()
if (res) { if (res) {
File(directory + "eula.txt").writeText("eula=true") File(directory + "eula.txt").writeText("eula=true")
} else { } else {
return; return
} }
} }
started = true started = true
statusBar.text = "The Minecraft Server is now running. Shutdown the server to unlock the settings." statusBar.text =
"The Minecraft Server is now running. Shutdown the server to unlock the settings."
worldSettingsPane.isDisable = true worldSettingsPane.isDisable = true
directoryPane.isDisable = true directoryPane.isDisable = true
parentPane.isDisable = true parentPane.isDisable = true
@ -571,7 +552,13 @@ class PrimaryController {
startButton.text = "Kill Server" startButton.text = "Kill Server"
@Suppress("OPT_IN_USAGE") @Suppress("OPT_IN_USAGE")
GlobalScope.launch(Dispatchers.Default) { GlobalScope.launch(Dispatchers.Default) {
val builder = ProcessBuilder("${directory}ServerCraft${File.separator}Java${File.separator}jdk-20.0.1${File.separator}bin${File.separator}java", "-Xmx${server.getProp("jvm-ram")}M", "-jar", "${server.jar}") val builder =
ProcessBuilder(
"${directory}ServerCraft${File.separator}Java${File.separator}jdk-20.0.1${File.separator}bin${File.separator}java",
"-Xmx${server.getProp("jvm-ram")}M",
"-jar",
"${server.jar}"
)
builder.directory(File(directory)) builder.directory(File(directory))
val proc = builder.start() val proc = builder.start()
val reader = InputStreamReader(proc.inputStream) val reader = InputStreamReader(proc.inputStream)
@ -597,7 +584,8 @@ class PrimaryController {
withContext(Dispatchers.JavaFx) { log("Stream Closed\n") } withContext(Dispatchers.JavaFx) { log("Stream Closed\n") }
} }
withContext(Dispatchers.JavaFx) { withContext(Dispatchers.JavaFx) {
statusBar.text = if (killDialog.result) { statusBar.text =
if (killDialog.result) {
killDialog.result = false killDialog.result = false
"Server killed." "Server killed."
} else { } else {
@ -619,12 +607,11 @@ class PrimaryController {
directory = dir directory = dir
// exit if doesn't exist for whatever reason // exit if doesn't exist for whatever reason
if (!File(directory).isDirectory) { if (!File(directory).isDirectory) {
return false; return false
} }
// add system dir separator for cleaner code // add system dir separator for cleaner code
if (directory[directory.length-1] != File.separatorChar) if (directory[directory.length - 1] != File.separatorChar) directory += File.separatorChar
directory += File.separatorChar
val hasDummy = File(directory + "ServerCraft").isDirectory val hasDummy = File(directory + "ServerCraft").isDirectory
val hasProperties = File(directory + File.separator + "server.properties").isFile val hasProperties = File(directory + File.separator + "server.properties").isFile
@ -641,7 +628,13 @@ class PrimaryController {
statusBar.text = "Server needs to be built before starting." statusBar.text = "Server needs to be built before starting."
} else if (!hasDummy && hasServer) { } else if (!hasDummy && hasServer) {
// server created externally // server created externally
val result = CommonDialog("warning", directory, "This server directory was not created by \nServerCraft. Errors may occur; copying\nthe world directories to a new folder may be\nsafer. Proceed anyway?").show() val result =
CommonDialog(
"warning",
directory,
"This server directory was not created by \nServerCraft. Errors may occur; copying\nthe world directories to a new folder may be\nsafer. Proceed anyway?"
)
.show()
statusBar.text = "Ready." statusBar.text = "Ready."
if (result) { if (result) {
startButton.isDisable = true startButton.isDisable = true
@ -653,7 +646,9 @@ class PrimaryController {
return result return result
} else { } else {
// assume clean directory // assume clean directory
val result = CommonDialog("info", directory, "There is no server in this directory.\nCreate one?").show() val result =
CommonDialog("info", directory, "There is no server in this directory.\nCreate one?")
.show()
if (result) { if (result) {
File(directory + "ServerCraft").mkdir() File(directory + "ServerCraft").mkdir()
startButton.isDisable = true startButton.isDisable = true
@ -671,7 +666,7 @@ class PrimaryController {
server.loadProps() server.loadProps()
} }
return true; return true
} }
private fun findServerJar(): Boolean { private fun findServerJar(): Boolean {
@ -681,10 +676,7 @@ class PrimaryController {
// patch number // patch number
for (j in 15 downTo 0) { for (j in 15 downTo 0) {
var spigotFile: String = "" var spigotFile: String = ""
if (j == 0) if (j == 0) spigotFile += "spigot-1.$i.jar" else spigotFile += "spigot-1.$i.$j.jar"
spigotFile += "spigot-1.$i.jar"
else
spigotFile += "spigot-1.$i.$j.jar";
if (File(directory + spigotFile).isFile) { if (File(directory + spigotFile).isFile) {
server.jar = directory + spigotFile server.jar = directory + spigotFile

View file

@ -1,8 +1,8 @@
package xyz.brysonsteck.ServerCraft.dialogs package xyz.brysonsteck.ServerCraft.dialogs
import javafx.scene.control.Button
import javafx.event.EventHandler
import javafx.event.ActionEvent import javafx.event.ActionEvent
import javafx.event.EventHandler
import javafx.scene.control.Button
class CommonDialog : Dialog { class CommonDialog : Dialog {
override var type: String override var type: String
@ -18,17 +18,18 @@ class CommonDialog: Dialog {
this.msg = msg this.msg = msg
noButton = Button("No") noButton = Button("No")
noButton.onAction = EventHandler<ActionEvent>() { noButton.onAction =
EventHandler<ActionEvent>() {
result = false result = false
dialog.hide() dialog.hide()
} }
yesButton = Button("Yes") yesButton = Button("Yes")
yesButton.onAction = EventHandler<ActionEvent>() { yesButton.onAction =
EventHandler<ActionEvent>() {
result = true result = true
dialog.hide() dialog.hide()
} }
yesButton.isDefaultButton = true yesButton.isDefaultButton = true
neutralButton = null neutralButton = null
} }
} }

View file

@ -1,17 +1,15 @@
package xyz.brysonsteck.ServerCraft.dialogs package xyz.brysonsteck.ServerCraft.dialogs
import javafx.geometry.Insets
import javafx.scene.Scene
import javafx.scene.control.Button import javafx.scene.control.Button
import javafx.scene.control.ButtonBar import javafx.scene.control.ButtonBar
import javafx.scene.control.Label import javafx.scene.control.Label
import javafx.scene.image.Image import javafx.scene.image.Image
import javafx.scene.image.ImageView import javafx.scene.image.ImageView
import javafx.scene.layout.Pane import javafx.scene.layout.Pane
import javafx.scene.Scene
import javafx.stage.Modality import javafx.stage.Modality
import javafx.stage.Stage import javafx.stage.Stage
import javafx.geometry.Insets
import javafx.event.EventHandler
import javafx.event.ActionEvent
import xyz.brysonsteck.ServerCraft.App import xyz.brysonsteck.ServerCraft.App
abstract class Dialog { abstract class Dialog {
@ -33,7 +31,7 @@ abstract class Dialog {
val icon = Image("$resources") val icon = Image("$resources")
dialog.icons.add(Image(App().javaClass.getResourceAsStream("app.png"))) dialog.icons.add(Image(App().javaClass.getResourceAsStream("app.png")))
dialog.setResizable(false) dialog.setResizable(false)
dialog.initModality(Modality.APPLICATION_MODAL); dialog.initModality(Modality.APPLICATION_MODAL)
dialog.title = title dialog.title = title
val imagePane = Pane() val imagePane = Pane()
imagePane.layoutX = 14.0 imagePane.layoutX = 14.0
@ -64,14 +62,13 @@ abstract class Dialog {
ButtonBar.setButtonData(neutralButton, ButtonBar.ButtonData.LEFT) ButtonBar.setButtonData(neutralButton, ButtonBar.ButtonData.LEFT)
buttonBar.buttons.add(neutralButton) buttonBar.buttons.add(neutralButton)
} }
val dialogScene = Scene(scenePane, 400.0, 150.0); val dialogScene = Scene(scenePane, 400.0, 150.0)
dialog.setScene(dialogScene); dialog.setScene(dialogScene)
if (hold) { if (hold) {
dialog.showAndWait(); dialog.showAndWait()
} else { } else {
dialog.show(); dialog.show()
} }
return result return result
} }
} }

View file

@ -1,11 +1,10 @@
package xyz.brysonsteck.ServerCraft.dialogs package xyz.brysonsteck.ServerCraft.dialogs
import xyz.brysonsteck.ServerCraft.dialogs.Dialog
import javafx.scene.control.Button
import javafx.event.EventHandler
import javafx.event.ActionEvent
import java.awt.Desktop import java.awt.Desktop
import java.net.URI import java.net.URI
import javafx.event.ActionEvent
import javafx.event.EventHandler
import javafx.scene.control.Button
class EulaDialog : Dialog { class EulaDialog : Dialog {
override val type: String override val type: String
@ -18,38 +17,40 @@ class EulaDialog: Dialog {
constructor() { constructor() {
type = "warning" type = "warning"
title = "Minecraft End User License Agreement (EULA)" title = "Minecraft End User License Agreement (EULA)"
msg = "Do you agree to the terms of the Minecraft End User License Agreement?" msg = "Do you agree to the terms of the Minecraft\nEnd User License Agreement?"
noButton = Button("I Disagree") noButton = Button("I Disagree")
noButton.onAction = EventHandler<ActionEvent>() { noButton.onAction =
EventHandler<ActionEvent>() {
result = false result = false
dialog.hide() dialog.hide()
} }
noButton.isDefaultButton = true noButton.isDefaultButton = true
yesButton = Button("I Agree") yesButton = Button("I Agree")
yesButton.onAction = EventHandler<ActionEvent>() { yesButton.onAction =
EventHandler<ActionEvent>() {
result = true result = true
dialog.hide() dialog.hide()
} }
neutralButton = Button("View EULA") neutralButton = Button("View EULA")
neutralButton.onAction = EventHandler<ActionEvent>() { neutralButton.onAction =
EventHandler<ActionEvent>() {
val desktop = Desktop.getDesktop() val desktop = Desktop.getDesktop()
if (desktop.isSupported(Desktop.Action.BROWSE)) { if (desktop.isSupported(Desktop.Action.BROWSE)) {
// most likely running on Windows or macOS // most likely running on Windows or macOS
try { try {
desktop.browse(URI("https://account.mojang.com/documents/minecraft_eula")) desktop.browse(URI("https://www.minecraft.net/en-us/eula"))
} catch (e: Exception) { } catch (e: Exception) {
println(e) println(e)
} }
} else { } else {
// assume running on linux // assume running on linux
try { try {
Runtime.getRuntime().exec("xdg-open https://account.mojang.com/documents/minecraft_eula"); Runtime.getRuntime().exec("xdg-open https://www.minecraft.net/en-us/eula")
} catch (e: Exception) { } catch (e: Exception) {
println(e) println(e)
} }
} }
} }
} }
} }

View file

@ -1,8 +1,8 @@
package xyz.brysonsteck.ServerCraft.dialogs package xyz.brysonsteck.ServerCraft.dialogs
import javafx.scene.control.Button
import javafx.event.EventHandler
import javafx.event.ActionEvent import javafx.event.ActionEvent
import javafx.event.EventHandler
import javafx.scene.control.Button
class KillDialog : Dialog { class KillDialog : Dialog {
override val type: String override val type: String
@ -15,16 +15,19 @@ class KillDialog: Dialog {
constructor() { constructor() {
type = "warning" type = "warning"
title = "Server is still running!" title = "Server is still running!"
msg = "You should only kill the server if absolutely necessary, i.e. not being responsive after long periods of time. Data loss may occur. Continue anyway?" msg =
"You should only kill the server if absolutely necessary, i.e. not being responsive after long periods of time. Data loss may occur. Continue anyway?"
hold = false hold = false
noButton = Button("No") noButton = Button("No")
noButton.onAction = EventHandler<ActionEvent>() { noButton.onAction =
EventHandler<ActionEvent>() {
result = false result = false
dialog.hide() dialog.hide()
} }
yesButton = Button("Yes") yesButton = Button("Yes")
yesButton.onAction = EventHandler<ActionEvent>() { yesButton.onAction =
EventHandler<ActionEvent>() {
result = true result = true
dialog.hide() dialog.hide()
} }

View file

@ -1,13 +1,17 @@
package xyz.brysonsteck.ServerCraft.server package xyz.brysonsteck.ServerCraft.server
import java.io.*; import java.io.*
import java.net.*; import java.net.*
import java.util.*; import java.util.*
import javax.net.ssl.HttpsURLConnection import javax.net.ssl.HttpsURLConnection
class Download : Runnable { class Download : Runnable {
public enum class Status { public enum class Status {
DOWNLOADING, PAUSED, COMPLETE, CANCELLED, ERROR DOWNLOADING,
PAUSED,
COMPLETE,
CANCELLED,
ERROR
} }
public var size: Int public var size: Int
public var downloaded: Int public var downloaded: Int
@ -44,13 +48,13 @@ class Download: Runnable {
try { try {
// Open connection to URL. // Open connection to URL.
var connection = url.openConnection() as HttpsURLConnection; var connection = url.openConnection() as HttpsURLConnection
// Specify what portion of file to download. // Specify what portion of file to download.
connection.setRequestProperty("Range", "bytes=" + downloaded + "-"); connection.setRequestProperty("Range", "bytes=" + downloaded + "-")
// Connect to server. // Connect to server.
connection.connect(); connection.connect()
// Make sure response code is in the 200 range. // Make sure response code is in the 200 range.
if (connection.responseCode / 100 != 2) { if (connection.responseCode / 100 != 2) {
@ -58,7 +62,7 @@ class Download: Runnable {
} }
// Check for valid content length. // Check for valid content length.
contentLength = connection.getContentLength(); contentLength = connection.getContentLength()
if (contentLength < 1) { if (contentLength < 1) {
status = Status.ERROR status = Status.ERROR
} }
@ -66,38 +70,37 @@ class Download: Runnable {
/* Set the size for this download if it /* Set the size for this download if it
hasn't been already set. */ hasn't been already set. */
if (size == -1) { if (size == -1) {
size = contentLength; size = contentLength
} }
// Open file and seek to the end of it. // Open file and seek to the end of it.
file = RandomAccessFile(dir + getFilename(url), "rw"); file = RandomAccessFile(dir + getFilename(url), "rw")
file.seek(downloaded.toLong()); file.seek(downloaded.toLong())
stream = connection.getInputStream(); stream = connection.getInputStream()
while (status == Status.DOWNLOADING) { while (status == Status.DOWNLOADING) {
/* Size buffer according to how much of the /* Size buffer according to how much of the
file is left to download. */ file is left to download. */
val buffer: ByteArray; val buffer: ByteArray
if (size - downloaded > MAX_BUFFER_SIZE as Int) { if (size - downloaded > MAX_BUFFER_SIZE as Int) {
buffer = ByteArray(MAX_BUFFER_SIZE) buffer = ByteArray(MAX_BUFFER_SIZE)
} else { } else {
buffer = ByteArray(size - downloaded); buffer = ByteArray(size - downloaded)
} }
// Read from server into buffer. // Read from server into buffer.
val read = stream.read(buffer); val read = stream.read(buffer)
if (read == -1) if (read == -1) break
break;
// Write buffer to file. // Write buffer to file.
file.write(buffer, 0, read); file.write(buffer, 0, read)
downloaded += read; downloaded += read
} }
/* Change status to complete if this point was /* Change status to complete if this point was
reached because downloading has finished. */ reached because downloading has finished. */
if (status == Status.DOWNLOADING) { if (status == Status.DOWNLOADING) {
status = Status.COMPLETE; status = Status.COMPLETE
} }
} catch (e: Exception) { } catch (e: Exception) {
println(e) println(e)
@ -106,14 +109,14 @@ class Download: Runnable {
// Close file. // Close file.
if (file != null) { if (file != null) {
try { try {
file.close(); file.close()
} catch (e: Exception) {} } catch (e: Exception) {}
} }
// Close connection to server. // Close connection to server.
if (stream != null) { if (stream != null) {
try { try {
stream.close(); stream.close()
} catch (e: Exception) {} } catch (e: Exception) {}
} }
} }

View file

@ -1,7 +1,6 @@
package xyz.brysonsteck.ServerCraft.server package xyz.brysonsteck.ServerCraft.server
import java.io.File import java.io.File
import java.io.InputStream
import java.io.FileNotFoundException import java.io.FileNotFoundException
import java.util.Properties import java.util.Properties
@ -41,19 +40,34 @@ public class Server {
var ins = File(dir + File.separator + "server.properties").inputStream() var ins = File(dir + File.separator + "server.properties").inputStream()
props.load(ins) props.load(ins)
try { try {
ins = File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties").inputStream() ins =
File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties")
.inputStream()
props.load(ins) props.load(ins)
} catch (e: FileNotFoundException) { } catch (e: FileNotFoundException) {
if (convert) { if (convert) {
// create the file in question, as this is an external server being converted into a ServerCraft managed one // create the file in question, as this is an external server being converted into a
File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties").createNewFile() // ServerCraft managed one
File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties")
.createNewFile()
// also apply app-specific properties // also apply app-specific properties
props.setProperty("jvm-ram", 1024.toString()) props.setProperty("jvm-ram", 1024.toString())
// then write to file // then write to file
val temp = Properties() val temp = Properties()
val outs = File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties").outputStream() val outs =
File(
dir +
File.separator +
"ServerCraft" +
File.separator +
"ServerCraft.properties"
)
.outputStream()
temp.setProperty("jvm-ram", props.getProperty("jvm-ram")) temp.setProperty("jvm-ram", props.getProperty("jvm-ram"))
temp.store(outs, "ServerCraft settings backup\nSometimes, Minecraft will completely overwrite the server.properties file,\ncompletely destroying these app-specific settings. This file backs up these settings\njust in case. :)\nhttps://codeberg.org/brysonsteck/ServerCraft") temp.store(
outs,
"ServerCraft settings backup\nSometimes, Minecraft will completely overwrite the server.properties file,\ncompletely destroying these app-specific settings. This file backs up these settings\njust in case. :)\nhttps://codeberg.org/brysonsteck/ServerCraft"
)
} else { } else {
println(e) println(e)
} }
@ -62,11 +76,19 @@ public class Server {
private fun writeProps() { private fun writeProps() {
var outs = File(dir + File.separator + "server.properties").outputStream() var outs = File(dir + File.separator + "server.properties").outputStream()
props.store(outs, "Minecraft server properties\nCreated with ServerCraft: https://codeberg.org/brysonsteck/ServerCraft") props.store(
outs,
"Minecraft server properties\nCreated with ServerCraft: https://codeberg.org/brysonsteck/ServerCraft"
)
val temp = Properties() val temp = Properties()
outs = File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties").outputStream() outs =
File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties")
.outputStream()
temp.setProperty("jvm-ram", props.getProperty("jvm-ram")) temp.setProperty("jvm-ram", props.getProperty("jvm-ram"))
temp.store(outs, "ServerCraft settings backup\nSometimes, Minecraft will completely overwrite the server.properties file,\ncompletely destroying these app-specific settings. This file backs up these settings\njust in case. :)\nhttps://codeberg.org/brysonsteck/ServerCraft") temp.store(
outs,
"ServerCraft settings backup\nSometimes, Minecraft will completely overwrite the server.properties file,\ncompletely destroying these app-specific settings. This file backs up these settings\njust in case. :)\nhttps://codeberg.org/brysonsteck/ServerCraft"
)
} }
public fun getProp(prop: String): String { public fun getProp(prop: String): String {
@ -77,5 +99,4 @@ public class Server {
props.setProperty(key, value.toString()) props.setProperty(key, value.toString())
writeProps() writeProps()
} }
} }

View file

@ -0,0 +1,4 @@
.root{
-fx-font-size: 11pt;
-fx-font-family: "Inter";
}

View file

@ -8,24 +8,26 @@
<?import javafx.scene.control.ContextMenu?> <?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuItem?> <?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Separator?> <?import javafx.scene.control.Separator?>
<?import javafx.scene.control.Spinner?> <?import javafx.scene.control.Spinner?>
<?import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory?> <?import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TitledPane?> <?import javafx.scene.control.TitledPane?>
<?import javafx.scene.control.Tooltip?> <?import javafx.scene.control.Tooltip?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<Pane fx:id="primary" maxHeight="873.0" maxWidth="963.0" minHeight="713.0" minWidth="963.0" prefHeight="873.0" prefWidth="963.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="xyz.brysonsteck.ServerCraft.controllers.PrimaryController">
<AnchorPane fx:id="primary" minHeight="200.0" minWidth="200.0" prefHeight="633.0" prefWidth="1054.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="xyz.brysonsteck.ServerCraft.controllers.PrimaryController">
<children> <children>
<HBox fx:id="directoryPane" prefHeight="39.0" prefWidth="963.0"> <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<HBox fx:id="directoryPane" minHeight="-Infinity" VBox.vgrow="NEVER">
<children> <children>
<Button id="openFile" fx:id="chooseDirectoryButton" lineSpacing="10.0" mnemonicParsing="false" onAction="#onDirectoryButtonClick" text="Choose Directory..."> <Button id="openFile" fx:id="chooseDirectoryButton" lineSpacing="10.0" mnemonicParsing="false" onAction="#onDirectoryButtonClick" text="Choose Directory...">
<opaqueInsets> <opaqueInsets>
@ -35,7 +37,7 @@
<Insets /> <Insets />
</HBox.margin> </HBox.margin>
</Button> </Button>
<Separator orientation="VERTICAL" prefHeight="200.0"> <Separator maxHeight="1.7976931348623157E308" orientation="VERTICAL">
<HBox.margin> <HBox.margin>
<Insets left="5.0" /> <Insets left="5.0" />
</HBox.margin> </HBox.margin>
@ -58,7 +60,7 @@
<Insets bottom="7.0" left="7.0" right="7.0" top="7.0" /> <Insets bottom="7.0" left="7.0" right="7.0" top="7.0" />
</padding> </padding>
</HBox> </HBox>
<HBox fx:id="worldSettingsPane" disable="true" layoutY="39.0" prefHeight="41.0" prefWidth="963.0"> <HBox fx:id="worldSettingsPane" disable="true" minHeight="-Infinity" prefHeight="43.0" prefWidth="964.0">
<padding> <padding>
<Insets bottom="7.0" left="7.0" right="7.0" top="7.0" /> <Insets bottom="7.0" left="7.0" right="7.0" top="7.0" />
</padding> </padding>
@ -81,7 +83,7 @@
<Insets left="5.0" /> <Insets left="5.0" />
</HBox.margin> </HBox.margin>
</Separator> </Separator>
<Label text="Seed:"> <Label prefHeight="0.0" text="Seed:">
<font> <font>
<Font name="System Bold" size="13.0" /> <Font name="System Bold" size="13.0" />
</font> </font>
@ -120,11 +122,20 @@
<Insets bottom="3.0" /> <Insets bottom="3.0" />
</opaqueInsets> </opaqueInsets>
</HBox> </HBox>
<Pane fx:id="parentPane" disable="true" layoutY="78.0" prefHeight="555.0" prefWidth="970.0"> <GridPane fx:id="parentPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" VBox.vgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints halignment="CENTER" hgrow="NEVER" minWidth="10.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="317.0" minWidth="10.0" prefWidth="177.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children> <children>
<TitledPane fx:id="settingsPane" animated="false" collapsible="false" layoutX="10.0" layoutY="7.0" prefHeight="273.0" prefWidth="627.0" text="Server Settings"> <VBox prefHeight="505.0" prefWidth="584.0" GridPane.hgrow="ALWAYS">
<children>
<TitledPane fx:id="settingsPane" animated="false" collapsible="false" prefHeight="273.0" prefWidth="627.0" text="Server Settings">
<content> <content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="311.0" prefWidth="625.0"> <AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<children> <children>
<CheckBox fx:id="flightCheckbox" layoutX="14.0" layoutY="14.0" mnemonicParsing="false" onAction="#onCheckboxClick" text="Allow Flight" /> <CheckBox fx:id="flightCheckbox" layoutX="14.0" layoutY="14.0" mnemonicParsing="false" onAction="#onCheckboxClick" text="Allow Flight" />
<CheckBox fx:id="netherCheckbox" layoutX="14.0" layoutY="42.0" mnemonicParsing="false" onAction="#onCheckboxClick" selected="true" text="Allow The Nether" /> <CheckBox fx:id="netherCheckbox" layoutX="14.0" layoutY="42.0" mnemonicParsing="false" onAction="#onCheckboxClick" selected="true" text="Allow The Nether" />
@ -172,7 +183,7 @@
</AnchorPane> </AnchorPane>
</content> </content>
</TitledPane> </TitledPane>
<TitledPane fx:id="advancedPane" expanded="false" layoutX="10.0" layoutY="289.0" prefHeight="259.0" prefWidth="627.0" text="Advanced Server Settings"> <TitledPane fx:id="advancedPane" expanded="false" text="Advanced Server Settings">
<content> <content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="269.0" prefWidth="625.0"> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="269.0" prefWidth="625.0">
<children> <children>
@ -290,12 +301,22 @@
</children> </children>
</AnchorPane> </AnchorPane>
</content> </content>
<padding>
<Insets top="7.0" />
</padding>
</TitledPane> </TitledPane>
<TitledPane fx:id="difficultyPane" animated="false" collapsible="false" layoutX="649.0" layoutY="7.0" prefHeight="77.0" prefWidth="305.0" text="Difficulty"> </children>
<content> <padding>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="94.0" prefWidth="303.0"> <Insets bottom="7.0" left="7.0" right="7.0" top="7.0" />
</padding>
</VBox>
<VBox GridPane.columnIndex="1" GridPane.hgrow="ALWAYS">
<children> <children>
<ChoiceBox fx:id="difficultyBox" layoutX="14.0" layoutY="14.0" prefHeight="23.0" prefWidth="276.0"> <TitledPane fx:id="difficultyPane" animated="false" collapsible="false" text="Difficulty" VBox.vgrow="NEVER">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0">
<children>
<ChoiceBox fx:id="difficultyBox" layoutX="14.0" layoutY="14.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
@ -308,27 +329,40 @@
</AnchorPane> </AnchorPane>
</content> </content>
</TitledPane> </TitledPane>
<TitledPane fx:id="gamemodePane" animated="false" collapsible="false" layoutX="649.0" layoutY="92.0" prefHeight="77.0" prefWidth="305.0" text="Gamemode"> <TitledPane fx:id="gamemodePane" animated="false" collapsible="false" text="Gamemode" VBox.vgrow="NEVER">
<content> <content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="94.0" prefWidth="303.0"> <AnchorPane>
<children> <children>
<ChoiceBox fx:id="gamemodeBox" layoutX="14.0" layoutY="14.0" prefHeight="23.0" prefWidth="276.0" /> <ChoiceBox fx:id="gamemodeBox" layoutX="14.0" layoutY="14.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children> </children>
</AnchorPane> </AnchorPane>
</content> </content>
<padding>
<Insets top="7.0" />
</padding>
</TitledPane> </TitledPane>
<TitledPane fx:id="worldTypePane" animated="false" collapsible="false" layoutX="649.0" layoutY="178.0" prefHeight="77.0" prefWidth="305.0" text="World Type"> <TitledPane fx:id="worldTypePane" animated="false" collapsible="false" text="World Type">
<content> <content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="94.0" prefWidth="303.0"> <AnchorPane minHeight="0.0" minWidth="0.0">
<children> <children>
<ChoiceBox fx:id="worldTypeBox" layoutX="14.0" layoutY="14.0" prefHeight="23.0" prefWidth="276.0" /> <ChoiceBox fx:id="worldTypeBox" layoutX="14.0" layoutY="14.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children> </children>
</AnchorPane> </AnchorPane>
</content> </content>
<padding>
<Insets top="7.0" />
</padding>
</TitledPane> </TitledPane>
</children> </children>
</Pane> <GridPane.margin>
<ButtonBar fx:id="buttonBar" buttonOrder="L+R" layoutY="635.0" prefHeight="40.0" prefWidth="963.0"> <Insets bottom="7.0" left="7.0" right="7.0" top="7.0" />
</GridPane.margin>
</VBox>
</children>
</GridPane>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" VBox.vgrow="NEVER">
<children>
<ButtonBar fx:id="buttonBar" buttonMinWidth="75.0" buttonOrder="L+R" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS">
<buttons> <buttons>
<Button fx:id="infoButton" mnemonicParsing="false" onAction="#onInfo" text="About ServerCraft" ButtonBar.buttonData="LEFT" /> <Button fx:id="infoButton" mnemonicParsing="false" onAction="#onInfo" text="About ServerCraft" ButtonBar.buttonData="LEFT" />
<Button fx:id="defaultsButton" disable="true" mnemonicParsing="false" onAction="#onDefaults" text="Reset to Defaults" ButtonBar.buttonData="LEFT" /> <Button fx:id="defaultsButton" disable="true" mnemonicParsing="false" onAction="#onDefaults" text="Reset to Defaults" ButtonBar.buttonData="LEFT" />
@ -339,48 +373,9 @@
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0" /> <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
</padding> </padding>
</ButtonBar> </ButtonBar>
<Pane layoutY="680.0" prefHeight="196.0" prefWidth="963.0" style="-fx-background-color: ddd;">
<children>
<HBox prefWidth="963.0">
<children>
<Label text="Status:">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
<Label fx:id="statusBar" text="Ready.">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</Label>
<ProgressBar fx:id="progressBar" prefWidth="400.0" visible="false">
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</ProgressBar>
</children> </children>
<padding>
<Insets bottom="9.0" left="9.0" right="9.0" top="9.0" />
</padding>
</HBox> </HBox>
<ImageView fx:id="dropDownIcon" fitHeight="66.0" fitWidth="39.0" layoutX="923.0" layoutY="-3.0" onMouseClicked="#onToggleConsole" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@icons/arrow_down.png" />
</image>
</ImageView>
<ScrollPane fx:id="scrollPane" layoutY="34.0" prefHeight="162.0" prefWidth="963.0" vbarPolicy="ALWAYS">
<padding>
<Insets bottom="7.0" left="7.0" right="7.0" top="7.0" />
</padding>
<content>
<Label fx:id="console" prefWidth="935.0" text="Console Output:&#10; " wrapText="true">
<font>
<Font name="Monospaced Regular" size="13.0" />
</font>
</Label>
</content>
</ScrollPane>
</children> </children>
</Pane> </VBox>
</children> </children>
</Pane> </AnchorPane>