Hier ist mein erstes richtiges Projekt in AutoIt: der Minecraft-Server-Editor.
Was macht das Programm?
Mit diesem Programm kann man einfach eine bestehende server.properties-Datei bearbeiten.
Screen:
[Blockierte Grafik: http://i.imgur.com/7T5Mh6Y.png]
Source Code:
Spoiler anzeigen
#include <File.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Minecraft-Server-Editor", 418, 434, 199, 129)
$basic = GUICtrlCreateGroup("Basic", 8, 0, 185, 169)
$label_difficulty = GUICtrlCreateLabel("Difficulty:", 16, 16, 47, 17)
$combo_difficulty = GUICtrlCreateCombo("", 88, 16, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Peacefull|Easy|Normal|Hard")
$label_gamemode = GUICtrlCreateLabel("Gamemode:", 16, 40, 61, 17)
$combo_gamemode = GUICtrlCreateCombo("", 88, 40, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Survival|Creative|Adventure")
$label_level_name = GUICtrlCreateLabel("Level-Name:", 16, 64, 64, 17)
$input_level_name = GUICtrlCreateInput("", 88, 64, 89, 21)
$label_max_player = GUICtrlCreateLabel("Max-Players:", 16, 88, 64, 17)
$input_max_player = GUICtrlCreateInput("", 88, 88, 89, 21)
$label_online_mode = GUICtrlCreateLabel("Online Mode:", 16, 112, 67, 17)
$combo_online_mode = GUICtrlCreateCombo("", 88, 112, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_pvp = GUICtrlCreateLabel("PvP:", 16, 136, 27, 17)
$combo_pvp = GUICtrlCreateCombo("", 88, 136, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$additional1 = GUICtrlCreateGroup("Additional 1", 224, 0, 185, 169)
$label_flying = GUICtrlCreateLabel("Flying:", 232, 16, 34, 17)
$combo_flying = GUICtrlCreateCombo("", 304, 16, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_nether = GUICtrlCreateLabel("Nether:", 232, 40, 39, 17)
$combo_nether = GUICtrlCreateCombo("", 304, 40, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_structures = GUICtrlCreateLabel("Structures:", 232, 64, 55, 17)
$combo_structures = GUICtrlCreateCombo("", 304, 64, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_seed = GUICtrlCreateLabel("Seed:", 232, 88, 32, 17)
$input_seed = GUICtrlCreateInput("", 304, 88, 89, 21)
$label_type = GUICtrlCreateLabel("Type:", 232, 112, 31, 17)
$combo_type = GUICtrlCreateCombo("", 304, 112, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Default|Flat|Largebiomes")
$label_white_list = GUICtrlCreateLabel("White-List:", 232, 136, 54, 17)
$combo_white_list = GUICtrlCreateCombo("", 304, 136, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$additional2 = GUICtrlCreateGroup("Additional 2", 8, 176, 401, 217)
$label_query = GUICtrlCreateLabel("Query:", 16, 192, 38, 17)
$combo_query = GUICtrlCreateCombo("", 112, 192, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_generator_settings = GUICtrlCreateLabel("Generator-Settings:", 16, 216, 95, 17)
$input_generator = GUICtrlCreateInput("", 112, 216, 89, 21)
$label_description = GUICtrlCreateLabel("Description:", 16, 240, 60, 17)
$input_description = GUICtrlCreateInput("", 112, 240, 89, 21)
$label_server_ip = GUICtrlCreateLabel("Server-IP:", 16, 264, 51, 17)
$input_server_ip = GUICtrlCreateInput("", 112, 264, 89, 21)
$label_server_port = GUICtrlCreateLabel("Server-Port:", 16, 288, 60, 17)
$input_server_port = GUICtrlCreateInput("", 112, 288, 89, 21)
$label_snooper = GUICtrlCreateLabel("Snooper:", 216, 312, 47, 17)
$combo_snooper = GUICtrlCreateCombo("", 304, 312, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_spawn_animal = GUICtrlCreateLabel("Spawn Animals:", 216, 192, 79, 17)
$combo_spawn_animals = GUICtrlCreateCombo("", 304, 192, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_spawn_monsters = GUICtrlCreateLabel("Spawn Monsters:", 216, 216, 86, 17)
$combo_spawn_monsters = GUICtrlCreateCombo("", 304, 216, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Diesabled")
$label_spawn_npcs = GUICtrlCreateLabel("Spawn NPCs:", 216, 240, 70, 17)
$combo_spawn_npcs = GUICtrlCreateCombo("", 304, 240, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_texturepack = GUICtrlCreateLabel("Texturepack:", 216, 264, 67, 17)
$input_texturepack = GUICtrlCreateInput("", 304, 264, 89, 21)
$label_view_distance = GUICtrlCreateLabel("View-Distance:", 216, 288, 75, 17)
$input_view_distance = GUICtrlCreateInput("", 304, 288, 89, 21)
$label_enableRcon = GUICtrlCreateLabel("Rcon:", 16, 312, 33, 17)
$combo_enableRcon = GUICtrlCreateCombo("", 112, 312, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Enabled|Disabled")
$label_rconPassword = GUICtrlCreateLabel("Rcon-Password:", 16, 336, 82, 17)
$input_rconPassword = GUICtrlCreateInput("", 112, 336, 89, 21)
$label_rconPort = GUICtrlCreateLabel("Rcon-Port:", 16, 360, 55, 17)
$input_rconPort = GUICtrlCreateInput("", 112, 360, 89, 21)
$label_qureyPort = GUICtrlCreateLabel("Query-Port:", 216, 336, 57, 17)
$input_queryPort = GUICtrlCreateInput("", 304, 336, 89, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
[/autoit] [autoit][/autoit] [autoit]$button_save = GUICtrlCreateButton("Save", 8, 400, 195, 25)
[/autoit] [autoit][/autoit] [autoit]$button_exit = GUICtrlCreateButton("Exit", 216, 400, 195, 25)
[/autoit] [autoit][/autoit] [autoit]GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$file = "server.properties"
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button_save
_Save()
Case $button_exit
Exit
EndSwitch
WEnd
Func _Save()
If FileExists($file) Then FileDelete($file)
$difficulty = GUICtrlRead($combo_difficulty)
$gameMode = GUICtrlRead($combo_gamemode)
$levelName = GUICtrlRead($input_level_name)
$maxPlayer = GUICtrlRead($input_max_player)
$onlineMode = GUICtrlRead($combo_online_mode)
$pvp = GUICtrlRead($combo_pvp)
$flight = GUICtrlRead($combo_flying)
$nether = GUICtrlRead($combo_nether)
$generateStructures = GUICtrlRead($combo_structures)
$levelSeed = GUICtrlRead($input_seed)
$levelType = GUICtrlRead($combo_type)
$whiteList = GUICtrlRead($combo_white_list)
$qery = GUICtrlRead($combo_query)
$generatorSettings = GUICtrlRead($input_generator)
$motd = GUICtrlRead($input_description)
$serverIP = GUICtrlRead($input_server_ip)
$serverPort = GUICtrlRead($input_server_port)
$snooper = GUICtrlRead($combo_snooper)
$spawnAnimals = GUICtrlRead($combo_spawn_animals)
$spawnMonster = GUICtrlRead($combo_spawn_monsters)
$spawnNPCs = GUICtrlRead($combo_spawn_npcs)
$texturepack = GUICtrlRead($input_texturepack)
$viewDistance = GUICtrlRead($input_view_distance)
$rcon = GUICtrlRead($combo_enableRcon)
$rconPassword = GUICtrlRead($input_rconPassword)
$rconPort = GUICtrlRead($input_rconPort)
$queryPort = GUICtrlRead($input_queryPort)
If $difficulty = "Peacefull" Then IniWrite($file, "temp", "difficulty", "0")
If $difficulty = "Easy" Then IniWrite($file, "temp", "difficulty", "1")
If $difficulty = "Normal" Then IniWrite($file, "temp", "difficulty", "2")
If $difficulty = "Hard" Then IniWrite($file, "temp", "difficulty", "3")
If $gameMode = "Survival" Then IniWrite($file, "temp", "game-mode", "0")
If $difficulty = "Creative" Then IniWrite($file, "temp", "game-mode", "1")
If $difficulty = "Adventure" Then IniWrite($file, "temp", "game-mode", "2")
IniWrite($file, "temp", "level-name", $levelName)
[/autoit] [autoit][/autoit] [autoit]IniWrite($file, "temp", "max-player", $maxPlayer)
[/autoit] [autoit][/autoit] [autoit]If $onlineMode = "Enabled" Then IniWrite($file, "temp", "online-mode", "true")
If $onlineMode = "Disabled" Then IniWrite($file, "temp", "online-mode", "false")
If $pvp = "Enabled" Then IniWrite($file, "temp", "pvp", "true")
If $pvp = "Disabled" Then IniWrite($file, "temp", "pvp", "false")
If $flight = "Enabled" Then IniWrite($file, "temp", "allow-flight", "true")
If $flight = "Disabled" Then IniWrite($file, "temp", "allow-flight", "false")
If $nether = "Enabled" Then IniWrite($file, "temp", "allow-nether", "true")
If $nether = "Disabled" Then IniWrite($file, "temp", "allow-nether", "false")
If $generateStructures = "Enabled" Then IniWrite($file, "temp", "generate-structures", "true")
If $generateStructures = "Diesabled" Then IniWrite($file, "temp", "generate-structures", "false")
IniWrite($file, "temp", "level-seed", $levelSeed)
[/autoit] [autoit][/autoit] [autoit]If $levelType = "Default" Then IniWrite($file, "temp", "level-type", "DEFAULT")
If $levelType = "Flat" Then IniWrite($file, "temp", "level-type", "FLAT")
If $levelType = "Largebiomes" Then IniWrite($file, "temp", "level-type", "LARGEBIOMES")
If $whiteList = "Enabled" Then IniWrite($file, "temp", "white-list", "true")
If $whiteList = "Disabled" Then IniWrite($file, "temp", "white-list", "false")
If $qery = "Enabled" Then IniWrite($file, "temp", "enable-query", "true")
If $qery = "Disabled" Then IniWrite($file, "temp", "enable-query", "false")
IniWrite($file, "temp", "generator-settings", $generatorSettings)
[/autoit] [autoit][/autoit] [autoit]IniWrite($file, "temp", "motd", $motd)
[/autoit] [autoit][/autoit] [autoit]IniWrite($file, "temp", "server-ip", $serverIP)
[/autoit] [autoit][/autoit] [autoit]IniWrite($file, "temp", "server-port", $serverPort)
[/autoit] [autoit][/autoit] [autoit]If $snooper = "Enabled" Then IniWrite($file, "temp", "enable-snooper", "true")
If $snooper = "Disabled" Then IniWrite($file, "temp", "enable-snooper", "false")
If $spawnAnimals = "Enabled" Then IniWrite($file, "temp", "spawn-animals", "true")
If $spawnAnimals = "Disabled" Then IniWrite($file, "temp", "spawn-animals", "false")
If $spawnMonster = "Enabled" Then IniWrite($file, "temp", "spawn-monsters", "true")
If $spawnAnimals = "Disabled" Then IniWrite($file, "temp", "spawn-monsters", "false")
If $spawnNPCs = "Enabled" Then IniWrite($file, "temp", "spawn-npcs", "true")
If $spawnNPCs = "Disabled" Then IniWrite($file, "temp", "spawn-npcs", "false")
IniWrite($file, "temp", "texturepack", $texturepack)
[/autoit] [autoit][/autoit] [autoit]IniWrite($file, "temp", "view-distance", $viewDistance)
[/autoit] [autoit][/autoit] [autoit]If $rcon = "Enabled" Then IniWrite($file, "temp", "enable-rcon", "true")
If $rcon = "Disabled" Then IniWrite($file, "temp", "enable-rcon", "false")
IniWrite($file, "temp", "rcon.password", $rconPassword)
[/autoit] [autoit][/autoit] [autoit]IniWrite($file, "temp", "rcon.port", $rconPort)
[/autoit] [autoit][/autoit] [autoit]IniWrite($file, "temp", "query.port", $queryPort)
[/autoit] [autoit][/autoit] [autoit]_FileWriteToLine($file, 1, "", 1)
EndFunc
Download:
v2.0.3
Programm Mirror #1
Source Code Mirror #1