Send global value packet after the scene host has finished initializing the scene

This commit is contained in:
KingRainbow44
2023-07-14 23:03:49 -04:00
parent f0775f70f3
commit f17339f1b6
5 changed files with 81 additions and 35 deletions

View File

@@ -514,8 +514,8 @@ public class ScriptLib {
var entity = scene.getEntityByConfigId(cfgId);
if (entity == null) return 2;
scene.broadcastPacket(
new PacketServerGlobalValueChangeNotify(entity, sgvName, value));
scene.runWhenHostInitialized(() -> scene.broadcastPacket(
new PacketServerGlobalValueChangeNotify(entity, sgvName, value)));
return 0;
}
@@ -528,7 +528,7 @@ public class ScriptLib {
var scene = scriptManager.getScene();
scene.runWhenFinished(() -> scene.broadcastPacket(
scene.runWhenHostInitialized(() -> scene.broadcastPacket(
new PacketServerGlobalValueChangeNotify(entityId, sgvName, value)));
return 0;
}