diff --git a/lib/plugins/entities.js b/lib/plugins/entities.js index 80f2874af..33b83e95f 100644 --- a/lib/plugins/entities.js +++ b/lib/plugins/entities.js @@ -745,13 +745,15 @@ function inject (bot) { } else { const vehicle = fetchEntity(entityId) if (!vehicle.passengers) vehicle.passengers = [] - if (!passengers[0] && vehicle.passengers[0]) { + if (!passengers[0]) { + if (!vehicle.passengers[0]) return const passenger = fetchEntity(vehicle.passengers[0]) if (!passenger) return passenger.vehicle = null bot.emit('entityDetach', passenger, vehicle) } else { const passenger = fetchEntity(passengers[0]) + if (!passenger) return passenger.vehicle = vehicle bot.emit('entityAttach', passenger, vehicle) }