fix(informer): 🐛 add missing name for entity info when entity is a player
Uses `username` when `entity.name` is missing; should check other cases
This commit is contained in:
parent
7cbfa16476
commit
7050a1621b
|
@ -32,14 +32,15 @@ function item(
|
||||||
|
|
||||||
function entity(name) {
|
function entity(name) {
|
||||||
const entity = bot.nearestEntity((entity) => {
|
const entity = bot.nearestEntity((entity) => {
|
||||||
return name && entity.name ? entity.name == name : true
|
const ename = entity.name || entity.username
|
||||||
|
return name && ename ? ename == name : true
|
||||||
})
|
})
|
||||||
console.log(entity)
|
console.log(entity)
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
cfg.quiet || bot.chat("no entity")
|
cfg.quiet || bot.chat("no entity")
|
||||||
return entity
|
return entity
|
||||||
}
|
}
|
||||||
let info = [entity.type, entity.name]
|
let info = [entity.type, entity.name || entity.username]
|
||||||
if (entity.metadata) info.push("len: " + entity.metadata.length)
|
if (entity.metadata) info.push("len: " + entity.metadata.length)
|
||||||
cfg.quiet || bot.chat(info.join("; "))
|
cfg.quiet || bot.chat(info.join("; "))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user