Optimize 71a8ca2a

This commit is contained in:
KingRainbow44
2023-04-11 21:09:52 -04:00
parent 97f74d9d55
commit 7bac95098a

View File

@@ -512,13 +512,17 @@ public class ScriptLib {
}
public int SetEntityServerGlobalValueByConfigId(int cfgId, String sgvName, int value) {
logger.debug("[LUA] Call SetEntityServerGlobalValueByConfigId with {}, {}, {}",
cfgId, sgvName, value);
var scriptManager = this.getSceneScriptManager();
if (scriptManager == null) return 1;
var entity = scriptManager.getScene().getEntityByConfigId(cfgId);
var scene = scriptManager.getScene();
var entity = scene.getEntityByConfigId(cfgId);
if (entity == null) return 2;
scriptManager.getScene().getWorld().broadcastPacket(
scene.broadcastPacket(
new PacketServerGlobalValueChangeNotify(entity, sgvName, value));
return 0;
}