|
|
|
@ -23,7 +23,8 @@ timers = {}
|
|
|
|
|
# GameServer Konstanten
|
|
|
|
|
####
|
|
|
|
|
# Vorhandene Gameserver-Daten
|
|
|
|
|
java_minecraft_servers = {
|
|
|
|
|
gaming_server_profiles = {
|
|
|
|
|
# Minecraft
|
|
|
|
|
"mc_vanilla" : {
|
|
|
|
|
'profile_id': 'vanilla',
|
|
|
|
|
'server_name': 'Vanilla 1.21',
|
|
|
|
@ -58,7 +59,10 @@ java_minecraft_servers = {
|
|
|
|
|
'directory': 'C:/Users/4lexK/Desktop/GameServers/Minecraft/farming_valley_1-1-2/',
|
|
|
|
|
'command': ['C:/Program Files/OpenLogic/jdk-8.0.412.08-hotspot/bin/java.exe', '-Dlog4j2.formatMsgNoLookups=true', '-Dlog4j.configurationFile=log4j2.xml', '-Xmx8G', '-Xms2G', '-jar', 'forge-1.10.2-12.18.3.2511-universal.jar', '--nogui', '--bonusChest'],
|
|
|
|
|
'wait_time': 30
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
# Dont Starve Together
|
|
|
|
|
# Ragnarok Online
|
|
|
|
|
# World of Warcraft
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -95,6 +99,9 @@ gameserver_menu = [
|
|
|
|
|
[
|
|
|
|
|
{"text": "Minecraft", "callback_data": "gameservers_minecraft"}
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
{"text": "Don't Starve Together", "callback_data": "gameservers_dst"}
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
{"text": "Ragnarok Online", "callback_data": "gameservers_ragnarok_online"}
|
|
|
|
|
],
|
|
|
|
@ -275,8 +282,8 @@ async def verify_password(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
|
|
|
|
|
####
|
|
|
|
|
def start_gameserver(profile: str) -> str:
|
|
|
|
|
response_msg = ""
|
|
|
|
|
if profile in java_minecraft_servers:
|
|
|
|
|
server = java_minecraft_servers[profile]
|
|
|
|
|
if profile in gaming_server_profiles:
|
|
|
|
|
server = gaming_server_profiles[profile]
|
|
|
|
|
os.chdir(server['directory'])
|
|
|
|
|
pid_file = os.path.join(server['directory'], 'server.pid')
|
|
|
|
|
log_file = os.path.join(server['directory'], 'logs', f'server_{datetime.now().strftime("%Y%m%d_%H%M%S")}.log')
|
|
|
|
@ -313,11 +320,11 @@ def start_gameserver(profile: str) -> str:
|
|
|
|
|
|
|
|
|
|
def stop_gameserver(profile: str) -> str:
|
|
|
|
|
response_msg = ""
|
|
|
|
|
if profile not in java_minecraft_servers:
|
|
|
|
|
if profile not in gaming_server_profiles:
|
|
|
|
|
response_msg = f"Server Informationen für Profile {profile} existieren nicht. Bitte prüfen."
|
|
|
|
|
return response_msg
|
|
|
|
|
|
|
|
|
|
server = java_minecraft_servers[profile]
|
|
|
|
|
server = gaming_server_profiles[profile]
|
|
|
|
|
pid_file = os.path.join(server['directory'], 'server.pid')
|
|
|
|
|
wait_time = server['wait_time']
|
|
|
|
|
flag_delete_pid = False
|
|
|
|
@ -414,8 +421,8 @@ def get_status_nuc() -> dict:
|
|
|
|
|
def get_status_gameservers() -> str:
|
|
|
|
|
logging.info("Check Status der Server")
|
|
|
|
|
response_msg = "Status Game Server:"
|
|
|
|
|
for profile in java_minecraft_servers.keys():
|
|
|
|
|
server = java_minecraft_servers[profile]
|
|
|
|
|
for profile in gaming_server_profiles.keys():
|
|
|
|
|
server = gaming_server_profiles[profile]
|
|
|
|
|
pid_file = os.path.join(server['directory'], 'server.pid')
|
|
|
|
|
if os.path.exists(pid_file):
|
|
|
|
|
with open(pid_file, 'r') as file:
|
|
|
|
@ -498,7 +505,7 @@ async def handle_callback(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
|
|
|
|
|
case "minecraft_sanderhardcore":
|
|
|
|
|
await query.message.reply_text("Wähle einen Aktion für den Minecraft SanderHardcore Server:", reply_markup=InlineKeyboardMarkup(mc_sanderhardcore_menu))
|
|
|
|
|
case "minecraft_sandervalley":
|
|
|
|
|
await query.message.reply_text("Wähle einen Aktion für den Minecraft Vanilla Server:", reply_markup=InlineKeyboardMarkup(mc_sandervalley_menu))
|
|
|
|
|
await query.message.reply_text("Wähle einen Aktion für den Minecraft SanderValley Server:", reply_markup=InlineKeyboardMarkup(mc_sandervalley_menu))
|
|
|
|
|
case "minecraft_back":
|
|
|
|
|
await query.message.reply_text("Wähle einen Gameserver Typ:", reply_markup=InlineKeyboardMarkup(gameserver_menu))
|
|
|
|
|
# MC Vanilla
|
|
|
|
@ -547,10 +554,10 @@ async def handle_callback(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
|
|
|
|
|
case "mc_sandervalley_back":
|
|
|
|
|
await query.message.reply_text("Wähle einen Minecraft Server:", reply_markup=InlineKeyboardMarkup(minecraft_menu))
|
|
|
|
|
# Dont Starve Server
|
|
|
|
|
case "dst_start":
|
|
|
|
|
msg = "Not Implemented yet"
|
|
|
|
|
await query.message.reply_text(f"{msg}")
|
|
|
|
|
await send_main_menu(context, query.message.chat_id)
|
|
|
|
|
case "gameservers_dst":
|
|
|
|
|
await query.message.reply_text("Wähle einen Don't Starve Together Server:", reply_markup=InlineKeyboardMarkup(dont_starve_menu))
|
|
|
|
|
case "dst_vanilla":
|
|
|
|
|
await query.message.reply_text("Wähle einen Aktion für den Minecraft Vanilla Server:", reply_markup=InlineKeyboardMarkup(mc_sandervalley_menu))
|
|
|
|
|
case "dst_stop":
|
|
|
|
|
msg = "Not Implemented yet"
|
|
|
|
|
await query.message.reply_text(f"{msg}")
|
|
|
|
|