Scoreboard NameTagVisibility

Discussion in 'Spigot Plugin Development' started by chunza2542, Apr 16, 2017.

  1. Today. I want to make a plugin that get the old player scoreboard, add new teams to them, and set the new scoreboard to the player again.

    I starting with make the hashmap variable. for contain the own player scoreboard.
    Code (Text):
    HashMap<Player, Scoreboard> board = new HashMap<Player, Scoreboard>();
    And this is my code to add new team to player scoreboard with NameTagVisibility option.
    Code (Text):
        public void onWorldChange(final PlayerChangedWorldEvent event){
            if(event.getPlayer().getWorld().getName().equalsIgnoreCase("world") || event.getPlayer().getWorld().getName() == "world"){
              Scoreboard news = Bukkit.getScoreboardManager().getNewScoreboard();
              Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
                  public void run(){
                      board.put(event.getPlayer(), event.getPlayer().getScoreboard());
                      event.getPlayer().sendMessage(event.getPlayer().getScoreboard().getTeam("noName").getEntries().size() + "");
              }, 80);
    When I build & run this. it's show me in the chat "1" but It's not invisible the player name tag.
    How can I fixed this? Sorry for my English. thx!
  2. 1. Did you register the event properly
    2. If you are in a world called "world" you are stopping it
  3. Please wait at least 24 hours before bumping.
    • Useful Useful x 1
  4. @DizMizzer I want to hide the player name tag when player change world in minigame! and when the player back to the lobby. I want to reset it agian.
  5. Why arent you creating the scoreboard on enable and adding and removing players when they join the minigame
  6. When the player join minigame. The minigame plugin is set player new scoreboard.
  7. " event.getPlayer().getWorld().getName() == "world" "
    Oh my god, did you learn java ? ^^
    When you remove the player from the map, does the nametag disapear ? ^^