Overview
The Server class extends Process and represents a Minecraft server (Vanilla, Paper, Fabric, Spigot, etc.).
Class Definition
from mcdis_rcon.classes import Server
from mcdis_rcon.classes import Process
from mcdis_rcon.classes import McDisClient
class Server ( Process ):
def __init__ ( self , name : str , client : McDisClient, config : dict ):
super (). __init__ (name, client, config)
Inheritance
The Server 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
Servers are defined in md_config.yml under Processes.Servers:
Processes :
Servers :
SMP :
start_cmd : java -Xms4G -Xmx4G -jar server.jar nogui
stop_cmd : stop
blacklist :
- 'Starting remote control listener'
- 'Thread RCON Listener started'
Creative :
start_cmd : java -Xms2G -Xmx2G -jar paper.jar nogui
stop_cmd : stop
blacklist : []
Attributes
All attributes are inherited from Process:
Server name (e.g., “SMP”, “Creative”)
Server directory (e.g., McDis/SMP/)
Java command to start the server
Console command to stop the server (usually “stop”)
Log patterns to exclude from Discord
Server Directory Structure
McDis/
├── SMP/ ← Server files directory
│ ├── .mdplugins/ ← Server-specific plugins
│ │ └── welcome.py
│ ├── .mdcommands/ ← Predefined commands
│ │ └── broadcast.json
│ ├── server.jar ← Server JAR file
│ ├── server.properties
│ ├── world/
│ ├── plugins/ ← Minecraft plugins
│ └── logs/
└── .mdbackups/
└── SMP/ ← Server backups
├── SMP 1.zip
├── SMP 2.zip
└── SMP 3.zip
Usage Example
Accessing in Client
# Get server instance
for server in client.servers:
if server.name == "SMP" :
print ( f "Server: { server.name } " )
print ( f "Running: { server.is_running() } " )
print ( f "RAM: { server.ram_usage() } " )
In a Plugin
class mdplugin :
def __init__ ( self , server ):
self .server = server # This is a Server instance
def listener_events ( self , log : str ):
if "Done" in log and "For help, type" in log:
# Server finished starting
self .server.execute( "say Server is ready!" )
Server Commands
From Discord console thread:
start # Start the server
stop # Stop the server (sends stop_cmd)
restart # Restart the server
kill # Force-kill the server
mdreload # Reload mdplugins
/say Hello # Execute any server command
Common Server Types
Vanilla Server
Processes :
Servers :
Vanilla :
start_cmd : java -Xms4G -Xmx4G -jar server.jar nogui
stop_cmd : stop
blacklist : []
Paper Server
Processes :
Servers :
Paper :
start_cmd : java -Xms6G -Xmx6G -jar paper.jar nogui
stop_cmd : stop
blacklist :
- 'Checking version'
- 'Loading libraries'
Fabric Server
Processes :
Servers :
Fabric :
start_cmd : java -Xms4G -Xmx4G -jar fabric-server-launch.jar nogui
stop_cmd : stop
blacklist : []
Forge Server
Processes :
Servers :
Forge :
start_cmd : ./run.sh
stop_cmd : stop
blacklist : []
MCDReforged Server
Processes :
Servers :
MCDR :
start_cmd : python -m mcdreforged
stop_cmd : stop
blacklist :
- 'MCDR'
For MCDReforged, set advanced_console: false in MCDR’s config file to ensure proper console output.
Server-Specific Plugins
Plugins in .mdplugins/ only run when the server is active:
from mcdis_rcon.classes import Server
import asyncio
class mdplugin :
def __init__ ( self , server : Server):
self .server = server
self .player_count = 0
def listener_events ( self , log : str ):
if "joined the game" in log:
self .player_count += 1
asyncio.create_task(
self .server.send_to_console(
f "Players online: { self .player_count } "
)
)
elif "left the game" in log:
self .player_count -= 1
Resource Monitoring
# Get RAM usage
ram = server.ram_usage() # "4.2 GB"
# Get disk usage
disk = server.disk_usage() # "1.8 GB"
disk_bytes = server.disk_usage( string = False ) # 1932735283
Backup Management
# Create backup (server must be stopped)
if not server.is_running():
server.make_bkp()
# Restore from backup
backup_name = "SMP 1.zip"
server.unpack_bkp(backup_name)
Best Practices
Use descriptive server names that indicate their purpose (e.g., “SMP”, “Creative”, “Minigames”).
Add common spam messages to the blacklist to keep Discord consoles clean.
Always stop the server before creating backups to avoid data corruption.
Servers inherit all Process methods, so refer to the Process documentation for complete API details.
Next Steps
Process Class View complete Process API
Network Class Learn about proxy servers
Creating Plugins Build server-specific plugins
Multiple Servers Manage multiple servers