Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_Icon=Resources\Diamond Icon.ico
- #AutoIt3Wrapper_Outfile_x64=..\..\Desktop\Bungee Server Launcher.exe
- #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #region Include
- #include <GUIConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <GuiComboBoxEx.au3>
- #include <Constants.au3>
- #include <ProgressConstants.au3>
- #include <GuiStatusBar.au3>
- #include <EditConstants.au3>
- #include <WindowsConstants.au3>
- #include <Constants.au3>
- #include <WindowsConstants.au3>
- #include <EditConstants.au3>
- #include <WinAPI.au3>
- #endregion Include
- #region GUI
- Global $hwnd0, $hwnd1, $hwnd2, $hwnd3, $hwnd4, $hwnd5, $servers, $backupdir, $file0, $file1, $file2, $file3, $file4, $file5, $chosen2, $chosen3, $Combo3, $Read3, $1, $2, $3, $BungeeServer, $GUI, $hwnd00, $Edit1, $Edit2, $Edit3, $Hide = @SW_SHOW, $GUI2;Global variabled needed to be defined because they aren't before further down then they are needed.
- $GUI = GUICreate("MineCraft Server Client -Made by EpicKnarvik97", 450, 170, 0, 0);The main GUI
- $Tab1 = GUICtrlCreateTab(8, 8, 435, 110);The main tab
- $TabSheet1 = GUICtrlCreateTabItem("Basic Controls");Tab 1:Basic controls
- $Label1 = GUICtrlCreateLabel("Server(s) are closed", 10, 125);State of the servers (Based on the start and stop server buttons).
- $StartG = GUICtrlCreateButton("Start Server", 10, 35, 75, 25);The button that starts the server.
- $StopG = GUICtrlCreateButton("Stop Server", 10, 60, 75, 25);The button that stops the server.
- $Command_Arguments = GUICtrlCreateInput("", 11, 86, 213, 25);Input to allow command arguments.
- $KickG = GUICtrlCreateButton("Kick", 87, 35, 75, 25);The button that kicks a player.
- $SaveG = GUICtrlCreateButton("Save Server", 87, 60, 75, 25);The button that saves the server.
- $BanG = GUICtrlCreateButton("Ban", 164, 35, 75, 25);The button that bans a player.
- $UnbanG = GUICtrlCreateButton("Unban", 164, 60, 75, 25);The button that bans a player.
- $OPG = GUICtrlCreateButton("OP", 241, 35, 75, 25);The button that ops a player.
- $DEOPG = GUICtrlCreateButton("DEOP", 241, 60, 75, 25);The button that deops a player.
- $CCG = GUICtrlCreateButton("Custom Command", 225, 86, 91, 25);The button that runs a command of your choice.
- $addw = GUICtrlCreateButton("Add to Whitelist", 318, 35, 115);The button that adds a player to the whitelist.
- $delw = GUICtrlCreateButton("Remove from Whitelist", 318, 60, 115);The button that removes a player from the whitelist.
- $backup = GUICtrlCreateButton("Backup", 318, 86, 115);The button that commences a backup of the server.
- $consoles = GUICtrlCreateButton("Console Output", 318, 120, 115);The button that toggles visibility of the server.
- $helpmenu = GUICtrlCreateMenu("Help");Creates a helpmenu
- $setupitem = GUICtrlCreateMenuItem("Setup", $helpmenu);Creates a setup item in the helpmenu
- $help = GUICtrlCreateMenuItem("Warning", $helpmenu);Creates a warning item in the helpmenu
- $info = GUICtrlCreateMenu("Info");Creates an infomenu
- $aboutitem = GUICtrlCreateMenuItem("About", $info);Creates an About item in the infomenu
- $How = GUICtrlCreateMenuItem("How does it work?", $info);Creates a "How does it work" item in the infomenu
- $TabSheet2 = GUICtrlCreateTabItem("Server Config");Tab 2: Server Config
- $Bungee = GUICtrlCreateCheckbox("Bungee", 175, 35, 97, 25);The checkboz that enables the Bungee server.
- $server1 = GUICtrlCreateCheckbox("Enable Server 1", 175, 60, 97, 25);The checkbox that enabled Server1.
- $server2 = GUICtrlCreateCheckbox("Enable Server 2", 175, 85, 97, 25);The checkbox that enabled Server2.
- $server3 = GUICtrlCreateCheckbox("Enable Server 3", 300, 35, 97, 25);The checkbox that enabled Server3.
- $server4 = GUICtrlCreateCheckbox("Enable Server 4", 300, 60, 97, 25);The checkbox that enabled Server4.
- $server5 = GUICtrlCreateCheckbox("Enable Server 5", 300, 85, 97, 25);The checkbox that enabled Server5.
- $DelConf = GUICtrlCreateButton("Delete all configurations and exit", 10, 120, 160, 25);The button that deletes all of your configurations.
- $Combo1 = GUICtrlCreateCombo("Server Memory", 10, 35, 161, 25, $CBS_DROPDOWNLIST);A combo defined as a dropbox to choose server memory.
- GUICtrlSetData($Combo1, "-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M|-Xmx5120M|-Xmx6144M|-Xmx7168M|-Xmx8192M|-Xmx9216M|-Xmx10240M");This sets the data aka the different choices of the dropbox.
- $Combo2 = GUICtrlCreateCombo("Server Type", 10, 60, 161, 25, $CBS_DROPDOWNLIST)
- GUICtrlSetData($Combo2, "Vanilla|Snapshot|Spigot|CB Dev|CB Stable|CB Beta")
- If RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo2") = "Vanilla" Then
- GUISwitch($GUI, $TabSheet2)
- $Combo3 = GUICtrlCreateCombo("Choose Version", 10, 85, 161, 25, $CBS_DROPDOWNLIST)
- GUICtrlSetData($Combo3, "Latest|1.6.4|1.6.2|1.5.2|1.4.7|1.4.5")
- GUISwitch($GUI, $TabSheet1)
- EndIf
- $TabSheet3 = GUICtrlCreateTabItem("Extra cmd settings")
- GUICtrlCreateLabel("Coming Soon", 60, 50, 200, 40)
- GUICtrlSetFont(-1, 20, 400, "", "Verdana")
- GUICtrlCreateTabItem("")
- GUISetState(@SW_SHOW)
- #endregion GUI
- #region Loc prompt and readstats
- ReadStats()
- If $backupdir = "" Then $backupdir = FileSelectFolder("Choose Backups Location", "");Prompts for a location if it isn't defined.
- If GUICtrlRead($Bungee) = 1 And $file0 = "" Then $file0 = FileSelectFolder("Choose Bungee Server Location...", "");Prompts for a location if it isn't defined.
- If GUICtrlRead($server1) = 1 And $file1 = "" Then $file1 = FileSelectFolder("Choose Server 1 Location...", "");Prompts for a location if it isn't defined.
- If GUICtrlRead($server2) = 1 And $file2 = "" Then $file2 = FileSelectFolder("Choose Server 2 Location...", "");Prompts for a location if it isn't defined.
- If GUICtrlRead($server3) = 1 And $file3 = "" Then $file3 = FileSelectFolder("Choose Server 3 Location...", "");Prompts for a location if it isn't defined.
- If GUICtrlRead($server4) = 1 And $file4 = "" Then $file4 = FileSelectFolder("Choose Server 4 Location...", "");Prompts for a location if it isn't defined.
- If GUICtrlRead($server5) = 1 And $file5 = "" Then $file5 = FileSelectFolder("Choose Server 5 Location...", "");Prompts for a location if it isn't defined.
- #endregion Loc prompt and readstats
- While 1;The script's loop.
- $chosen = GUICtrlRead($Combo1)
- $chosen2 = GUICtrlRead($Combo2)
- $chosen3 = GUICtrlRead($Combo3)
- $args = GUICtrlRead($Command_Arguments)
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- WriteStats()
- Exit
- Case $Combo2;Makes a combo to choose vanilla version.
- If $chosen2 = "Vanilla" Then
- GUISwitch($GUI, $TabSheet2)
- $Combo3 = GUICtrlCreateCombo("Choose Version", 10, 85, 161, 25, $CBS_DROPDOWNLIST)
- GUICtrlSetData($Combo3, "Latest|1.6.4|1.6.2|1.5.2|1.4.7|1.4.5")
- $Read9 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo3")
- If Not $Read9 = "" Then
- GUICtrlSetData($Combo3, $Read9)
- EndIf
- GUICtrlCreateTabItem("")
- Else
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo3", "REG_SZ", GUICtrlRead($Combo3))
- GUISwitch($GUI, $TabSheet2)
- GUICtrlDelete($Combo3)
- EndIf
- Case $consoles;Changes the state of the comsoles window.
- If $servers = "RUNNING" Then
- If BitAND(WinGetState($GUI2), 2) Then
- GUISetState(@SW_HIDE, $GUI2)
- Else
- GUISetState(@SW_SHOW, $GUI2)
- EndIf
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $StartG;Starts the servers as long as at least one is selected.
- If GUICtrlRead($Bungee) = $GUI_UNCHECKED And GUICtrlRead($server1) = $GUI_UNCHECKED And GUICtrlRead($server2) = $GUI_UNCHECKED And GUICtrlRead($server3) = $GUI_UNCHECKED And GUICtrlRead($server4) = $GUI_UNCHECKED And GUICtrlRead($server5) = $GUI_UNCHECKED Then
- MsgBox(-1, "ERROR", "No servers enabled")
- Else
- Start()
- EndIf
- Case $KickG;Kicks a player
- If $servers = "RUNNING" Then
- ControlSend("Server1", "", $hwnd1, 'kick ' & $args & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, 'kick ' & $args & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'kick ' & $args & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'kick ' & $args & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'kick ' & $args & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $BanG;Bans a player
- If $servers = "RUNNING" Then
- ControlSend("Server1", "", $hwnd1, 'ban ' & $args & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, 'ban ' & $args & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'ban ' & $args & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'ban ' & $args & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'ban ' & $args & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $UnbanG;Unbans a player
- If $servers = "RUNNING" Then
- ControlSend("Server1", "", $hwnd1, 'pardon ' & $args & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, 'pardon ' & $args & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'pardon ' & $args & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'pardon ' & $args & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'pardon ' & $args & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $OPG;Ops a player
- If $servers = "RUNNING" Then
- ControlSend("Server1", "", $hwnd1, 'op ' & $args & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, 'op ' & $args & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'op ' & $args & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'op ' & $args & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'op ' & $args & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $DEOPG;Deops a player
- If $servers = "RUNNING" Then
- ControlSend("Server1", "", $hwnd1, 'deop ' & $args & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, 'deop ' & $args & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'deop ' & $args & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'deop ' & $args & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'deop ' & $args & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $SaveG;Saving the servers' blockstates.
- If $servers = "RUNNING" Then
- ControlSend("Consoles", "", $hwnd00, ControlSend("Server1", "", $hwnd1, 'save-all' & '{ENTER}'))
- ControlSend("Server2", "", $hwnd2, 'save-all' & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'save-all' & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'save-all' & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'save-all' & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $CCG;Executes the arguments you've written. Has to be a command without the "/".
- If $servers = "RUNNING" Then
- ControlSend("Server1", "", $hwnd1, $args & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, $args & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, $args & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, $args & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, $args & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $StopG;Stops the servers.
- If $servers = "RUNNING" Then
- $servers = "CLOSED"
- ControlSend("Bungee", "", $hwnd0, 'end' & '{ENTER}')
- ControlSend("Server1", "", $hwnd1, 'stop' & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, 'stop' & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'stop' & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'stop' & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'stop' & '{ENTER}')
- GUICtrlSetData($Label1, "Server(s) are closed")
- EndIf
- Case $backup;Backups all of the server folders with the current date and time.
- Backup()
- Case $addw;Adds a player to the whitekist.
- If $servers = "RUNNING" Then
- ControlSend("Server1", "", $hwnd1, 'whitelist add ' & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, 'whitelist add ' & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'whitelist add ' & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'whitelist add ' & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'whitelist add ' & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $delw;Removes a player from the whitelist.
- If $servers = "RUNNING" Then
- ControlSend("Server1", "", $hwnd1, 'whitelist remove ' & '{ENTER}')
- ControlSend("Server2", "", $hwnd2, 'whitelist remove ' & '{ENTER}')
- ControlSend("Server3", "", $hwnd3, 'whitelist remove ' & '{ENTER}')
- ControlSend("Server4", "", $hwnd4, 'whitelist remove ' & '{ENTER}')
- ControlSend("Server5", "", $hwnd5, 'whitelist remove ' & '{ENTER}')
- Else
- MsgBox(16, "Failure", "The server isn't running")
- EndIf
- Case $aboutitem;Information about what this is.
- MsgBox(0, "Server Client", "This is a sort of server controller both for bungee users, users with more than 1 server and users wanting to easily and fast change configuration or platform." & @LF & @LF & "If you are using more than one server, the settings will count for every server except for the bungee server which is set to 512M of ram and newest download from the jenkins page.")
- Case $setupitem;Information about the setup.
- MsgBox(0, "Setup Steps", "1. Choose your settings" & @LF & "2. Exit the program" & @LF & "3. Start the program" & @LF & "4. Choose the locations of your chosen servers(folder must excist)" & @LF & "5. Click the Start server button" & @LF & "Also stop the server and set them up if you are starting new servers")
- Case $How;Information about how the program works.
- MsgBox(0, "How does this work?", "The program uses a lot of variables to do things to every server instead of just one." & @LF & "Everything is saved when you close the GUI." & @LF & "The server versions are downloaded from the official pages. The bukkit ones from the bukkit website, the spigot and bungee from the jenkins page. The vanilla and Snapshot versions come from a link to the amazonaws server generated using the versions file has.")
- Case $help;Explains some "Rules".
- MsgBox(0, "Warnings", "1. Always restart the program after changing settings. The only exception is server ram and servers you have chosen the directory for earlier." & @LF & "2. The program may seem like it has crashed, but it's just waiting for something to finish.")
- Case $DelConf;Delete all the saved configurations and setting it all to default. Afterwards closing the program to prevent any bugs.
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Bungee")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server1")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server2")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server3")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server4")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server5")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo2")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc0")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc1")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc2")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc3")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc4")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc5")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Version")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "SnapshotVersion")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Backup")
- RegDelete("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo3")
- Exit
- EndSwitch
- WEnd
- Func Start();Checking what servers are started and then launching with the opttions selected.
- ServerType()
- $GUI2 = GUICreate("Consoles", 1020, 600, 1282, 300, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_CLIPCHILDREN, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
- $hwnd00 = WinGetHandle("Consoles")
- If GUICtrlRead($Bungee) = 1 Then
- $BungeeServer = Run("java -Xmx512M -jar " & '"' & $file0 & "\BungeeCord.jar" & '"', $file0, $Hide)
- If Not ProcessWait($BungeeServer) = 0 Then
- WinSetTitle("C:\Windows\system32\java.exe", "", "Bungee")
- WinSetTitle("C:\WINDOWS\SYSTEM32\java.exe", "", "Bungee")
- Global $hwnd0 = WinGetHandle("Bungee")
- EndIf
- EndIf
- If GUICtrlRead($server1) = 1 Then
- $1 = Run("java " & $chosen & " -jar " & '"' & $file1 & '"' & "\minecraft_server.jar", $file1, $Hide)
- If Not ProcessWait($1) = 0 Then
- WinSetTitle("C:\Windows\system32\java.exe", "", "Server1")
- WinSetTitle("C:\WINDOWS\SYSTEM32\java.exe", "", "Server1")
- Global $hwnd1 = WinGetHandle("Server1")
- EndIf
- EndIf
- If GUICtrlRead($server2) = 1 Then
- $2 = Run("java " & $chosen & " -jar " & '"' & $file2 & '"' & "\minecraft_server.jar", $file2, $Hide)
- If Not ProcessWait($2) = 0 Then
- WinSetTitle("C:\Windows\system32\java.exe", "", "Server2")
- WinSetTitle("C:\WINDOWS\SYSTEM32\java.exe", "", "Server2")
- Global $hwnd2 = WinGetHandle("Server2")
- EndIf
- EndIf
- If GUICtrlRead($server3) = 1 Then
- $3 = Run("java " & $chosen & " -jar " & '"' & $file3 & '"' & "\minecraft_server.jar", $file3, $Hide)
- If Not ProcessWait($3) = 0 Then
- WinSetTitle("C:\Windows\system32\java.exe", "", "Server3")
- WinSetTitle("C:\WINDOWS\SYSTEM32\java.exe", "", "Server3")
- Global $hwnd3 = WinGetHandle("Server3")
- EndIf
- EndIf
- If GUICtrlRead($server4) = 1 Then
- $4 = Run("java " & $chosen & " -jar " & '"' & $file4 & '"' & "\minecraft_server.jar", $file4, $Hide)
- If Not ProcessWait($4) = 0 Then
- WinSetTitle("C:\Windows\system32\java.exe", "", "Server4")
- WinSetTitle("C:\WINDOWS\SYSTEM32\java.exe", "", "Server4")
- Global $hwnd4 = WinGetHandle("Server4")
- EndIf
- EndIf
- If GUICtrlRead($server5) = 1 Then
- $5 = Run("java " & $chosen & " -jar " & '"' & $file5 & '"' & "\minecraft_server.jar", $file5, $Hide)
- If Not ProcessWait($5) = 0 Then
- WinSetTitle("C:\Windows\system32\java.exe", "", "Server5")
- WinSetTitle("C:\WINDOWS\SYSTEM32\java.exe", "", "Server5")
- Global $hwnd5 = WinGetHandle("Server5")
- EndIf
- EndIf
- _WinAPI_SetWindowLong($hwnd0, $GWL_EXSTYLE, $WS_EX_MDICHILD)
- _WinAPI_SetParent($hwnd0, $GUI2)
- _WinAPI_SetWindowLong($hwnd1, $GWL_EXSTYLE, $WS_EX_MDICHILD)
- _WinAPI_SetParent($hwnd1, $GUI2)
- _WinAPI_SetWindowLong($hwnd2, $GWL_EXSTYLE, $WS_EX_MDICHILD)
- _WinAPI_SetParent($hwnd2, $GUI2)
- _WinAPI_SetWindowLong($hwnd3, $GWL_EXSTYLE, $WS_EX_MDICHILD)
- _WinAPI_SetParent($hwnd3, $GUI2)
- _WinAPI_SetWindowLong($hwnd4, $GWL_EXSTYLE, $WS_EX_MDICHILD)
- _WinAPI_SetParent($hwnd4, $GUI2)
- _WinAPI_SetWindowLong($hwnd5, $GWL_EXSTYLE, $WS_EX_MDICHILD)
- _WinAPI_SetParent($hwnd5, $GUI2)
- WinMove($hwnd0, "", 0, 0, 340, 300)
- WinMove($hwnd1, "", 340, 0, 340, 300)
- WinMove($hwnd2, "", 680, 0, 340, 300)
- WinMove($hwnd3, "", 0, 300, 340, 300)
- WinMove($hwnd4, "", 340, 300, 340, 300)
- WinMove($hwnd5, "", 680, 300, 340, 300)
- Global $servers = "Running"
- GUICtrlSetData($Label1, "Server(s) are running");Changing the state of the servers shown in the GUI as running.
- EndFunc ;==>Start
- Func ServerType();Checking what servers are enabled and downloading to the selected folder.
- GUISetState(@SW_HIDE, $GUI);Hides the main GUI.
- $Pgui = GUICreate("Downloading jars", 280, 25);Making a new GUI named Downloading jars.
- GUISetState(@SW_SHOW, $Pgui);Setting the state of the new gui as shown.
- $Progress = GUICtrlCreateProgress("", "", 280, 25, BitOR($PBS_SMOOTH, $WS_BORDER), $WS_EX_CLIENTEDGE);Creates a progress bar that shows what jars have been downloaded.
- GUICtrlSetData($Progress, 0);Setting the progress of the progress bar to 0%
- If GUICtrlRead($Bungee) = 1 Then InetGet("http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar", $file0 & "\BungeeCord.jar");Downloads the newest bungee version.
- GUICtrlSetData($Progress, 16);Setting the progress of the progress bar to 16%
- If GUICtrlRead($server1) = 1 Then Download($file1);Downloads the jarfile selected to the location of server1.
- GUICtrlSetData($Progress, 30);Setting the progress of the progress bar to 30%
- If GUICtrlRead($server2) = 1 Then Download($file2);Downloads the jarfile selected to the location of server2.
- GUICtrlSetData($Progress, 50);Setting the progress of the progress bar to 50%
- If GUICtrlRead($server3) = 1 Then Download($file3);Downloads the jarfile selected to the location of server3.
- GUICtrlSetData($Progress, 66);Setting the progress of the progress bar to 66%
- If GUICtrlRead($server4) = 1 Then Download($file4);Downloads the jarfile selected to the location of server4.
- GUICtrlSetData($Progress, 82);Setting the progress of the progress bar to 82%
- If GUICtrlRead($server5) = 1 Then Download($file5);Downloads the jarfile selected to the location of server5.
- GUICtrlSetData($Progress, 100);Setting the progress of the progress bar to 100%
- GUIDelete($Pgui);Deletes the Downloading jars GUI.
- GUISetState(@SW_SHOW, $GUI);Shows the main GUI.
- EndFunc ;==>ServerType
- Func Download($loc);Downloads whatever is chosen to the location defined while calling this function.
- If $chosen2 = "Spigot" Then InetGet("http://ci.md-5.net/job/Spigot-1.7/lastSuccessfulBuild/artifact/Spigot-Server/target/spigot.jar", $loc & "\minecraft_server.jar", 1, 0)
- If $chosen2 = "CB Dev" Then InetGet("http://dl.bukkit.org/latest-dev/craftbukkit-dev.jar", $loc & "\minecraft_server.jar", 1, 0)
- If $chosen2 = "CB Stable" Then InetGet("http://dl.bukkit.org/latest-rb/craftbukkit.jar", $loc & "\minecraft_server.jar", 1, 0)
- If $chosen2 = "CB Beta" Then InetGet("http://dl.bukkit.org/latest-beta/craftbukkit-beta.jar", $loc & "\minecraft_server.jar", 1, 0)
- If $chosen2 = "Vanilla" Then Vanilla($loc)
- If $chosen2 = "Snapshot" Then;This generates a download link to the newest minecraft snapshot.
- $Read = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "SnapshotVersion")
- $Path1 = @TempDir & "\versions.json"
- InetGet("https://s3.amazonaws.com/Minecraft.Download/versions/versions.json", $Path1, 1, 0)
- $FF = FileOpen($Path1)
- $RF = FileReadLine($FF, 3)
- If $Read = $RF And FileExists($loc) Then
- Else
- $ver = StringReplace(StringReplace($RF, ' "snapshot": "', ""), '",', "")
- If InetGet('https://s3.amazonaws.com/Minecraft.Download/versions/' & $ver & "/minecraft_server." & $ver & ".jar", $loc & "\minecraft_server.jar", 1, 0) = 1 Then RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Snapshot", "Version", "REG_SZ", $RF)
- EndIf
- FileDelete($Path1)
- EndIf
- EndFunc ;==>Download
- Func Vanilla($loc);The function for downloading the latest Vanilla build unless a certain version is chosen.
- If GUICtrlRead($Combo2) = "Vanilla" And GUICtrlRead($Combo3) = "Latest" Then
- $Read = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Version")
- $Path1 = @TempDir & "\versions.json"
- InetGet("https://s3.amazonaws.com/Minecraft.Download/versions/versions.json", $Path1, 1, 0)
- $FF = FileOpen($Path1)
- $RF = FileReadLine($FF, 4)
- If $Read = $RF And FileExists($loc) Then
- Else
- $ver = StringReplace(StringReplace($RF, ' "release": "', ""), '"', "")
- If InetGet('https://s3.amazonaws.com/Minecraft.Download/versions/' & $ver & "/minecraft_server." & $ver & ".jar", $loc & "\minecraft_server.jar", 1, 0) = 1 Then RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Snapshot", "Version", "REG_SZ", $RF)
- EndIf
- FileDelete($Path1)
- Sleep(1)
- EndIf
- VanillaCustom($loc)
- EndFunc ;==>Vanilla
- Func VanillaCustom($loc);The function for downloading a certain vanilla version.
- If GUICtrlRead($Combo2) = "Vanilla" And GUICtrlRead($Combo3) = "1.6.4" Then InetGet('https://s3.amazonaws.com/Minecraft.Download/versions/' & "1.6.4" & "/minecraft_server." & "1.6.4" & ".jar", $loc & "\minecraft_server.jar", 1, 0);If your chosen vanilla version is 1.6.4, it downloads it.
- If GUICtrlRead($Combo2) = "Vanilla" And GUICtrlRead($Combo3) = "1.6.2" Then InetGet('https://s3.amazonaws.com/Minecraft.Download/versions/' & "1.6.2" & "/minecraft_server." & "1.6.2" & ".jar", $loc & "\minecraft_server.jar", 1, 0);If your chosen vanilla version is 1.6.2, it downloads it.
- If GUICtrlRead($Combo2) = "Vanilla" And GUICtrlRead($Combo3) = "1.5.2" Then InetGet('https://s3.amazonaws.com/Minecraft.Download/versions/' & "1.5.2" & "/minecraft_server." & "1.5.2" & ".jar", $loc & "\minecraft_server.jar", 1, 0);If your chosen vanilla version is 1.5.2, it downloads it.
- If GUICtrlRead($Combo2) = "Vanilla" And GUICtrlRead($Combo3) = "1.4.7" Then InetGet('https://s3.amazonaws.com/Minecraft.Download/versions/' & "1.4.7" & "/minecraft_server." & "1.4.7" & ".jar", $loc & "\minecraft_server.jar", 1, 0);If your chosen vanilla version is 1.4.7, it downloads it.
- If GUICtrlRead($Combo2) = "Vanilla" And GUICtrlRead($Combo3) = "1.4.5" Then InetGet('https://s3.amazonaws.com/Minecraft.Download/versions/' & "1.4.5" & "/minecraft_server." & "1.4.5" & ".jar", $loc & "\minecraft_server.jar", 1, 0);If your chosen vanilla version is 1.4.5, it downloads it.
- EndFunc ;==>VanillaCustom
- Func WriteStats();The function for saving settings.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Bungee", "Reg_SZ", GUICtrlRead($Bungee));Saves the value of the Bungee Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server1", "REG_SZ", GUICtrlRead($server1));Saves the value of the server1 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server2", "REG_SZ", GUICtrlRead($server2));Saves the value of the server2 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server3", "REG_SZ", GUICtrlRead($server3));Saves the value of the server3 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server4", "REG_SZ", GUICtrlRead($server4));Saves the value of the server4 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server5", "REG_SZ", GUICtrlRead($server5));Saves the value of the server5 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo", "REG_SZ", $chosen);Saves the value of the chosen Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo2", "REG_SZ", $chosen2);Saves the value of the chosen2 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo3", "REG_SZ", $chosen3);Saves the value of the chosen3 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Backup", "REG_SZ", $backupdir);Saves the value of the backupdir Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc0", "REG_SZ", $file0);Saves the value of the file0 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc1", "REG_SZ", $file1);Saves the value of the file1 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc2", "REG_SZ", $file2);Saves the value of the file2 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc3", "REG_SZ", $file3);Saves the value of the file3 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc4", "REG_SZ", $file4);Saves the value of the file4 Control.
- RegWrite("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc5", "REG_SZ", $file5);Saves the value of the file5 Control.
- EndFunc ;==>WriteStats
- Func ReadStats();The function for reading saved settings.
- $Read0 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Bungee");Sets the value of Read0 to the saved value of Bungee
- $Read2 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo");Sets the value of Read2 to the saved value of chosen
- $Read3 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo2");Sets the value of Read3 to the saved value of chosen2
- $Read4 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server1");Sets the value of Read4 to the saved value of server1
- $Read5 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server2");Sets the value of Read5 to the saved value of server2
- $Read6 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server3");Sets the value of Read6 to the saved value of server3
- $Read7 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server4");Sets the value of Read7 to the saved value of server4
- $Read8 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Server5");Sets the value of Read8 to the saved value of server5
- $Read9 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Combo3");Sets the value of Read9 to the saved value of chosen3
- $backupdir = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Backup");Sets the value of backupdir to the saved value of backupdir
- $file0 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc0");Sets the value of file0 to the saved value of file0
- $file1 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc1");Sets the value of file1 to the saved value of file1
- $file2 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc2");Sets the value of file2 to the saved value of file2
- $file3 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc3");Sets the value of file3 to the saved value of file3
- $file4 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc4");Sets the value of file4 to the saved value of file4
- $file5 = RegRead("HKEY_CURRENT_USER\Software\KnarCraft\Bungee Controller", "Loc5");Sets the value of file5 to the saved value of file5
- If Not $Read2 = "" Then GUICtrlSetData($Combo1, $Read2);Sets the value of Combo1 to the value of Read2 unless it's empty.
- If Not $Read3 = "" Then GUICtrlSetData($Combo2, $Read3);Sets the value of Combo2 to the value of Read3 unless it's empty.
- If Not $Read9 = "" Then GUICtrlSetData($Combo3, $Read9);Sets the value of Combo3 to the value of Read9 unless it's empty.
- If $Read4 = 1 Then GUICtrlSetState($server1, $GUI_CHECKED);If the value of Read4 is 1, sets the state of the server1 checkbox to checked.
- If $Read5 = 1 Then GUICtrlSetState($server2, $GUI_CHECKED);If the value of Read5 is 1, sets the state of the server2 checkbox to checked.
- If $Read6 = 1 Then GUICtrlSetState($server3, $GUI_CHECKED);If the value of Read6 is 1, sets the state of the server3 checkbox to checked.
- If $Read7 = 1 Then GUICtrlSetState($server4, $GUI_CHECKED);If the value of Read7 is 1, sets the state of the server4 checkbox to checked.
- If $Read8 = 1 Then GUICtrlSetState($server5, $GUI_CHECKED);If the value of Read8 is 1, sets the state of the server5 checkbox to checked.
- If $Read0 = 1 Then GUICtrlSetState($Bungee, $GUI_CHECKED)
- EndFunc ;==>ReadStats
- Func Backup();The function for making a backup of the enabled servers.
- GUISetState(@SW_HIDE, $GUI);Hides the main GUI.
- $Pgui = GUICreate("Backup Progress", 280, 25);Making a new GUI named Backup Progress.
- GUISetState(@SW_SHOW, $Pgui);Setting the state of the new gui as shown.
- $Progress = GUICtrlCreateProgress("", "", 280, 25, BitOR($PBS_SMOOTH, $WS_BORDER), $WS_EX_CLIENTEDGE);Creates a progress bar that shows what servers have been backuped.
- GUICtrlSetData($Progress, 0);Setting the progress of the progress bar to 0%
- If GUICtrlRead($server1) = 1 Then DirCopy($file1, $backupdir & "\Server1\" & " " & @HOUR & ";" & @MIN & " " & @MDAY & "-" & @MON & "-" & @YEAR);Copying the directory of the Server1 folder to the backup folder.
- GUICtrlSetData($Progress, 20);Setting the progress of the progress bar to 20%
- If GUICtrlRead($server2) = 1 Then DirCopy($file2, $backupdir & "\Server2\" & " " & @HOUR & ";" & @MIN & " " & @MDAY & "-" & @MON & "-" & @YEAR);Copying the directory of the Server2 folder to the backup folder.
- GUICtrlSetData($Progress, 40);Setting the progress of the progress bar to 40%
- If GUICtrlRead($server3) = 1 Then DirCopy($file3, $backupdir & "\Server3\" & " " & @HOUR & ";" & @MIN & " " & @MDAY & "-" & @MON & "-" & @YEAR);Copying the directory of the Server3 folder to the backup folder.
- GUICtrlSetData($Progress, 60);Setting the progress of the progress bar to 60%
- If GUICtrlRead($server4) = 1 Then DirCopy($file4, $backupdir & "\Server4\" & " " & @HOUR & ";" & @MIN & " " & @MDAY & "-" & @MON & "-" & @YEAR);Copying the directory of the Server4 folder to the backup folder.
- GUICtrlSetData($Progress, 80);Setting the progress of the progress bar to 80%
- If GUICtrlRead($server5) = 1 Then DirCopy($file5, $backupdir & "\Server5\" & " " & @HOUR & ";" & @MIN & " " & @MDAY & "-" & @MON & "-" & @YEAR);Copying the directory of the Server5 folder to the backup folder.
- GUICtrlSetData($Progress, 100);Setting the progress of the progress bar to 100%
- GUIDelete($Pgui);Deletes the Backup Progress GUI.
- GUISetState(@SW_SHOW, $GUI);Shows the main GUI.
- EndFunc ;==>Backup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement