Solved How to hit a hidden player

Discussion in 'Plugin Development' started by sebcio98, Feb 24, 2015.

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

    sebcio98

    Hello. I'm trying to hide a player, but it doesn't work. The player is still visible

    Code:
    Player p = Bukkit.getPlayer(nick);
    Player hidep = Bukkit.getPlayer(playerToHide);
    
    p.hidePlayer(hidep);
    hidep.setMetadata("hidden", new FixedMetadataValue(this, true));
    Everything else in the code is working and doesn't affect this issue so I see no reason to post it..
    I tried to do it without metadata too and it didn't change anything.
     
  2. Offline

    mine-care

    Where is this piece of code coming from , I mean where u use it?
    And to globally hide a player loop through all players and loopplayr.hideayer(target);
     
  3. Offline

    sebcio98

    It's in the end of minigame's countdown schedule, but it's run only when the time is 0, so only once.

    Oh.. I used TagAPI'a refresh after hiding a player... *palmface* Nevermind..

    But here's another question!
    How to hit a player when he's hidden. My idea is to check that the player hit the air and if there was a hidden player in there, hit him, but it looks a bit complicated. Maybe there's an easier way?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  4. Offline

    _Filip

    vectors
     
  5. @sebcio98 If your problem is solved, please set this thread to "Solved" by going to Thread Tools > Edit Title > Prefix > Solved. :)
     
  6. Offline

    sebcio98

    @CodePlaysMinecraft When I was writing the 2nd problem I also changed the topic of the thread, so I can't mark this thread as solved because the problem is not solved. :)
     
  7. Offline

    sebcio98

    I did it! yay. I used ProtocolLib and some of this code. Works perfect. Thanks for help everyone.
     
Thread Status:
Not open for further replies.

Share This Page