-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMC_Settings.py
More file actions
38 lines (33 loc) · 1.01 KB
/
MC_Settings.py
File metadata and controls
38 lines (33 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import json
DefaultSettings = {
'remote_dir' : 'Minecraft',
'world_name' : '',
'server_jar_compiler_command' : '',
'server_jar_dir' : '',
'server_jar' : 'server',
'_target_host' : '',
'_proxy_host' : '',
'_proxy_port' : 443,
'_client_cert' : '',
'_client_key' : '',
'_known_hosts' : 'known_hosts',
'_private_key' : '',
'_max_backups' : 4
}
_CheckSettings = ('world_name', '_target_host')
def ReadSettings():
if not os.path.exists('settings.json') or os.stat('settings.json').st_size == 0:
Settings = DefaultSettings
with open('settings.json', 'w', encoding='utf-8') as f:
json.dump(Settings, f, indent=2)
f.close()
else:
with open('settings.json', encoding='utf-8') as f:
Settings = json.load(f)
f.close()
for Check in _CheckSettings:
if Settings[Check] == '':
Settings = None
break
return Settings