<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>


<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>
      <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>
                  <Button id="openFile" fx:id="chooseDirectoryButton" lineSpacing="10.0" mnemonicParsing="false" onAction="#onDirectoryButtonClick" text="Choose Directory...">
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                     <HBox.margin>
                        <Insets />
                     </HBox.margin>
                  </Button>
                  <Separator maxHeight="1.7976931348623157E308" orientation="VERTICAL">
                     <HBox.margin>
                        <Insets left="5.0" />
                     </HBox.margin>
                  </Separator>
                  <Label text="Server Directory:">
                     <HBox.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </HBox.margin>
                     <font>
                        <Font name="System Bold" size="13.0" />
                     </font>
                  </Label>
                  <Label id="currentFilename" fx:id="currentDirectoryLabel" text="&lt;NONE&gt;">
                     <HBox.margin>
                        <Insets bottom="5.0" right="5.0" top="5.0" />
                     </HBox.margin>
                  </Label>
               </children>
               <padding>
                  <Insets bottom="7.0" left="7.0" right="7.0" top="7.0" />
               </padding>
            </HBox>
            <HBox fx:id="worldSettingsPane" disable="true" minHeight="-Infinity" prefHeight="43.0" prefWidth="964.0">
               <padding>
                  <Insets bottom="7.0" left="7.0" right="7.0" top="7.0" />
               </padding>
               <children>
                  <Label text="World Name:" HBox.hgrow="ALWAYS">
                     <font>
                        <Font name="System Bold" size="13.0" />
                     </font>
                     <HBox.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="6.0" />
                     </HBox.margin>
                  </Label>
                  <TextField fx:id="worldNameField" text="world">
                     <HBox.margin>
                        <Insets top="2.0" />
                     </HBox.margin>
                  </TextField>
                  <Separator orientation="VERTICAL" prefHeight="200.0">
                     <HBox.margin>
                        <Insets left="5.0" />
                     </HBox.margin>
                  </Separator>
                  <Label prefHeight="0.0" text="Seed:">
                     <font>
                        <Font name="System Bold" size="13.0" />
                     </font>
                     <HBox.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="6.0" />
                     </HBox.margin>
                  </Label>
                  <TextField fx:id="seedField" promptText="Leave empty for random seed" HBox.hgrow="ALWAYS">
                     <HBox.margin>
                        <Insets top="2.0" />
                     </HBox.margin>
                  </TextField>
                  <Separator orientation="VERTICAL" prefHeight="200.0">
                     <HBox.margin>
                        <Insets left="5.0" />
                     </HBox.margin>
                  </Separator>
                  <Label text="Server Port:" HBox.hgrow="ALWAYS">
                     <font>
                        <Font name="System Bold" size="13.0" />
                     </font>
                     <HBox.margin>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="6.0" />
                     </HBox.margin>
                  </Label>
                  <Spinner fx:id="portSpinner" editable="true" prefWidth="95.0">
                     <HBox.margin>
                        <Insets top="2.0" />
                     </HBox.margin>
                     <valueFactory>
                        <SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="25565" max="60000" min="20000" />
                     </valueFactory>
                  </Spinner>
               </children>
               <opaqueInsets>
                  <Insets bottom="3.0" />
               </opaqueInsets>
            </HBox>
            <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>
                  <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>
                            <AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
                                 <children>
                                    <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="structuresCheckbox" alignment="TOP_LEFT" layoutX="14.0" layoutY="70.0" mnemonicParsing="false" onAction="#onCheckboxClick" selected="true" text="Generate Structures&#10;(such as villages and strongholds)" />
                                    <CheckBox fx:id="pvpCheckbox" layoutX="14.0" layoutY="109.0" mnemonicParsing="false" onAction="#onCheckboxClick" selected="true" text="Allow PvP" />
                                    <CheckBox fx:id="whitelistCheckbox" alignment="TOP_LEFT" layoutX="14.0" layoutY="138.0" mnemonicParsing="false" onAction="#onCheckboxClick" text="Enable Whitelist&#10;(Only users you specify can join)" />
                                    <HBox layoutX="6.0" layoutY="174.0">
                                       <children>
                                          <Label text="Maximum Players:" HBox.hgrow="ALWAYS">
                                             <padding>
                                                <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
                                             </padding>
                                          </Label>
                                          <Spinner fx:id="maxPlayerSpinner" editable="true" prefHeight="23.0" prefWidth="99.0">
                                             <valueFactory>
                                                <SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="20" max="1000" min="0" />
                                             </valueFactory>
                                             <HBox.margin>
                                                <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                                             </HBox.margin>
                                          </Spinner>
                                       </children>
                                    </HBox>
                                    <HBox layoutX="6.0" layoutY="207.0">
                                       <children>
                                          <Label text="Maximum World Size (in blocks):" HBox.hgrow="ALWAYS">
                                             <HBox.margin>
                                                <Insets />
                                             </HBox.margin>
                                             <padding>
                                                <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
                                             </padding>
                                          </Label>
                                          <Spinner fx:id="maxSizeSpinner" editable="true" prefHeight="23.0" prefWidth="155.0">
                                             <valueFactory>
                                                <SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="29999984" max="29999984" min="1" />
                                             </valueFactory>
                                             <HBox.margin>
                                                <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                                             </HBox.margin>
                                          </Spinner>
                                       </children>
                                    </HBox>
                                 </children>
                              </AnchorPane>
                          </content>
                        </TitledPane>
                        <TitledPane fx:id="advancedPane" expanded="false" text="Advanced Server Settings">
                          <content>
                            <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="269.0" prefWidth="625.0">
                                 <children>
                                    <CheckBox fx:id="cmdBlocksCheckbox" layoutX="14.0" layoutY="14.0" mnemonicParsing="false" onAction="#onCheckboxClick" text="Enable Command Blocks" />
                                    <CheckBox fx:id="playerCountCheckbox" layoutX="14.0" layoutY="41.0" mnemonicParsing="false" onAction="#onCheckboxClick" text="Hide Online Player Count" />
                                    <HBox layoutX="7.0" layoutY="65.0">
                                       <children>
                                          <Label ellipsisString="" text="Server Memory in MB:" textOverrun="CLIP" HBox.hgrow="ALWAYS">
                                             <tooltip>
                                                <Tooltip text="This is the amount of RAM that will get passed to Minecraft/the JVM.&#10;For simple servers, 1024 MB will be plenty.&#10;If you typically have more than 5 concurrent players, consider allocating more." />
                                             </tooltip>
                                             <padding>
                                                <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
                                             </padding>
                                          </Label>
                                          <Spinner fx:id="memorySpinner" editable="true" prefHeight="23.0" prefWidth="99.0">
                                             <valueFactory>
                                                <SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="1024" max="65536" min="512" />
                                             </valueFactory>
                                             <HBox.margin>
                                                <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                                             </HBox.margin>
                                          </Spinner>
                                       </children>
                                    </HBox>
                                    <HBox layoutX="7.0" layoutY="96.0">
                                       <children>
                                          <Label text="Spawn Protection Radius:" HBox.hgrow="ALWAYS">
                                             <tooltip>
                                                <Tooltip text="All blocks in a radius from 0,~,0 will be unbreakable. &#10;If you want to break blocks within spawn, change this value." />
                                             </tooltip>
                                             <HBox.margin>
                                                <Insets />
                                             </HBox.margin>
                                             <padding>
                                                <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
                                             </padding>
                                          </Label>
                                          <Spinner fx:id="spawnSpinner" editable="true" prefHeight="23.0" prefWidth="99.0">
                                             <valueFactory>
                                                <SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="16" max="29999984" min="0" />
                                             </valueFactory>
                                             <HBox.margin>
                                                <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                                             </HBox.margin>
                                          </Spinner>
                                       </children>
                                    </HBox>
                                    <HBox layoutX="7.0" layoutY="127.0">
                                       <children>
                                          <Label text="Simulation Distance:" HBox.hgrow="ALWAYS">
                                             <tooltip>
                                                <Tooltip text="The radius of chunks for each player where ticks will be updated.&#10;In other words, anything outside these circles, such as furnaces, mobs, etc, will not be updated or simulated." />
                                             </tooltip>
                                             <HBox.margin>
                                                <Insets />
                                             </HBox.margin>
                                             <padding>
                                                <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
                                             </padding>
                                          </Label>
                                          <Spinner fx:id="simulationSpinner" editable="true" prefWidth="80.0">
                                             <valueFactory>
                                                <SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="10" max="40" min="0" />
                                             </valueFactory>
                                             <HBox.margin>
                                                <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                                             </HBox.margin>
                                          </Spinner>
                                       </children>
                                    </HBox>
                                    <HBox layoutX="7.0" layoutY="160.0">
                                       <children>
                                          <Label text="Render Distance:" HBox.hgrow="ALWAYS">
                                             <tooltip>
                                                <Tooltip text="The radius of chunks where the server will render the view distance.&#10;Any value higher on a client than what is set will be ignored.&#10;Higher values will be more demanding on the server." />
                                             </tooltip>
                                             <HBox.margin>
                                                <Insets />
                                             </HBox.margin>
                                             <padding>
                                                <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
                                             </padding>
                                          </Label>
                                          <Spinner fx:id="renderSpinner" editable="true" prefWidth="80.0">
                                             <valueFactory>
                                                <SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="10" max="40" min="2" />
                                             </valueFactory>
                                             <HBox.margin>
                                                <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                                             </HBox.margin>
                                          </Spinner>
                                       </children>
                                    </HBox>
                                    <HBox layoutX="7.0" layoutY="192.0">
                                       <children>
                                          <Label text="Maximum Tick Time (in milliseconds):" HBox.hgrow="ALWAYS">
                                             <tooltip>
                                                <Tooltip text="If the server cannot update ticks (i.e. &quot;lags&quot;) for longer than this amount of time, the server will shutdown.&#10;60000 ms (60 seconds) is the default." />
                                             </tooltip>
                                             <padding>
                                                <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
                                             </padding>
                                          </Label>
                                          <Spinner fx:id="maxTickSpinner" editable="true">
                                             <valueFactory>
                                                <SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="60000" max="180000" min="10000" />
                                             </valueFactory>
                                             <HBox.margin>
                                                <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                                             </HBox.margin>
                                          </Spinner>
                                       </children>
                                    </HBox>
                                 </children>
                              </AnchorPane>
                          </content>
                           <padding>
                              <Insets top="7.0" />
                           </padding>
                        </TitledPane>
                     </children>
                     <padding>
                        <Insets bottom="7.0" left="7.0" right="7.0" top="7.0" />
                     </padding>
                  </VBox>
                  <VBox GridPane.columnIndex="1" GridPane.hgrow="ALWAYS">
                     <children>
                        <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>
                                            <items>
                                              <MenuItem mnemonicParsing="false" />
                                            </items>
                                          </ContextMenu>
                                       </contextMenu>
                                    </ChoiceBox>
                                 </children>
                              </AnchorPane>
                          </content>
                        </TitledPane>
                        <TitledPane fx:id="gamemodePane" animated="false" collapsible="false" text="Gamemode" VBox.vgrow="NEVER">
                           <content>
                              <AnchorPane>
                                 <children>
                                    <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>
                              </AnchorPane>
                           </content>
                           <padding>
                              <Insets top="7.0" />
                           </padding>
                        </TitledPane>
                        <TitledPane fx:id="worldTypePane" animated="false" collapsible="false" text="World Type">
                           <content>
                              <AnchorPane minHeight="0.0" minWidth="0.0">
                                 <children>
                                    <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>
                              </AnchorPane>
                           </content>
                           <padding>
                              <Insets top="7.0" />
                           </padding>
                        </TitledPane>
                     </children>
                     <GridPane.margin>
                        <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>
                        <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="buildButton" disable="true" mnemonicParsing="false" onAction="#onBuild" text="Build Server" ButtonBar.buttonData="RIGHT" />
                      <Button fx:id="startButton" defaultButton="true" disable="true" mnemonicParsing="false" onAction="#onStart" prefWidth="120.0" text="Start Server" ButtonBar.buttonData="RIGHT" />
                    </buttons>
                     <padding>
                        <Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
                     </padding>
                  </ButtonBar>
               </children>
            </HBox>
         </children>
      </VBox>
   </children>
</AnchorPane>
