Entity verification

Discussion in 'Plugin Development' started by yLucasxz, Feb 13, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    yLucasxz

    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.
     
  2. Offline

    Kars

    1. Cancel chat event
    2. Get sender location
    3. Loop through all players, get their location, compare to sender location with Location#distance
    4. If below certain distance, send message to player
    easy
     
  3. Offline

    yLucasxz

    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");
        }
     
  4. Offline

    Kars

    So don't send that message if there is a player nearby :eek:
    @yLucasxz
     
Thread Status:
Not open for further replies.

Share This Page