Sign in to follow this  
Followers 0
C45Y

Minecraft Server Frontend

2 posts in this topic

#1 ·  Posted (edited)

So I've had a little free time today and decided I was finally sick of the default Minecraft server options.

So I wrote a front end to it!

Now supports beeping on user login and disconnection

And a shutdown command that can be used to restart the host computer from the minecraft console[RD always annoys me]

MOTD and rules banner every 20min

But this is just the beginning, im taking suggestions and talking to people and there will be alot more implemented in future releases, this is more a test.

Anyways enough talking, here's the source, download is below that. just place minecraft_server.jar in the same dir and your good to go!

Download available at:

http://twentylinesofcode.blogspot.com/2011/01/minecraft-server-front-end.html

Most current source available below or on website

Edited by C45Y

http://twentylinesofcode.blogspot.comLittle apps n crap. can be fun

Share this post


Link to post
Share on other sites



NO LONGER BEING DEVELOPED

sorry but due to increased uni workload I no longer have time to work on this.

Currently the final relese of source is here:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=MSW.ico
#AutoIt3Wrapper_Outfile=CustomServer0xA01.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#NoTrayIcon
#include <Constants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>
#Include <Array.au3>
#Include <GuiEdit.au3>


Local $serverl = 0
Local $previous_bytes = 0
Local $filename = "server.log"
If FileExists($filename) Then
    FileDelete($filename)
    FileWrite($filename, "")
EndIf
If Not FileExists("settings.ini") Then
    IniWrite("settings.ini", "RESTART", "COMMAND", "restarthostboxpleaseOP")
    IniWrite("settings.ini", "BEEP", "BOOL", "TRUE")
    IniWrite("settings.ini", "JAVA", "LOCATION", @ProgramFilesDir & "\Java\jre6\bin\java.exe")
    IniWrite("settings.ini", "MOTD", "STRING", "HELLO AND WELCOME TO C45Y CUSTOM SERVER 0xA01")
    IniWrite("settings.ini", "ADMIN", "STRING", @UserName)
    IniWrite("settings.ini", "RULES", "STRING", "DONT GRIEF! |RESPECT ADMINS")
EndIf
$MOTD = IniRead("settings.ini", "MOTD", "STRING", "")
$MOTD = StringReplace($MOTD, @CRLF, Chr(10))
$ADMIN = IniRead("settings.ini", "ADMIN", "STRING", "")
$RULES = IniRead("settings.ini", "RULES", "STRING", "")

