Scoreboard doesn't show

Discussion in 'Spigot Plugin Development' started by Enderaura, Jun 11, 2017.

Thread Status:
Not open for further replies.
  1. I wrote this code, it doesn't show a scoreboard when running the command or joining (commands and events registered, plugin.yml done)

    Code (Java):

    package com.enderqura.hcf;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.ScoreboardManager;
    import org.bukkit.scoreboard.Team;

    public class HCFScoreboard implements Listener, CommandExecutor{
       
       ScoreboardManager manager = Bukkit.getScoreboardManager();
       Scoreboard board = manager.getNewScoreboard();
       
       
       
       public void scoreboard(){
         
         Objective o = board.registerNewObjective("Test", "Dummy");
         
         Team team = board.registerNewTeam("team");
         
         o.setDisplayName("§6§lOasis HCF §c[Map 1]");
         o.setDisplaySlot(DisplaySlot.SIDEBAR);
         
         team.setDisplayName(ChatColor.RED + "");
         
         Score divider = o.getScore("§7§m+---------------+");
         divider.setScore(16);
       }
       
       @EventHandler
       public void onPlayerJoin(PlayerJoinEvent e){
         
         e.getPlayer().setScoreboard(board);
         
       }

       @Override
       public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
         
         if(arg1.getName().equalsIgnoreCase("test")){
           Player player = (Player) arg0;
           
           player.sendMessage("§6§lTESTSTSTSTTSTSTSTSTST");
           player.setScoreboard(board);
           
           return true;
         }
         
         
         
         return false;
       }
       
       
       
    }
     
     
  2. Any help please? I've googled this and can't find anything.
     
  3. Do you have ever any other plugins that have scoreboard that may be affecting it? Plugin list if possible
     
  4. Do you ever call scoreboard()?
     
    • Like Like x 1
  5. Okay I'm an idiot. Thanks.
     
Thread Status:
Not open for further replies.