Guys I have a problem with my plugin and I wanted some help. I don't know how I place a check on the chat site for the message to be sent only to players at a distance from you. If you wanted to help here is the open source https://github.com/lucascorreagoldani/lChat Thanks. Obrigado.
Cancel chat event Get sender location Loop through all players, get their location, compare to sender location with Location#distance If below certain distance, send message to player easy
I made a code that I could identify correctly, but, it turned out that when I put a message with p.sendmessage to inform that there is no one close, it was sent even when there was a player nearby I updated the GitHub Source if I can take a look. Actually on GitHub I didn't add a message but it was basically like this: Code: } e.getRecipients().clear(); e.getRecipients().addAll(t); p.sendMessage("§cNinguém por perto"); }