Topic category: Help with Minecraft modding (Java Edition)
I have made a procedure that will check if a player has sent anything in chat, then check the nearest officer entity in a 32 block radius, and then check if it isn't already targeting someone, and then set it to a variable and for each entity in the 32 block radius of the officer entity, it will check if the entity's display name is contained anywhere in the message, and when there is one, then it also checks if it's not attacking an entity with the same UUID (basically checks if the entity it's targeting is itself), and if they do, the for loop continues, but if it doesn't have the same UUID, then it will make the officer target the entity and break out of the loop, The problem is, if there isn't any officer nearby, sending in chat doesn't work, i was trying to send a message in chat, but it only works when the officer is nearby, i just want to know what's causing this, here's the procedure: