Skip to content

Basic Information (IMPORTANT)

Aksif edited this page Apr 18, 2024 · 13 revisions

Logo

Mine Colab [Improved]

Run Minecraft Server on Google Colab

Star Open In Colab Download

Today, I will explain the basic information for developing the main functions. Because each main function has its own small function, I will tell it on the page that describes the main function not in this page.

Python libraries:

Libraries Commands Uses X Libraries Commands Uses
os environ() Setting java environment X jproperties Properties() Read server.properties files
os.path exists() Checking exsisting folder X rich print() print color texts
requests get() HTML Parse X google.colab drive() Mounting google drive
time sleep() Wait for done (Commands) X pyngrok ngrok() Ngrok connecting
json load() Transform to dict type X pyngrok conf() Ngrok configuring
json dump() Dumping dict values to .txt files X bs4 BeautifulSoup4() HTML Parse

Global variables:

  • drive_path : Path to your drive files. | '/content/drive/MyDrive/minecraft'
  • SERVERCONFIG : Path to your serverconfig.txt file. | f'{drive_path}/server_list.txt'
  • COLABCONFIG : Function but used for getting the path to colabconfig.txt file. | f"{drive_path}/{server_name}/colabconfig.txt"

Files:

  • minecraft: The folder which stored all Minecraft server folders
  • colabconfig.txt: The file that include dict value: | {'server_name': 'Your-server-name', 'server_type': 'Your-server-type', 'tunnel_service': 'your-tunnel-service'}.
    • If you use ngrok service, colabconfig.txt will include: {'server_name': 'Your-server-name', 'server_type': 'Your-server-type', 'tunnel_service': 'your-tunnel-service', 'authtoken': 'Your-ngrok-authtoken', 'region': 'Your-region'}
  • serverconfig.txt: The file tell you the server which are in used also the minercraft server list. | {'server_list': 'Server-list', 'server_in_use': 'Server-in-use'}
    • If you use ngrok service, serverconfig.txt will include: {'server_list': 'Server-list', 'server_in_use': 'Server-in-use', "ngrok_proxy": {'authtoken': 'Your-ngrok-authtoken', 'region': 'Your-region'}}

Function 1: LOG, GET, DOWNLOAD_FILE -- Necessary function

  • LOG:
    • Purpose: Print color texts
    • Mechanism:

image

  • GET:
    • Purpose: HTML parse.
    • Mechanism:

image

  • DOWNLOAD_FILE:
    • Purpose: Download jar files.
    • Mechanism:

image

Function 2: COLABCONFIG_LOAD, SERVER_IN_USE

  • COLABCONFIG_LOAD:
    • Purpose: Load colabconfig content
    • Mechanism:

image

  • SERVER_IN_USE:
    • Purpose:
      • Check whether server_name exists.
      • Get servers that are in use. (if server_name is an empty string)
    • Mechanism:

image

That's all. Want more? Check out others in Wiki

Want to ask anything? Join the discord: Minecolab Helper

Introduction:

  • This page is all about how the main functions in the scripts work.
  • It is important for developers/ contributors to read this.
Clone this wiki locally