Solved ScoreBoard Question

Discussion in 'Plugin Development' started by Dablakbandit, Apr 29, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Dablakbandit

    Hey,

    I've managed to get Team Prefix's and Suffix's to be seen on a scoreboard when all players share the same scoreboard, was wondering if its possible and how for players to see other players Teams Prefix's and Suffix's when they are not sharing the same scoreboard?

    Thanks in advanced!,
    Dablakbandit
     
  2. Offline

    Superckl1

    Dablakbandit

    It is not possible. Simple enough :p

    The players on a different Scoreboard simply don't receive the Team data. There's nothing you can do.

    Although, if you really need to, you can dive into packets and spoof it for the clients on a different Scoreboard. I've done it before, but it's not simple.
     
  3. Offline

    Dablakbandit

    Superckl1
    Mineplex does it...

    Thanks,
    Dablakbandit
     
  4. Offline

    Superckl1

    Dablakbandit

    How do you know? What exactly do you mean different Scoreboards?
     
  5. Offline

    Dablakbandit

    Superckl1
    What I am wanting is for every player to have a different scoreboard saying their wins, money etc, whilst also still having the prefix and suffix when you press the tab button.

    Thanks,
    Dablakbandit
     
  6. Offline

    Superckl1

    Dablakbandit
    You can just do that with objectives and teams. That doesn't require each player to have their own scoreboard. Objectives support per-player scores.
     
  7. Offline

    Dablakbandit

    Superckl1

    I tried that but couldn't get it to work? How does one do it?

    Thanks,
    Dablakbandit
     
  8. Offline

    Dablakbandit

    AdamQpzm
    I've tried setting each player a different scoreboard, which didn't work cause then the prefix's and suffix's didn't show, I then tried to set a objective on the on the scoreboard with each players name, which again didn't work cause it showed the names to everyone who had the scoreboard.

    Thanks,
    Dablakbandit
     
  9. Offline

    Superckl1

    I don't think you fully understand how Scoreboards work. Say you wanted a score called "Level" on the right hand side. You would create an objective called "Level" then call getScore(OfflinePlayer).set(int) to set the score for the player. Look up a a tutorial on Scoreboards if you still don't understand.
     
  10. Offline

    Dablakbandit

    Superckl1
    I understand Scoreboards, and have made them before, but what I am trying to do wont work with what you say, cause that changes the Objective "Level" on EVERYONES scoreboard, I am trying to make it per player.

    #Edit

    objective.getScore(OfflinePlayer).set(int)

    Also displays the score to everyone


    Thanks,
    Dablakbandit
     
  11. Offline

    Superckl1

    That's simply not true. I'm not sure what you are doing but I know for a fact that setScore does not do it for everyone. Can you post your code?
     
  12. Offline

    Dablakbandit

    Code:java
    1. sbh.setScoreboard(player);
    2. sbh.registerTeam(player.getName());
    3. Team team = sbh.getTeam(player.getName());
    4. team.addPlayer(player);
    5. team.setPrefix("");
    6. team.setSuffix("");
    7. for(Objective a : this.sbh.getObjectives()){
    8. a.getScore(player).setScore(50);
    9. }


    Its done for each player that logs in

    Thanks,
    Dablakbandit
     
  13. Offline

    Superckl1

    Dablakbandit
    With that code everyone will have the score as 50. You do that explicitly... Try incrementing the value each time you set the score. You'll see that each player will have a different score then.
     
  14. Offline

    Dablakbandit

    Yeah each player will have a different score, but I am wanting them to not see other players scores

    Thanks,
    Dablakbandit
     
  15. Offline

    Superckl1

    Uhm, they won't... I'm not entirely sure where you are getting this information. If the objective is displayed on the side only the player can see their own score.
     
  16. Offline

    Dablakbandit

    [​IMG]

    But they do...

    Thanks,
    Dablakbandit
     
  17. Offline

    Superckl1

    You're adding an objective for each player. Only add one when you first make the Scoreboard. What you see is an objective with your name, not your score.
     
  18. Offline

    Dablakbandit

    Code:java
    1. //////Other Objects
    2. private ScoreBoardHandler sbh;
    3. private int i = 1;
    4. private Objective a;
    5.  
    6.  
    7. //////Making
    8. this.sbh = new ScoreBoardHandler("Lobby", "Lobby", DisplaySlot.SIDEBAR);
    9. this.a = this.sbh.getMainObjective();
    10.  
    11. //////Setting ScoreBoard
    12. sbh.setScoreboard(player);
    13. sbh.registerTeam(player.getName());
    14. Team team = sbh.getTeam(player.getName());
    15. team.addPlayer(player);
    16. team.setPrefix("");
    17. team.setSuffix("");
    18. this.sbh.setObjectiveScore(this.a, player.getName(), i);
    19. i++;


    Still not working

    #Edit
    [​IMG]


    Thanks,
    Dablakbandit
     
  19. Offline

    Superckl1

    Can I see your ScoreBoardHandler?
     
  20. Offline

    Dablakbandit

    Superckl1

    http://pastebin.com/qyvC6yZG

    Thanks,
    Dablakbandit

    Superckl1
    I can create individual scoreboards and set scores easily, but that then removes the players Prefix + Suffix from being visible to other players as they are on a different scoreboard

    Thanks,
    Dablakbandit

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  21. Offline

    Superckl1

    Dablakbandit

    Oh! I completely misunderstood what you wanted to accomplish. You are going to have to make a scoreboard for each player so they can have their own scores on the side. For the prefix, you'll have to make a team for the player on each scoreboard so every other player can see his prefix. He won't be on their scoreboard, but will be on a team in their scoreboard. Does that make sense? I actually do this on my server.
     
  22. Offline

    Dablakbandit

    Superckl1

    Thanks so much!!!!!!!! Finally :D , I got it to work, but I need to handle Leaving/Joining, I will have to mess around with it a bit until it works.

    Thanks,
    Dablakbandit

    Superckl1

    http://pastebin.com/jGr0jpEj

    There is my finished Class, Thanks again for all the help!!!

    Thanks,
    Dablakbandit

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page