Solved Scoreboard not showing up or working!!!!!!

Discussion in 'General Help' started by Shadow_tingBRO, Jul 24, 2018.

Thread Status:
Not open for further replies.
  1. THIS IS A BUKKIT/JAVA QUESTION: This is my first post on here so sry if i get something wrong! I am making a plugin which uses a scoreboard and lots of other stuff and whatever I do the scoreboard does NOT show up! I used player.setScoreBoard(b). [b is the scoreboard name.] I have watched people like TheSourceCode and others but it still does not work! Below is my main and the class [PlayerScoreBoard class] which is the code, I have registered the class in the onEnable method but I have still got no luck! I have literally NO idea what is wrong! Below is my Main class [MoneyBlock] and scoreboard class [PlayerScoreBoard]. I need a quick reply!

    I am running CraftBukkit version git-spigot-3d850ec-809c399 MC 1.12.2 implementing API version 1.12.2-RO.1-SNAPSHOT.

    Code:
       Main Class:
    package ml.servercraft.MB;
    
    import ...
    
    public class MoneyBlock extends JavaPlugin {
     
        private static MoneyBlock instance;
     
        public HashMap<UUID,PlayerManager> playermanager = new HashMap<UUID,PlayerManager>();
     
        public ArrayList<Player> playersInGame = new ArrayList<Player>();
     
        public PlayerScoreBoard playerScoreboard;
     
        public GameMechanics gameMechanics;
     
        public GameManager gameManager;
     
        public void onEnable() {
            instanceClasses();
            setInstance(this);
    
            loadConfig();
        }
    
    public void instanceClasses(){
    
    More Stuff...
    
    playerScoreboard = new PlayerScoreBoard();
    
    }
    
    
    
    Here is my PlayerScoreBoard Class:

    Code:
    package ml.servercraft.MB.Points;
    
    import...
    
    import ml.servercraft.MB.MoneyBlock;
    
    public class PlayerScoreBoard implements Listener {
    
        public static ScoreboardManager m;
        public static Scoreboard b;
        public static Objective o;
        public static Score time;
        public static Score coins;
    
        public static ScoreboardManager ml;
        public static Scoreboard bl;
        public static Objective ol;
        public static Score Winsl;
        public static Score Loosesl;
    
    
        private static MoneyBlock plugin = MoneyBlock.getPlugin(MoneyBlock.class);
    
        public void scoreGame(Player player) {
            m = Bukkit.getScoreboardManager();
            b = m.getNewScoreboard();
            o = b.registerNewObjective("mbcave", "");
            o.setDisplaySlot(DisplaySlot.SIDEBAR);
            o.setDisplayName(ChatColor.BLUE + "MoneyBlock-Cave");
        
            coins = o.getScore(ChatColor.GREEN + "Coins: ");
            coins.setScore(3);
    
            player.setScoreboard(b);
        }
    Was it that I did not use "dummy" and i used "" cause I filled that In and it still does not work! Also I have no errors in console and I have the plugin.yml working

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 24, 2018
  2. Offline

    Zombie_Striker

    @Shadow_tingBRO
    Are you sure that scoreGame is ever called? Can you post where it is called?
     
  3. Could you show me where to call it? BTW I used to use your LobbyAPI plugin ;)

    EDIT: I put this in the onEnable() method: playerScoreboard.scoreGame(); But I need to add the arguments to this (player and timeLeft) but I how would I do that?
     
    Last edited: Jul 24, 2018
  4. Offline

    Zombie_Striker

    Call it when you want the player to see the scoreboard.
     
    Shadow_tingBRO likes this.
  5. Thank you Zombie_Striker! I just instead of doing player.setScoreboard(board); where i wanted it to be called, i put that in the scoreboard method and then i call PlayerScoreBoard.scoreGame(player); in the command or wherever! Thank you so much really appreciated!

    EDIT: I do have another question: How would I make it so when a player joins a specific world called lets say "world1" then it will set add them to a arraylist or hashmap and then if they are in that array or hash they will be set the scoreboard and other stuff for them in the lobby? If you look in the main class i have a array and hash where i was experimenting but i have had no luck :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Jul 27, 2018
Thread Status:
Not open for further replies.

Share This Page