-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvanilla.py
92 lines (80 loc) · 2.62 KB
/
vanilla.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import os
import socket
from requests import get
# 1: Get minecraft version
version = input("What Minecraft version do you want? ")
# Download via version
if version == '':
print("Getting 1.14.3 version...")
os.system("wget https://launcher.mojang.com/v1/objects/d0d0fe2b1dc6ab4c65554cb734270872b72dadd6/server.jar")
elif version == "1.14.3":
os.system("wget https://launcher.mojang.com/v1/objects/d0d0fe2b1dc6ab4c65554cb734270872b72dadd6/server.jar")
# Download via URL
else:
print("Oops your version seems to not be detected")
URL = input("Can you give us the download URL? ")
URL = "wget " + URL
os.system(URL)
# Download via FTP
next = "0"
while next == "0":
try:
f = open('server.jar')
f.close()
print("FILE FOUND!")
next = "1"
except FileNotFoundError:
os.system("clear")
input("Please put the server.jar file into this directory then press enter... ")
# ------------------------------------------------------
# Run the file and get eula
os.system("chmod +x server.jar")
os.system("java -jar server.jar >/dev/null")
os.system("cp /opt/MCSS/server/* .")
# 2: Modify Server.properties
os.system("clear")
next = input("Do you want to modify properties [Y, n] ")
if next == 'Y' or next == 'y':
os.system("atom server.properties")
status = input("When you finished press enter... ")
# 3: Ip addresses informations
os.system("clear")
print("[SERVER IS ALMOST READY]")
print("This is your IP address")
print("For you : localhost")
private = socket.getfqdn()
print("For your local network: ", private)
# Public
public = input("Do you want to be avaiable world wide? [Y, n] ")
if public == 'Y' or public == 'y':
print("Open http://192.168.1.1")
print("Create a new portmap with 25565 as port and ", private, "as IP address")
input("Press enter when you finished: ")
public = get('https://api.ipify.org').text
print(public)
status = 1
file = open("status.txt", "w")
file.write('1')
file.close()
else:
os.system("clear")
print("[SERVER IS READY]")
print("This is your IP address")
print("For you : localhost")
print("For your local network: ", private)
file = open("status.txt", "w")
file.write('0')
file.close()
# 4: Play!
os.system("clear")
print("[SERVER IS READY]")
print("This is your IP address")
print("For you : localhost")
print("For your local network: ", private)
if status == 1:
print("WORLD WIDE: ", public)
os.system("java -jar server.jar >/dev/null")
# Copy the start script
os.system("sudo cp /opt/MCSS/start.py .")
# Ask
os.system("sudo rm vanilla.py")