plugin to hide players without names are hidden in the tab

Discussion in 'Spigot Plugin Development' started by KazzLutor, May 29, 2016.

  1. Hello very good morning to everyone, well I wanted them to ask about on a plugin with short code but rather complex to do

    It is a plugin for a player to join a server that you hide all exept players names on the tab, this plugin I would help remove the lag of the people who come to play in modalities such as duel, 1v1, ect.

    I could tell you if this plugin that I mention both easy or difficult to create, and if they do want you to tell me as you would, I would appreciate an amount: p

    A greeting to all ^^
     
  2. Code (Text):
    Player player = (Player) sender;
          for (Player players: getServer().getOnlinePlayers()) {
         players.hidePlayer(player);
    player.setPlayerListName(player.getName() + "");
    Thats everything
     
    • Agree Agree x 1
    • Informative Informative x 1
  3. I've tried this code and if it works well, but now as I avoid the tablist be hidden?
     
  4. The tablist won't be hidden if that is what you mean
     
  5. Not because the code as well says only hides the player who puts the "hide" command, but the other player can not see because it is hidden from the list tab, I what I want is to make the player only see himself and not see others, you can only see it in the tab list

    Here I leave the code in case you want to try for yourself:


    Code (Text):
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
       
         if (cmd.getName().equalsIgnoreCase("hide") && sender instanceof Player) {
       
            Player player = (Player) sender;
            for (Player players: getServer().getOnlinePlayers()) {
            players.hidePlayer(player);
            player.setPlayerListName(player.getName() + "");
       
            }
            return true;
        }
        return true;
      }
    }
     
    #5 KazzLutor, May 29, 2016
    Last edited: May 29, 2016
  6. How l can made the plugin with that code??? I really need that


    If you want to help me here is my Skype!

    esgomero
     
  7. Why add a blank string to the player name?
     
    • Optimistic Optimistic x 1
  8. I'am not sure, but maybe its removing the tab name out the tab?
     
  9. Player#hidePlayer() also hides players from the tab list.