mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-09 04:03:21 +08:00
Send packet after scene load & Directly send back entity ID to clients
This commit is contained in:
parent
fecf83cfa4
commit
f0775f70f3
@ -527,11 +527,9 @@ public class ScriptLib {
|
|||||||
if (scriptManager == null) return 1;
|
if (scriptManager == null) return 1;
|
||||||
|
|
||||||
var scene = scriptManager.getScene();
|
var scene = scriptManager.getScene();
|
||||||
var entity = scene.getEntityById(entityId);
|
|
||||||
if (entity == null) return 2;
|
|
||||||
|
|
||||||
scene.broadcastPacket(
|
scene.runWhenFinished(() -> scene.broadcastPacket(
|
||||||
new PacketServerGlobalValueChangeNotify(entity, sgvName, value));
|
new PacketServerGlobalValueChangeNotify(entityId, sgvName, value)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,4 +16,14 @@ public final class PacketServerGlobalValueChangeNotify extends BasePacket {
|
|||||||
.setValue(value)
|
.setValue(value)
|
||||||
.setKeyHash(Utils.abilityHash(abilityHash)));
|
.setKeyHash(Utils.abilityHash(abilityHash)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PacketServerGlobalValueChangeNotify(int entityId, String abilityHash, int value) {
|
||||||
|
super(PacketOpcodes.ServerGlobalValueChangeNotify);
|
||||||
|
|
||||||
|
this.setData(
|
||||||
|
ServerGlobalValueChangeNotify.newBuilder()
|
||||||
|
.setEntityId(entityId)
|
||||||
|
.setValue(value)
|
||||||
|
.setKeyHash(Utils.abilityHash(abilityHash)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user