Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_Icon=C:\Users\Kristian\Downloads\Minecraft Icon Version III.ico
- #AutoIt3Wrapper_Compression=4
- #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #include <ButtonConstants.au3>
- #include <ComboConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <GuiToolbar.au3>
- #include <StaticConstants.au3>
- #include <ToolbarConstants.au3>
- #include <WindowsConstants.au3>
- #include <GUIConstants.au3>
- #include <Misc.au3>
- #include <EditConstants.au3>
- #include <WindowsConstants.au3>
- #include <GuiComboBoxEx.au3>
- #include <TreeViewConstants.au3>
- #include <GuiTreeView.au3>
- #region ### START Koda GUI section ### Form=c:\users\kristian\desktop\test.kxf
- $Test = GUICreate("KnarCraft MineCraft Server Client -Made by Kristian Knarvik/EpicKnarvik97", 945, 150, 0, 0)
- $Button1 = GUICtrlCreateButton("Start Server", 24, 85, 75, 25)
- $Button2 = GUICtrlCreateButton("Stop Server", 840, 85, 75, 25)
- $Button3 = GUICtrlCreateButton("Kick", 112, 85, 75, 25)
- $Checkbox1 = GUICtrlCreateCheckbox("Hide Console", 24, 60, 97, 17)
- $Command_Arguments = GUICtrlCreateInput("", 392, 85, 320, 21)
- $Button4 = GUICtrlCreateButton("Ban", 208, 85, 75, 25)
- $Button5 = GUICtrlCreateButton("OP", 304, 85, 75, 25)
- $Button6 = GUICtrlCreateButton("Custom Command", 728, 85, 91, 25)
- $Button7 = GUICtrlCreateButton("Save Server", 840, 60, 75, 25)
- $Label1 = GUICtrlCreateLabel("Choose Server Memory", 24, 10, 166, 20)
- GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
- $Combo1 = GUICtrlCreateCombo("-Xmx512M", 24, 35, 161, 25, $CBS_DROPDOWNLIST)
- GUICtrlSetData(-1, "-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M|-Xmx5120M|-Xmx6144M|-Xmx7168M|-Xmx8192M|-Xmx9216M|-Xmx10240M")
- $filemenu = GUICtrlCreateMenu("File")
- $fileitem = GUICtrlCreateMenuItem("Open...", $filemenu)
- $separator1 = GUICtrlCreateMenuItem("", $filemenu)
- $helpmenu = GUICtrlCreateMenu("Help")
- $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)
- GUISetState(@SW_SHOW)
- #endregion ### END Koda GUI section ###
- ReadStats()
- While 1
- $chosen = GUICtrlRead($Combo1)
- $args = GUICtrlRead($Command_Arguments)
- $nMsg = GUIGetMsg()
- If GUICtrlRead($Checkbox1) = 1 Then
- $Hide = @SW_HIDE
- Else
- $Hide = @SW_SHOW
- EndIf
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- $exit = MsgBox(1, "KnarCraft", "Do you want to close the client?")
- WriteStats()
- If $exit = 1 Then Exit
- Case $Button1
- Hub_func()
- Case $Button3
- Opt("WinTitleMatchMode", 3)
- $hwnd = WinGetHandle("Minecraft Server")
- If @error Then
- MsgBox(16, "Failure", "The server isn't running")
- Else
- SoundPlay("C:\Program Files (x86)\KnarCraft\Blop-Mark_DiAngelo-79054334.mp3", 0)
- WinActivate($hwnd)
- ControlSend("Minecraft Server", "", $hwnd, 'kick ')
- ControlSend("Minecraft Server", "", $hwnd, $args)
- ControlSend("Minecraft Server", "", $hwnd, '{ENTER}')
- EndIf
- Case $Button4
- Opt("WinTitleMatchMode", 3)
- $hwnd = WinGetHandle("Minecraft Server")
- If @error Then
- MsgBox(16, "Failure", "The server isn't running")
- Else
- SoundPlay("C:\Program Files (x86)\KnarCraft\Blop-Mark_DiAngelo-79054334.mp3", 0)
- WinActivate($hwnd)
- ControlSend("Minecraft Server", "", $hwnd, 'ban ')
- ControlSend("Minecraft Server", "", $hwnd, $args)
- ControlSend("Minecraft Server", "", $hwnd, '{ENTER}')
- EndIf
- Case $Button5
- Opt("WinTitleMatchMode", 3)
- $hwnd = WinGetHandle("Minecraft Server")
- If @error Then
- MsgBox(16, "Failure", "The server isn't running")
- Else
- SoundPlay("C:\Program Files (x86)\KnarCraft\Blop-Mark_DiAngelo-79054334.mp3", 0)
- WinActivate($hwnd)
- ControlSend("Minecraft Server", "", $hwnd, 'op ')
- ControlSend("Minecraft Server", "", $hwnd, $args)
- ControlSend("Minecraft Server", "", $hwnd, '{ENTER}')
- EndIf
- Case $Button7
- Opt("WinTitleMatchMode", 3)
- $hwnd = WinGetHandle("Minecraft Server")
- If @error Then
- MsgBox(16, "Failure", "The server isn't running")
- Else
- SoundPlay("C:\Program Files (x86)\KnarCraft\Blop-Mark_DiAngelo-79054334.mp3", 0)
- WinActivate($hwnd)
- ControlSend("Minecraft Server", "", $hwnd, 'save-all {ENTER}')
- EndIf
- Case $Button6
- Opt("WinTitleMatchMode", 3)
- $hwnd = WinGetHandle("Minecraft Server")
- If @error Then
- MsgBox(16, "Failure", "The server isn't running")
- Else
- SoundPlay("C:\Program Files (x86)\KnarCraft\Blop-Mark_DiAngelo-79054334.mp3", 0)
- WinActivate($hwnd)
- ControlSend("Minecraft Server", "", $hwnd, $args)
- ControlSend("Minecraft Server", "", $hwnd, '{ENTER}')
- EndIf
- Case $Button2
- Opt("WinTitleMatchMode", 3)
- $hwnd = WinGetHandle("Minecraft Server")
- If @error Then
- MsgBox(16, "Failure", "The server isn't running")
- Else
- SoundPlay("C:\Program Files (x86)\KnarCraft\Blop-Mark_DiAngelo-79054334.mp3", 0)
- ConsoleWrite("Window handle is " & $hwnd & @CRLF)
- WinActivate($hwnd)
- Send("stop {ENTER}")
- EndIf
- Case $fileitem
- $loc = FileSelectFolder("Choose file location...", "\")
- $file = FileOpenDialog("Choose file...", $loc, "Jar Files (*.jar*)")
- IniWrite("C:\Program Files (x86)\KnarCraft\Config.ini", "Server File", "File", $file)
- IniWrite("C:\Program Files (x86)\KnarCraft\Config.ini", "Server File", "Loc", $loc)
- Case $aboutitem
- MsgBox(0, "Server Client", "This is a client that lets you easily control the server. Just click File then open and go to your server jarfile. It will be saved with your other settings under C:\Program Files (x86)\KnarCraft\Config.ini Then choose how much server memory you want to dedicate from the dropbox. If you want, you can also check the Hide Console checkbox to prevent the console window from popping up. Then just start the server with the start server button and you are good to go. The kick/ban/op buttons do what they say against the name in the text box. The save server button runs save-all and the stop server button runs stop. The custom command button allows every button you can use from the console. Just type in every command you want in the white box and hit the button. Remember. Since it's a console command, don't use / before the command.")
- EndSwitch
- WEnd
- Func WriteStats()
- IniWrite("C:\Program Files (x86)\KnarCraft\Config.ini", "Checkbox", "Check1", GUICtrlRead($Checkbox1))
- IniWrite("C:\Program Files (x86)\KnarCraft\Config.ini", "Combo", "Comb1", $chosen)
- EndFunc
- Func ReadStats()
- $Read1 = IniRead("C:\Program Files (x86)\KnarCraft\Config.ini", "Checkbox", "Check1", "1")
- $Read3 = IniRead("C:\Program Files (x86)\KnarCraft\Config.ini", "Combo", "Comb1", StringSplit("-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M", "|"))
- Global $file = IniRead("C:\Program Files (x86)\KnarCraft\Config.ini", "Server File", "File", "")
- Global $loc = IniRead("C:\Program Files (x86)\KnarCraft\Config.ini", "Server File", "Loc", "")
- GUICtrlSetData($Combo1, IniRead("C:\Program Files (x86)\KnarCraft\Config.ini", "Combo", "Comb1", "-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M"))
- If $Read1 = Int(1) = 1 Then
- GUICtrlSetState($Checkbox1, $GUI_CHECKED)
- Else
- GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
- EndIf
- EndFunc
- Func Hub_func()
- If $file = "" Then
- MsgBox(16, "Failure", "No Server chosen")
- Else
- SoundPlay("C:\Program Files (x86)\KnarCraft\Blop-Mark_DiAngelo-79054334.mp3", 0)
- Run('java -jar "' & $chosen & '" "' & $file & '"', $loc, $Hide)
- Sleep(100)
- WinSetTitle("C:\Windows\system32\java.exe", "", "Minecraft Server")
- EndIf
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement