Skip to content

Commit

Permalink
Update entities.js
Browse files Browse the repository at this point in the history
  • Loading branch information
aesthetic0001 authored Dec 15, 2023
1 parent 269e737 commit 0dcdb30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plugins/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 0dcdb30

Please sign in to comment.