sync worldstate opnly if change worldstate config
All checks were successful
Build / build (pull_request) Successful in 1m58s
All checks were successful
Build / build (pull_request) Successful in 1m58s
This commit is contained in:
@@ -21,12 +21,14 @@ export const getConfigController: RequestHandler = async (req, res) => {
|
||||
export const setConfigController: RequestHandler = async (req, res) => {
|
||||
const account = await getAccountForRequest(req);
|
||||
if (isAdministrator(account)) {
|
||||
let isWorldStateUpdate = false;
|
||||
for (const [id, value] of Object.entries(req.body as Record<string, boolean | string | number>)) {
|
||||
if (id.startsWith("worldState")) isWorldStateUpdate = true;
|
||||
const [obj, idx] = configIdToIndexable(id);
|
||||
obj[idx] = value;
|
||||
}
|
||||
sendWsBroadcastEx({ config_reloaded: true }, undefined, parseInt(String(req.query.wsid)));
|
||||
sendWsBroadcast({ sync_world_state: true });
|
||||
if (isWorldStateUpdate) sendWsBroadcast({ sync_world_state: true });
|
||||
syncConfigWithDatabase();
|
||||
await saveConfig();
|
||||
res.end();
|
||||
|
||||
Reference in New Issue
Block a user