-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Se añade el código de la herramienta lanzador en inglés, para esta release, en el lenguaje Python.
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#MODULES | ||
import os | ||
import time | ||
import sys | ||
import ctypes | ||
import subprocess | ||
import webbrowser | ||
|
||
#CONSOLE CLEAR | ||
def limpiar_consola(): | ||
if os.name == 'nt':#WINDOWS | ||
os.system('cls') | ||
else:#LINUX OR MACOS | ||
os.system('clear') | ||
|
||
#CONSOLE TITLE CHANGE | ||
if sys.platform.startswith('win32'):#WINDOWS | ||
ctypes.windll.kernel32.SetConsoleTitleW("Server Launcher for Minecraft") | ||
elif sys.platform.startswith('linux') or sys.platform.startswith('darwin'):#LINUX OR MACOS | ||
sys.stdout.write(f"\x1b]2;Server Launcher for Minecraft\x07") | ||
|
||
#RAM START | ||
def ram(): | ||
limpiar_consola() | ||
print("Server Launcher for Minecraft\n-------------------------------------\n\nYou can return to main menu with 'N' or") | ||
entrada = input("Type the GB of RAM to assign to the Server= ") | ||
try: | ||
if entrada.lower() == 'n': | ||
return | ||
else: | ||
gbs = int(entrada) | ||
limpiar_consola() | ||
print("Server Launcher for Minecraft\n-------------------------------------\n") | ||
print("Starting the Server with",gbs,"GB of RAM") | ||
comando_java = f"java -Xmx{gbs}G -Xms{gbs}G -jar server.jar nogui" | ||
comando_final = str(comando_java) | ||
subprocess.run(comando_final, shell=True) | ||
input("\nPress ENTER to continue.") | ||
limpiar_consola() | ||
print("Server Launcher for Minecraft\n-------------------------------------\n\nServer Closed\n\nYou can check the console log in 'logs' folder\n") | ||
input("Press ENTER to continue.") | ||
except ValueError: | ||
ram() | ||
|
||
#LICENSE | ||
def about(): | ||
limpiar_consola() | ||
url = "https://github.com/NGDPLNk/SSTools4MC/blob/main/LICENSE" | ||
print("Server Launcher for Minecraft\n-------------------------------------\n\nThe latest license information will open in the browser\n") | ||
print(url) | ||
print("") | ||
input("Press ENTER to continue.") | ||
webbrowser.open(url) | ||
|
||
#EXIT | ||
def exiit(): | ||
limpiar_consola() | ||
print("--------------------------------------------\nThank you for using this tool\nMIT License - Copyright (c) 2023 NGDPL Nk\n--------------------------------------------\n") | ||
time.sleep(3) | ||
sys.exit() | ||
|
||
#MAIN MENU | ||
while True: | ||
limpiar_consola() | ||
print("Server Launcher for Minecraft\n-------------------------------------\n\nMain Menu\n\n(1) Start Server\n(2) License\n(3) Exit\n") | ||
seleccion = input("Select one of the options= ") | ||
if seleccion == "1": | ||
ram() | ||
elif seleccion == "2": | ||
about() | ||
elif seleccion == "3": | ||
exiit() |