mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'dev' into 'master'
Bug Fixes 20220612 See merge request crafty-controller/crafty-4!320
This commit is contained in:
commit
c389e755ad
@ -93,7 +93,12 @@ class ServersController(metaclass=Singleton):
|
||||
|
||||
@staticmethod
|
||||
def update_server(server_obj):
|
||||
return HelperServers.update_server(server_obj)
|
||||
ret = HelperServers.update_server(server_obj)
|
||||
server_instance: ServerInstance = ServersController().get_server_instance_by_id(
|
||||
server_obj.server_id
|
||||
)
|
||||
server_instance.update_server_instance()
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
def set_download(server_id):
|
||||
@ -267,14 +272,14 @@ class ServersController(metaclass=Singleton):
|
||||
server_data = []
|
||||
try:
|
||||
for server in self.servers_list:
|
||||
srv = ServersController().get_server_instance_by_id(
|
||||
srv: ServerInstance = ServersController().get_server_instance_by_id(
|
||||
server.get("server_id")
|
||||
)
|
||||
latest = srv.stats_helper.get_latest_server_stats()
|
||||
server_data.append(
|
||||
{
|
||||
"server_data": ServersController.get_server_data_by_id(
|
||||
server.get("server_id")
|
||||
"server_data": DatabaseShortcuts.get_data_obj(
|
||||
srv.server_object
|
||||
),
|
||||
"stats": latest,
|
||||
"user_command_permission": True,
|
||||
@ -330,9 +335,7 @@ class ServersController(metaclass=Singleton):
|
||||
user_command_permission = False
|
||||
server_data.append(
|
||||
{
|
||||
"server_data": ServersController.get_server_data_by_id(
|
||||
server.server_id
|
||||
),
|
||||
"server_data": DatabaseShortcuts.get_data_obj(srv.server_object),
|
||||
"stats": latest,
|
||||
"user_command_permission": user_command_permission,
|
||||
}
|
||||
|
@ -139,6 +139,13 @@ class ServerInstance:
|
||||
# **********************************************************************************
|
||||
# Minecraft Server Management
|
||||
# **********************************************************************************
|
||||
def update_server_instance(self):
|
||||
server_data: Servers = HelperServers.get_server_obj(self.server_id)
|
||||
self.server_path = server_data.path
|
||||
self.jar_update_url = server_data.executable_update_url
|
||||
self.name = server_data.server_name
|
||||
self.server_object = server_data
|
||||
|
||||
def reload_server_settings(self):
|
||||
server_data = HelperServers.get_server_data_by_id(self.server_id)
|
||||
self.settings = server_data
|
||||
|
@ -17,7 +17,6 @@ from tornado import iostream
|
||||
from tzlocal import get_localzone
|
||||
from croniter import croniter
|
||||
from app.classes.controllers.roles_controller import RolesController
|
||||
from app.classes.controllers.servers_controller import ServersController
|
||||
|
||||
from app.classes.models.servers import Servers
|
||||
from app.classes.models.server_permissions import EnumPermissionsServer
|
||||
@ -259,7 +258,7 @@ class PanelHandler(BaseHandler):
|
||||
for server in defined_servers[:]:
|
||||
if str(server.server_id) == str(server_id):
|
||||
page_servers.append(
|
||||
ServersController.get_server_data_by_id(server.server_id)
|
||||
DatabaseShortcuts.get_data_obj(server.server_object)
|
||||
)
|
||||
user_order.remove(server_id)
|
||||
defined_servers.remove(server)
|
||||
@ -268,7 +267,7 @@ class PanelHandler(BaseHandler):
|
||||
server_ids.append(str(server.server_id))
|
||||
if server not in page_servers:
|
||||
page_servers.append(
|
||||
ServersController.get_server_data_by_id(server.server_id)
|
||||
DatabaseShortcuts.get_data_obj(server.server_object)
|
||||
)
|
||||
|
||||
for server_id in user_order[:]:
|
||||
|
Loading…
Reference in New Issue
Block a user