Skip to content

Commit

Permalink
beautify
Browse files Browse the repository at this point in the history
Former-commit-id: c8e0bfd
  • Loading branch information
SirDank committed Nov 2, 2023
1 parent 6944bf1 commit 7a34a77
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion __modules__/dank.chatroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def chatroom_login():

if "missing" in response.content.decode() and response.status_code == 400:

cls(); print(clr(align("\n<---|[ A c c o u n t - C r e a t i o n ]|--->") + "\n\n > Username must be greater than two characters and less than 16 characters, spaces are not counted!"))
cls(); print(clr(align("\n<---|[ A c c o u n t - C r e a t i o n ]|--->") + "\n\n - Username must be greater than two characters and less than 16 characters, spaces are not counted!"))

err_msg = ""
while True:
Expand Down
4 changes: 2 additions & 2 deletions __modules__/dank.game.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def enable_lighting():
# terrain vertices generation

start_time = time.time()
print(clr("\n > Generating terrain vertices..."))
print(clr("\n - Generating terrain vertices..."))

def generate_vertices(x, z):

Expand Down Expand Up @@ -146,7 +146,7 @@ def generate_vertices(x, z):
triangles = [(0,1,2,3)]
uvs = [(0,0),(1,0),(1,1),(0,1)]

print(clr(f"\n > Generated {len(terrain_keys)} sets of terrain vertices in {int(time.time() - start_time)} seconds!\n"))
print(clr(f"\n - Generated {len(terrain_keys)} sets of terrain vertices in {int(time.time() - start_time)} seconds!\n"))
del start_time

