mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 04:15:34 +08:00
fix: Solar Isotoma Elevator doesn't work in multiplayer mode (#1848)
This commit is contained in:
parent
ef55e5515c
commit
ec3cdc040f
@ -4,7 +4,6 @@ import emu.grasscutter.game.entity.platform.EntityPlatform;
|
|||||||
import emu.grasscutter.net.packet.Opcodes;
|
import emu.grasscutter.net.packet.Opcodes;
|
||||||
import emu.grasscutter.net.packet.PacketHandler;
|
import emu.grasscutter.net.packet.PacketHandler;
|
||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
import emu.grasscutter.net.proto.PacketHeadOuterClass;
|
|
||||||
import emu.grasscutter.net.proto.UpdateAbilityCreatedMovingPlatformNotifyOuterClass;
|
import emu.grasscutter.net.proto.UpdateAbilityCreatedMovingPlatformNotifyOuterClass;
|
||||||
import emu.grasscutter.server.game.GameSession;
|
import emu.grasscutter.server.game.GameSession;
|
||||||
import emu.grasscutter.server.packet.send.PacketPlatformStartRouteNotify;
|
import emu.grasscutter.server.packet.send.PacketPlatformStartRouteNotify;
|
||||||
@ -14,7 +13,6 @@ import emu.grasscutter.server.packet.send.PacketPlatformStopRouteNotify;
|
|||||||
public class HandlerUpdateAbilityCreatedMovingPlatformNotify extends PacketHandler {
|
public class HandlerUpdateAbilityCreatedMovingPlatformNotify extends PacketHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||||
var sequence = PacketHeadOuterClass.PacketHead.parseFrom(header).getClientSequenceId();
|
|
||||||
var notify = UpdateAbilityCreatedMovingPlatformNotifyOuterClass.UpdateAbilityCreatedMovingPlatformNotify.parseFrom(payload);
|
var notify = UpdateAbilityCreatedMovingPlatformNotifyOuterClass.UpdateAbilityCreatedMovingPlatformNotify.parseFrom(payload);
|
||||||
var entity = session.getPlayer().getScene().getEntityById(notify.getEntityId());
|
var entity = session.getPlayer().getScene().getEntityById(notify.getEntityId());
|
||||||
|
|
||||||
@ -22,9 +20,11 @@ public class HandlerUpdateAbilityCreatedMovingPlatformNotify extends PacketHandl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var scene = ((EntityPlatform) entity).getOwner().getScene();
|
||||||
|
|
||||||
switch (notify.getOpType()) {
|
switch (notify.getOpType()) {
|
||||||
case OP_TYPE_ACTIVATE -> session.send(new PacketPlatformStartRouteNotify(sequence, (EntityPlatform) entity, session.getPlayer().getScene()));
|
case OP_TYPE_ACTIVATE -> scene.broadcastPacket(new PacketPlatformStartRouteNotify((EntityPlatform) entity, scene));
|
||||||
case OP_TYPE_DEACTIVATE -> session.send(new PacketPlatformStopRouteNotify(sequence, (EntityPlatform) entity, session.getPlayer().getScene()));
|
case OP_TYPE_DEACTIVATE -> scene.broadcastPacket(new PacketPlatformStopRouteNotify((EntityPlatform) entity, scene));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import emu.grasscutter.net.packet.PacketOpcodes;
|
|||||||
import emu.grasscutter.net.proto.PlatformStartRouteNotifyOuterClass;
|
import emu.grasscutter.net.proto.PlatformStartRouteNotifyOuterClass;
|
||||||
|
|
||||||
public class PacketPlatformStartRouteNotify extends BasePacket {
|
public class PacketPlatformStartRouteNotify extends BasePacket {
|
||||||
public PacketPlatformStartRouteNotify(int clientSequence, EntityPlatform entity, Scene scene) {
|
public PacketPlatformStartRouteNotify(EntityPlatform entity, Scene scene) {
|
||||||
super(PacketOpcodes.PlatformStartRouteNotify, clientSequence);
|
super(PacketOpcodes.PlatformStartRouteNotify);
|
||||||
|
|
||||||
var notify = PlatformStartRouteNotifyOuterClass.PlatformStartRouteNotify.newBuilder()
|
var notify = PlatformStartRouteNotifyOuterClass.PlatformStartRouteNotify.newBuilder()
|
||||||
.setEntityId(entity.getId())
|
.setEntityId(entity.getId())
|
||||||
|
@ -7,8 +7,8 @@ import emu.grasscutter.net.packet.PacketOpcodes;
|
|||||||
import emu.grasscutter.net.proto.PlatformStopRouteNotifyOuterClass;
|
import emu.grasscutter.net.proto.PlatformStopRouteNotifyOuterClass;
|
||||||
|
|
||||||
public class PacketPlatformStopRouteNotify extends BasePacket {
|
public class PacketPlatformStopRouteNotify extends BasePacket {
|
||||||
public PacketPlatformStopRouteNotify(int clientSequence, EntityPlatform entity, Scene scene) {
|
public PacketPlatformStopRouteNotify(EntityPlatform entity, Scene scene) {
|
||||||
super(PacketOpcodes.PlatformStopRouteNotify, clientSequence);
|
super(PacketOpcodes.PlatformStopRouteNotify);
|
||||||
|
|
||||||
var notify = PlatformStopRouteNotifyOuterClass.PlatformStopRouteNotify.newBuilder()
|
var notify = PlatformStopRouteNotifyOuterClass.PlatformStopRouteNotify.newBuilder()
|
||||||
.setPlatform(entity.onStopRoute())
|
.setPlatform(entity.onStopRoute())
|
||||||
|
Loading…
Reference in New Issue
Block a user