Skip to main content

Overview

The Network class extends Process and represents a Minecraft proxy server (Velocity, Waterfall, BungeeCord, etc.).

Class Definition

from mcdis_rcon.classes import Network
from mcdis_rcon.classes import Process
from mcdis_rcon.classes import McDisClient

class Network(Process):
    def __init__(self, name: str, client: McDisClient, config: dict):
        super().__init__(name, client, config)

Inheritance

The Network class inherits all methods and attributes from the Process class:
  • Process lifecycle methods (start, stop, kill, restart)
  • Plugin management (load_plugins, call_plugins)
  • Console management (execute, send_to_console)
  • Backup operations (make_bkp, unpack_bkp)
  • Resource monitoring (ram_usage, disk_usage)
See the Process class documentation for detailed information.

Configuration

Networks are defined in md_config.yml under Processes.Networks:
md_config.yml
Processes:
  Networks:
    Velocity:
      start_cmd: java -Xms512M -Xmx512M -jar velocity.jar
      stop_cmd: end
      blacklist:
        - 'Listening on'
        - 'Using limbo'
    
    Waterfall:
      start_cmd: java -Xms512M -Xmx512M -jar waterfall.jar
      stop_cmd: end
      blacklist: []
Proxy servers typically use end instead of stop as their shutdown command.

Attributes

All attributes are inherited from Process:
name
str
Network name (e.g., “Velocity”, “Waterfall”)
path_files
str
Network directory (e.g., McDis/Velocity/)
start_cmd
str
Java command to start the proxy
stop_cmd
str
Console command to stop the proxy (usually “end”)
blacklist
list[str]
Log patterns to exclude from Discord

Network Directory Structure

McDis/
├── Velocity/               ← Network files directory
│   ├── .mdplugins/         ← Network-specific plugins
│   │   └── player_bridge.py
│   ├── .mdcommands/        ← Predefined commands
│   ├── velocity.jar        ← Proxy JAR file
│   ├── velocity.toml       ← Velocity config
│   ├── plugins/            ← Proxy plugins
│   └── logs/
└── .mdbackups/
    └── Velocity/           ← Network backups
        ├── Velocity 1.zip
        └── Velocity 2.zip

Usage Example

Accessing in Client

# Get network instance
for network in client.networks:
    if network.name == "Velocity":
        print(f"Network: {network.name}")
        print(f"Running: {network.is_running()}")
        print(f"RAM: {network.ram_usage()}")

In a Plugin

class mdplugin:
    def __init__(self, network):
        self.network = network  # This is a Network instance
        
    def listener_events(self, log: str):
        if "has connected" in log:
            # Player connected to proxy
            player = self.extract_player_name(log)
            self.network.execute(f"alert {player} Welcome to the network!")

Network Commands

From Discord console thread:
start           # Start the proxy
stop            # Stop the proxy (sends stop_cmd)
restart         # Restart the proxy
kill            # Force-kill the proxy
mdreload        # Reload mdplugins
/alert Message  # Execute any proxy command

Common Network Types

Velocity

Processes:
  Networks:
    Velocity:
      start_cmd: java -Xms512M -Xmx512M -XX:+UseG1GC -jar velocity.jar
      stop_cmd: end
      blacklist:
        - 'Listening on'
        - 'Done'

Waterfall (BungeeCord fork)

Processes:
  Networks:
    Waterfall:
      start_cmd: java -Xms512M -Xmx512M -jar waterfall.jar
      stop_cmd: end
      blacklist:
        - 'Enabled plugin'
        - 'Listening on'

BungeeCord

Processes:
  Networks:
    BungeeCord:
      start_cmd: java -Xms512M -Xmx512M -jar BungeeCord.jar
      stop_cmd: end
      blacklist: []

Network-Specific Plugins

Plugins in .mdplugins/ only run when the network is active:
connection_tracker.py
from mcdis_rcon.classes import Network
import asyncio

class mdplugin:
    def __init__(self, network: Network):
        self.network = network
        self.connections = 0
    
    def listener_events(self, log: str):
        if "has connected" in log:
            self.connections += 1
            asyncio.create_task(
                self.network.send_to_console(
                    f"Total connections: {self.connections}"
                )
            )
        
        elif "has disconnected" in log:
            self.connections -= 1

Multi-Server Setup

Networks work alongside servers:
md_config.yml
Processes:
  Networks:
    Velocity:
      start_cmd: java -Xms512M -Xmx512M -jar velocity.jar
      stop_cmd: end
      blacklist: []
  
  Servers:
    Lobby:
      start_cmd: java -Xms2G -Xmx2G -jar paper.jar nogui
      stop_cmd: stop
      blacklist: []
    
    Survival:
      start_cmd: java -Xms4G -Xmx4G -jar paper.jar nogui
      stop_cmd: stop
      blacklist: []
    
    Creative:
      start_cmd: java -Xms2G -Xmx2G -jar paper.jar nogui
      stop_cmd: stop
      blacklist: []
Start the network proxy before starting backend servers for proper connection routing.

Cross-Network Communication

Plugins can communicate between networks and servers:
network_plugin.py
import asyncio

class mdplugin:
    def __init__(self, network):
        self.network = network
        self.client = network.client
    
    def listener_events(self, log: str):
        if "has connected" in log:
            player = self.extract_player(log)
            
            # Notify all servers
            for server in self.client.servers:
                if server.is_running():
                    server.execute(
                        f"say {player} joined the network!"
                    )

Resource Monitoring

# Get RAM usage
ram = network.ram_usage()  # "512 MB"

# Get disk usage
disk = network.disk_usage()  # "150 MB"

Backup Management

# Create backup (network must be stopped)
if not network.is_running():
    network.make_bkp()

# Restore from backup
backup_name = "Velocity 1.zip"
network.unpack_bkp(backup_name)

Best Practices

Keep network proxies lightweight. They don’t need as much RAM as game servers.
Use the blacklist to filter verbose proxy logging for cleaner Discord consoles.
Ensure backend servers are configured to accept proxy connections (velocity-secret, bungeecord: true, etc.).
Networks inherit all Process methods, so refer to the Process documentation for complete API details.

Velocity Configuration Example

velocity.toml
[servers]
lobby = "127.0.0.1:25565"
survival = "127.0.0.1:25566"
creative = "127.0.0.1:25567"

try = [
  "lobby"
]

[forced-hosts]
"play.example.com" = [
  "lobby"
]

Common Log Patterns

Velocity

[player] has connected
[player] has disconnected
Listening on /0.0.0.0:25577
Done (X.XXs)!

Waterfall/BungeeCord

[player] has connected
[player] has disconnected
Listening on /*:25577
Enabled plugin [name] version [version]

Next Steps

Process Class

View complete Process API

Server Class

Learn about game servers

Creating Plugins

Build network-specific plugins

Multiple Servers

Configure multi-server networks

Build docs developers (and LLMs) love