feat(informer): ✨ add block info based on other players
Now should work for position of players other than the callee. Alternative implementation could use `entity` function. This allows to also work for named entities as a bonus.
This commit is contained in:
		@@ -263,8 +263,15 @@ function command(message_parts, player) {
 | 
				
			|||||||
                            block(player)
 | 
					                            block(player)
 | 
				
			||||||
                            break
 | 
					                            break
 | 
				
			||||||
                        default:
 | 
					                        default:
 | 
				
			||||||
 | 
					                            const aPlayer = bot.players[message_parts[1]]
 | 
				
			||||||
                            if (message_parts[1] in RelativePosEnum) {
 | 
					                            if (message_parts[1] in RelativePosEnum) {
 | 
				
			||||||
                                block(undefined, message_parts[1])
 | 
					                                block(undefined, message_parts[1])
 | 
				
			||||||
 | 
					                            } else if (aPlayer) {
 | 
				
			||||||
 | 
					                                if (aPlayer.entity) {
 | 
				
			||||||
 | 
					                                    block(aPlayer.entity)
 | 
				
			||||||
 | 
					                                } else {
 | 
				
			||||||
 | 
					                                    quiet || bot.chat(`info: player ${aPlayer.username} too far!`)
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
                            } else {
 | 
					                            } else {
 | 
				
			||||||
                                // or entity(message_parts[1]).position
 | 
					                                // or entity(message_parts[1]).position
 | 
				
			||||||
                                console.log(bot.players[message_parts[1]])
 | 
					                                console.log(bot.players[message_parts[1]])
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user