# randomised entity generation
Expand Down
72 changes: 36 additions & 36 deletions __modules__/dank.minecraft-server-builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def main_one():
subprocess.run(['java', '-version'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except:
print_read_me()
if input(clr(f"\n > {translate('Java is not installed')}!\n\n > {translate(f'Install Adoptium JRE {latest_java_version}?')} [ y / n ]: ") + red).lower() == 'y':
if input(clr(f"\n - {translate('Java is not installed')}!\n\n > {translate(f'Install Adoptium JRE {latest_java_version}?')} [ y / n ]: ") + red).lower() == 'y':
print()
os.system(f"winget install EclipseAdoptium.Temurin.{latest_java_version}.JRE")

Expand All @@ -73,7 +73,7 @@ def main_one():
while True:
try:
version_list = requests.get("https://api.purpurmc.org/v2/purpur", headers=headers).json()['versions']
print(clr(f' > {translate("Available Purpur Versions")}: {", ".join(version_list)}')); break
print(clr(f' - {translate("Available Purpur Versions")}: {", ".join(version_list)}')); break
except: input(clr(f"\n > {translate('Failed to get purpur versions! Make sure you are connected to the internet! Press [ ENTER ] to try again')}... ",2))

# user inputs [ name, version, ram, allow_cracked ]
Expand Down Expand Up @@ -139,7 +139,7 @@ def main_one():
# setting max ram

string = translate('When setting the Xms and Xmx values, if your host says you have 8000M memory, DO NOT USE 8000M! Minecraft (and Java) needs additional memory on top of that Xmx parameter. It is recommended to reduce your Xmx/Xms by about 1000-1500M to avoid running out of memory or "OOMKiller" hitting your server. This also leaves room for the Operating System to use memory too. Have 8000M memory? Use 6500M for safety. But you may also ask your host if they will cover this overhead for you and give you 9500M instead. Some hosts will! Just ask. We recommend using at least 6-10GB, no matter how few players! If you cannot afford 10GB of memory, give as much as you can. However going out and getting 32GB of RAM for a server will only waste your money with minimal returns.')
print_read_me(); print(clr(f"\n > {string}"))
print_read_me(); print(clr(f"\n - {string}"))
print("")
while True:
ram = input(clr(" > RAM in MB [ Leave 1500MB Free ]: ") + red)
Expand All @@ -149,7 +149,7 @@ def main_one():

# use playit.gg

print_read_me(); print(clr(f"\n > {translate('Great! Now you need to pick a host for your mc server!')}\n\n > {translate('If you are new to hosting and would like to quickly host a server with the playit.gg plugin without port-forwarding')}\n - {translate('Choose Option 1')}\n\n > {translate('If you are experienced and would like to skip playit.gg and use port-forwarding or alternative hosting methods')}\n - {translate('Choose Option 2')}"))
print_read_me(); print(clr(f"\n - {translate('Great! Now you need to pick a host for your mc server!')}\n\n - {translate('If you are new to hosting and would like to quickly host a server with the playit.gg plugin without port-forwarding')}\n - {translate('Choose Option 1')}\n\n - {translate('If you are experienced and would like to skip playit.gg and use port-forwarding or alternative hosting methods')}\n - {translate('Choose Option 2')}"))

print("")
while True:
Expand Down Expand Up @@ -182,7 +182,7 @@ def main_one():

# begin preparing downloads

cls(); print(clr(f"\n > {translate('Preparing Downloads')}..."))
cls(); print(clr(f"\n - {translate('Preparing Downloads')}..."))
to_download_urls, to_download_file_names = [], []

# github server-builder files and plugins
Expand Down Expand Up @@ -260,15 +260,15 @@ def main_one():
to_download_urls.append(file_url)
to_download_file_names.append(f"plugins/{file_url.split('/')[-1]}")

# > AutoPlug
# - AutoPlug
to_download_urls.append("https://github.com/Osiris-Team/AutoPlug-Releases/raw/master/stable-builds/AutoPlug-Client.jar")
to_download_file_names.append("AutoPlug-Client.jar")

# > purpur.jar
# - purpur.jar
to_download_urls.append(f"https://api.purpurmc.org/v2/purpur/{version}/latest/download")
to_download_file_names.append("purpur.jar")

# > MCAntiMalware.jar
# - MCAntiMalware.jar
for file_url in github_file_selector("OpticFusion1/MCAntiMalware", "add", ['MCAntiMalware']):
to_download_urls.append(file_url)
to_download_file_names.append(file_url.split('/')[-1])
Expand All @@ -282,18 +282,18 @@ def file_downloader(url, file_name):
try: size = '{:.3}'.format(int(response.headers['Content-Length'])/1024000)
except: size = "?"
open(file_name,"wb").write(data)
print(clr(f" > {translate('Downloaded')} [ {file_name} ] [ {size} MB ]\n")); break
print(clr(f" - {translate('Downloaded')} [ {file_name} ] [ {size} MB ]\n")); break
except:
input(clr(f" > {translate('Failed')} [ {file_name} ] Press {white}ENTER{red} to try again... \n",2))
rm_line(); rm_line()

# disabled due to repeated error reports

'''print_read_me(); input(clr("\n > Do not use [ Ctrl + C ]!\n\n > Press [ ENTER ] to start the multithreaded download process... "))
'''print_read_me(); input(clr("\n - Do not use [ Ctrl + C ]!\n\n > Press [ ENTER ] to start the multithreaded download process... "))
# begin multithreaded downloader | threads = 2
print(clr("\n > Starting Multiple Downloads... [ this might take a few minutes ]"))
print(clr("\n - Starting Multiple Downloads... [ this might take a few minutes ]"))
while True:
try:
Expand All @@ -305,7 +305,7 @@ def file_downloader(url, file_name):

# begin single threaded downloader

print(clr(f"\n > {translate('Downloading... [ this might take a few minutes ]')}\n"))
print(clr(f"\n - {translate('Downloading... [ this might take a few minutes ]')}\n"))

start_time = time.time()
#for url, file_name in zip(to_download_urls, to_download_file_names):
Expand All @@ -314,11 +314,11 @@ def file_downloader(url, file_name):

time_taken = int(time.time()-start_time)

print(clr(f"\n > {translate(f'Finished downloads in {time_taken} seconds! Sleeping for 3 seconds')}...")); time.sleep(3)
print(clr(f"\n - {translate(f'Finished downloads in {time_taken} seconds! Sleeping for 3 seconds')}...")); time.sleep(3)

# unpacking downloaded archives

'''print(clr(f"\n > {translate('Unpacking')}..."))
'''print(clr(f"\n - {translate('Unpacking')}..."))
for file in ['theend', 'overworld', 'deepwoods']: # 'newhorizons'
Expand All @@ -339,7 +339,7 @@ def file_downloader(url, file_name):

# creating local files

cls(); print(clr(f"\n > {translate('Creating local files')}..."))
cls(); print(clr(f"\n - {translate('Creating local files')}..."))

open('eula.txt','w').write('eula=true')

Expand Down Expand Up @@ -705,18 +705,18 @@ def file_downloader(url, file_name):
def main_two():

string = f'''
> {translate('Start the server once ( it will stop automatically on the first run ) to generate config files to be optimized')}
- {translate('Start the server once ( it will stop automatically on the first run ) to generate config files to be optimized')}
> quick_chmod.sh - {translate('Script to make all .sh files executable')}
> quick_install_java.sh / quick_install_java.cmd - {translate('Script to install Temurin JRE')}
> mc-anti-malware.sh / mc-anti-malware.cmd - {translate('Script to start mc-anti-malware')}
> start_server.sh / start_server.cmd - {translate('Script to start your server')}
> ".check java" - {translate('Command to install Java VM')}
> ".start" - {translate('Command to start the server')}
> ".stop" - {translate('Command to stop the server')}
> ".stop both" - {translate('Command to stop the server and Autoplug')}
> ".check plugins" - {translate('Command to update configured plugins')}
> ".help" - {translate('Command to display all available commands')}
- quick_chmod.sh : {translate('Script to make all .sh files executable')}
- quick_install_java.sh / quick_install_java.cmd : {translate('Script to install Temurin JRE')}
- mc-anti-malware.sh / mc-anti-malware.cmd : {translate('Script to start mc-anti-malware')}
- start_server.sh / start_server.cmd : {translate('Script to start your server')}
- ".check java" : {translate('Command to install Java VM')}
- ".start" : {translate('Command to start the server')}
- ".stop" : {translate('Command to stop the server')}
- ".stop both" : {translate('Command to stop the server and Autoplug')}
- ".check plugins" : {translate('Command to update configured plugins')}
- ".help" : {translate('Command to display all available commands')}
> {translate('After your server has run at least once, press [ ENTER ] to apply custom configuration')}... '''

Expand Down Expand Up @@ -749,33 +749,33 @@ def config_updater(path):
if playit:

string = f'''
> {translate('It is extremely easy to setup the playit.gg plugin')}
- {translate('It is extremely easy to setup the playit.gg plugin')}
> {translate('After server setup is complete, start your server.')}
- {translate('After server setup is complete, start your server.')}
> {translate('Click on the URL displayed on the console.')}
- {translate('Click on the URL displayed on the console.')}
> {translate("Create an account and login if you haven't already to save the tunnel on playit.gg")}
- {translate("Create an account and login if you haven't already to save the tunnel on playit.gg")}
> {translate('Click "Add Agent"')}
- {translate('Click "Add Agent"')}
> {translate("A tunnel will be created and your server's public ip will be displayed: example.craft.playit.gg")}
- {translate("A tunnel will be created and your server's public ip will be displayed: example.craft.playit.gg")}
> {translate('Press [ ENTER ] after you have read the message')}... '''

print_read_me(); input(clr(string))
else:
print_read_me(); print(clr(f"\n > {translate('As you have not selected playit.gg as a host, To allow players to connect to your server over the internet, you could follow this tutorial on port-forwarding.')}"))
print_read_me(); print(clr(f"\n - {translate('As you have not selected playit.gg as a host, To allow players to connect to your server over the internet, you could follow this tutorial on port-forwarding.')}"))
if input(clr(f"\n > {translate('Open port forwarding tutorial on youtube?')} [ y / n ]: ") + red).lower() == "y":
sys_open('https://youtu.be/X75GbRaGzu8')

tmp_path = f'{dir_name}\\autoplug\\updater.yml'
string = f'''
> {translate(f'If you would like to transfer the server to a linux system and run it there, set "build-id: 0" inside "{tmp_path}"')}
- {translate(f'If you would like to transfer the server to a linux system and run it there, set "build-id: 0" inside "{tmp_path}"')}
> {translate(f'After you move the folder to a linux system, run "sudo chmod +x {tmp_path}/quick_chmod.sh" to make all .sh files executable')}
- {translate(f'After you move the folder to a linux system, run "sudo chmod +x {tmp_path}/quick_chmod.sh" to make all .sh files executable')}
> {translate('Run "start_server.sh" and then install JVM with the ".check java" command')}
- {translate('Run "start_server.sh" and then install JVM with the ".check java" command')}
> {translate('Press [ ENTER ] after you have read the message')}... '''

Expand Down
18 changes: 9 additions & 9 deletions __modules__/dank.minecraft-server-scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def save_server(ip):

for _ in ('§0', '§1', '§2', '§3', '§4', '§5', '§6', '§7', '§8', '§9', '§a', '§b', '§c', '§d', '§e', '§f', '§l', '§n', '§o', '§m', '§k', '§r'):
to_print = to_print.replace(_,'')
print(clr(f" > {to_print}\n"))
print(clr(f" - {to_print}\n"))
open('servers.txt','a',encoding='utf-8').write(f"\n{to_print}")

except:
Expand Down Expand Up @@ -106,8 +106,8 @@ def main():
# get user input

cls(); print(align(clr(banner,4,colours=[white, white_normal, red, red_normal, red_dim])))
print(clr(f"\n > Java Server List: https://dank-site.onrender.com/minecraft-java-servers\n\n > Bedrock Server List: https://dank-site.onrender.com/minecraft-bedrock-servers\n\n > {translate('You can use the above links to get a list of servers that have been found by the users of this tool')}!"))
choice = input(clr("\n > 1: Open Java Server List | 2: Open Bedrock Server List | ENTER: Skip\n\n > Choice [1/2/ENTER]: ") + red)
print(clr(f"\n - Java Server List: https://dank-site.onrender.com/minecraft-java-servers\n\n - Bedrock Server List: https://dank-site.onrender.com/minecraft-bedrock-servers\n\n - {translate('You can use the above links to get a list of servers that have been found by the users of this tool')}!"))
choice = input(clr("\n - 1: Open Java Server List | 2: Open Bedrock Server List | ENTER: Skip\n\n > Choice [1/2/ENTER]: ") + red)
if choice == "1": os.system("start https://dank-site.onrender.com/minecraft-java-servers")
elif choice == "2": os.system("start https://dank-site.onrender.com/minecraft-bedrock-servers")

Expand All @@ -133,7 +133,7 @@ def main():
# get user input

cls(); print(align(clr(banner,4,colours=[white, white_normal, red, red_normal, red_dim])))
print(clr(f"\n > {translate('Start with 100 threads and note the performance impact')}.\n\n > {translate('Generally should be smooth upto 500 threads, you might notice some performance impact above this value')}!\n\n > {translate('Start with 50000 IPs, it will take a few seconds to generate')}."))
print(clr(f"\n - {translate('Start with 100 threads and note the performance impact')}.\n\n - {translate('Generally should be smooth upto 500 threads, you might notice some performance impact above this value')}!\n\n - {translate('Start with 50000 IPs, it will take a few seconds to generate')}."))

print("")
while True:
Expand All @@ -160,7 +160,7 @@ def main():

# disclaimer

cls(); input(clr(f"\n [IMPORTANT]\n\n > {translate('Do not use [ Ctrl + C ] without selecting text first')}!\n\n > {translate('All the servers are saved to servers.txt')}!\n\n > {translate('Press [ ENTER ] to start the multithreaded scanner')}... "))
cls(); input(clr(f"\n [IMPORTANT]\n\n - {translate('Do not use [ Ctrl + C ] without selecting text first')}!\n\n - {translate('All the servers are saved to servers.txt')}!\n\n > {translate('Press [ ENTER ] to start the multithreaded scanner')}... "))
cls()

# generate and check ips on multiple threads in batches
Expand All @@ -178,7 +178,7 @@ def main():
# multithreaded generator

#cls()
print(clr(f"\n > Generating {gen_amt} unique ips..."))
print(clr(f"\n - Generating {gen_amt} unique ips..."))
while generated < gen_amt:
while True:
try:
Expand All @@ -194,7 +194,7 @@ def main():
while True:
try:
#cls()
print(clr(f"\n > Checking {len(ips)} unique ips...\n"))
print(clr(f"\n - Checking {len(ips)} unique ips...\n"))
if server_type == "java": multithread(check_java, threads, tuple(ips.keys())); break
else: multithread(check_bedrock, threads, tuple(ips.keys())); break
except: input(clr(f"\n > {translate('Failed to check ips! Do not use [ Ctrl + C ]! Press [ENTER] to try again')}... ",2)); rm_line()
Expand All @@ -204,13 +204,13 @@ def main():
scan_count = int(open('scan_count.txt','r',encoding='utf-8').read())
scan_count += len(ips)
open('scan_count.txt','w',encoding='utf-8').write(str(scan_count))
print(clr(f"\n > Totally Scanned {scan_count} IPs!"))
print(clr(f"\n - Totally Scanned {scan_count} IPs!"))
time.sleep(5)

gen_rem -= gen_amt

if gen_rem > 0:
print(clr(f"\n > {gen_rem} IPs remaining..."))
print(clr(f"\n - {gen_rem} IPs remaining..."))

if __name__ == "__main__":

Expand Down
Loading

0 comments on commit 7a34a77

Please sign in to comment.