how to use hideplayer() ??

Discussion in 'Plugin Development' started by Kaen1, Feb 20, 2021.

  1. Offline

    Kaen1

    So I am trying to make a plugin that is kind of like supervanish just not the same I just wanna troll my friend with it where if I type I chat invis I go invisible or him but I don't know how to do that I know that I can do event.getPlayer().setInvisible(true);

    but that just doesn't cut it as I want to have armor on also so you cant see my sprinting particles and see me on tab list

    is it just as simple as doing
    Code:
    event.getPlayer().hidePlayer(event.getPlayer());
    or does this not work? what will happen if i do this?

    I also don't want him to see it in chat as well as see the command if he does / that's why I am using a chat listener and not a command if you know any other way please state in the comments
     
    Last edited: Feb 20, 2021
  2. Offline

    Newdel

    Don't know. Maybe try it before you ask questions
     
  3. Online

    timtower Administrator Administrator Moderator

    @Kaen1 That line will hide the player from itself.
    Might want to look up the docs on that method.
    Chat is something you need to handle yourself.
     
  4. Offline

    Kaen1

    but i don't understand the docs they don't explain it enough for me to understand :(
     
  5. Offline

    Strahan

    This is not that complicated. The docs say:

    hidePlayer
    void hidePlayer(@NotNull Plugin plugin, @NotNull Player player)
    Hides a player from this player

    Parameters:

    plugin - Plugin that wants to hide the player
    player - Player to hide


    I emphasized the relevant part. So what you need to do is tell the server what players you are hiding this player from. Hiding from yourself isn't very effective, lol
     

Share This Page