mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 07:37:43 +00: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;
|
||||
|
||||
var scene = scriptManager.getScene();
|
||||
var entity = scene.getEntityById(entityId);
|
||||
if (entity == null) return 2;
|
||||
|
||||
scene.broadcastPacket(
|
||||
new PacketServerGlobalValueChangeNotify(entity, sgvName, value));
|
||||
scene.runWhenFinished(() -> scene.broadcastPacket(
|
||||
new PacketServerGlobalValueChangeNotify(entityId, sgvName, value)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -16,4 +16,14 @@ public final class PacketServerGlobalValueChangeNotify extends BasePacket {
|
||||
.setValue(value)
|
||||
.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