diff --git a/mc_control.py b/mc_control.py index f503b7b..7d338f4 100644 --- a/mc_control.py +++ b/mc_control.py @@ -44,17 +44,16 @@ def list_servers(mode=int(1)): # make sure a default is set. # Creates new server dicts in the server array. def create_server(): - global servers + global servers # Global so that we can write to it. print('\n=== Add Server ===') srv_name = input('Name: ') srv_addr = input('Address: ') srv_port = input('Port: ') srv_pass = input('Password: ') print('OK\n') - new_server = [{"name":srv_name,"address":srv_addr,"port":srv_port,"password":srv_pass}] - servers = servers + new_server - write_servers() - initial_choice() + new_server = [{"name":srv_name,"address":srv_addr,"port":srv_port,"password":srv_pass}] # Build new dict in array. + servers = servers + new_server # Append new array to existing array. + write_servers() # Write to the file. def pop_server(): global servers @@ -106,6 +105,7 @@ def initial_choice(): match choose_func: case "1": create_server() + initial_choice() case "2": pop_server() case "3":