$Form1 = GUICreate("C45Y Custom Server 0xA01", 789, 484, -1, -1, $WS_POPUP + $WS_CAPTION)
$startserver = GUICtrlCreateButton("Start Server", 8, 8, 115, 25, $WS_GROUP)
GUICtrlSetState($startserver, $GUI_DISABLE)
$stopserver = GUICtrlCreateButton("Stop Server", 125, 8, 115, 25, $WS_GROUP)
$quitserver = GUICtrlCreateButton("Exit", 245, 8, 25, 25, $WS_GROUP)
GUICtrlSetState($quitserver, $GUI_DISABLE)
$console = GUICtrlCreateEdit("", 8, 40, 769, 409)
GUICtrlSetData(-1, "C45Y Custom Server 0xA01" & @CRLF & @CRLF)
$command = GUICtrlCreateInput("", 8, 456, 649, 21)
$send = GUICtrlCreateButton("Send", 664, 454, 75, 25, $WS_GROUP)
$list = GUICtrlCreateButton("List", 744, 454, 35, 25, $WS_GROUP)
$properties = GUICtrlCreateButton("Open Server properties", 656, 8, 123, 25, $WS_GROUP)
$settings = GUICtrlCreateButton("Settings", 595, 8, 60, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

local $time = Mod(@MIN + 20,60)
Local $serverl = 0
If ProcessExists("java.exe") Then ProcessClose("java.exe")
$serverl = Run('"' & IniRead("settings.ini", "JAVA", "LOCATION", @ProgramFilesDir & "\Java\jre6\bin\java.exe") & '" -Xms1024M -Xmx1024M -jar minecraft_server.jar  nogui', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD + $STDIN_CHILD)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $stopserver
            If ProcessExists("java.exe") Then
                StdinWrite($serverl, "save-all" & @CRLF)
                StdinWrite($serverl, "stop" & @CRLF)
                GUICtrlSetState($startserver, $GUI_ENABLE)
                GUICtrlSetState($quitserver, $GUI_ENABLE)
            EndIf
        Case $startserver
            If ProcessExists("java.exe") Then ProcessClose("java.exe")
            $serverl = Run('"' & IniRead("settings.ini", "JAVA", "LOCATION", @ProgramFilesDir & "\Java\jre6\bin\java.exe") & '" -Xms1024M -Xmx1024M -jar minecraft_server.jar  nogui', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD + $STDIN_CHILD)
            GUICtrlSetState($startserver, $GUI_DISABLE)
            GUICtrlSetState($quitserver, $GUI_DISABLE)
        Case $quitserver
            If ProcessExists("java.exe") Then ProcessClose("java.exe")
            Exit
        Case $list
            StdinWrite($serverl, "list" & @CRLF)
        Case $settings
            Run("notepad.exe settings.ini")
        Case $send, $command
            $input = GUICtrlRead($command)
            GUICtrlSetData($command, "")
            StdinWrite($serverl, $input & @CRLF)
        Case $properties
            Run("notepad.exe server.properties")
        Case Else
            _updateConsole()
            if @min = $time Then
                $time = Mod(@MIN + 20,60)
                StdinWrite($serverl, "say MOTD: " & $MOTD & @CRLF)
                StdinWrite($serverl, "say ADMIN: " & $ADMIN & @CRLF)
                
                $localrules = StringSplit($RULES,"|")
                for $i = 1 to $localrules[0] Step 1
                StdinWrite($serverl, "say RULES: " & $localrules[$i] & @CRLF)
            Next
            EndIf
        EndSwitch
        _GUICtrlEdit_Scroll($console, $SB_LINEDOWN)
WEnd

Func _updateConsole()
    $data = StdoutRead($serverl)
    If $data Then
        GUICtrlSetData($console, GUICtrlRead($console) & $data)
    EndIf
    If FileExists($filename) Then
        $bytes = FileGetSize($filename)
        If Not ($previous_bytes = $bytes) Then
            $open = FileOpen($filename)
            FileSetPos($open, $previous_bytes, $FILE_BEGIN)
            $log = FileRead($open)
            If StringInStr($log, "logged in") Then
                $user = StringTrimLeft($log,26)
                $user = StringTrimRight($user,47)
                
                
                If IniRead("settings.ini", "BEEP", "BOOL", "TRUE") == "TRUE" Then
                    Beep(600, 300)
                    Beep(800, 300)
                EndIf
            EndIf
            If StringInStr($log, "tried command: " & IniRead("settings.ini", "RESTART", "COMMAND", "")) Then ;restart command
                MsgBox(0, "", "This is where it would normally restart!")
            EndIf
            If StringInStr($log, "lost") Then
                If IniRead("settings.ini", "BEEP", "BOOL", "TRUE") == "TRUE" Then
                    Beep(700, 300)
                    Beep(400, 300)
                EndIf
            EndIf
            $log = StringReplace($log, Chr(10), @CRLF)
            FileClose($open)
            GUICtrlSetData($console, GUICtrlRead($console) & $log)
            $previous_bytes = $bytes
        EndIf
    EndIf
EndFunc   ;==>_updateConsole

Features:

- MOTD

- Special commands

- Beep on logon

- carousel message on timer

- Rules message

Thanks guys.

If anyone wants to pursue this further feel free to contact me


http://twentylinesofcode.blogspot.comLittle apps n crap. can be fun

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0