Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setScoreObjectivePosition(ScorePosition, ScoreObjective, player) not working #142

Open
svdragster opened this issue Oct 20, 2013 · 4 comments
Assignees

Comments

@svdragster
Copy link

    Scoreboard sc = Canary.scoreboards().getScoreboard(player.getWorld());
    ScoreObjective obj = sc.getScoreObjective("Something_that_definetly_exists.");
    obj.setDisplayName("Scoreboard Title");
            Score timeleft = sc.getScore("Time left", obj);
    timeleft.setScore(30);

    for (int i=0; i<player.getWorld().getPlayerList().size(); i++) {
        Canary.getServer().message(i + ": " + player.getWorld().getPlayerList().get(i)); // Displays my name
        //sc.setScoreObjectivePostion(ScorePosition.SIDEBAR, obj); // Works
        sc.setScoreObjectivePostion(ScorePosition.SIDEBAR, obj, player.getWorld().getPlayerList().get(i)); // Does not work
    }
@ghost ghost assigned ayyron-dev Oct 20, 2013
@ayyron-dev
Copy link
Member

@svdragster

You need to use the addScoreboard() methods in Scoreboard to first add a new ScoreObjective to the scoreboard.

When you call ScoreObjective obj = sc.getScoreObjective("Something_that_definetly_exists."); it is returning a null object because it does not exist. it was never added.

After that when you do this:

sc.setScoreObjectivePostion(ScorePosition.SIDEBAR, obj, player.getWorld().getPlayerList().get(i)); // Does not work

it does not work because obj is null.

@svdragster
Copy link
Author

@somners I added the objective ingame via the scoreboard command. As mentioned the other method works perfectly, only the second one with Player does not make
the sidebar appear.

@ayyron-dev ayyron-dev reopened this Oct 23, 2013
@ayyron-dev
Copy link
Member

This has been investigated more. This feature may have to be dropped unless we do a near rewrite of the scoreboards system.

@ayyron-dev
Copy link
Member

alright, so implementing to work 'per player' in this manner would be improper. The method for updating every player still works. I'll be working on something relevant to this after the update to 1.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants