[ProtocolLib]ScoreBoard Sideber with Packet

Discussion in 'Spigot Plugin Development' started by gamerover98, May 28, 2015.

Thread Status:
Not open for further replies.
  1. hello, I'm using ProtocolLib and I've a problem with scorebaord, I can't remove the Lines from objective

    Wrapper: https://github.com/aadnk/PacketWrap...per/src/main/java/com/comphenix/packetwrapper

    code:


    Code (Text):
    private static String ObjName = "Test";
        public static String ObjTitle = "§cTest";
        public static WrapperPlayServerScoreboardObjective obj = new WrapperPlayServerScoreboardObjective();
        private static WrapperPlayServerScoreboardDisplayObjective display = new WrapperPlayServerScoreboardDisplayObjective();
        private static List<WrapperPlayServerScoreboardScore> score = new ArrayList<WrapperPlayServerScoreboardScore>();
    Send to each player the scoreboard:

    Code (Text):
        public static void send(Player p)
        {
            obj.setObjectiveValue(ObjTitle);
            obj.setObjectiveName(ObjName);
            obj.setPacketMode((byte)0);
         
            display.setPosition((byte)1);
            display.setScoreName(ObjName);
         
         
         
            for(int i=0; i<score.size();i++)
            {
                obj.sendPacket(p);
                display.sendPacket(p);
                score.get(i).sendPacket(p);
            }
         
        }
    add line method:

    Code (Text):
        public static void add(final String text, int pos)
        {

            //try to remove the line...
            String name = score.get(pos).getItemName();
            score.get(pos).getHandle().getStrings().write(0, name).write(1, ObjName);
            score.get(pos).getHandle().getIntegers().write(0, pos);
            score.get(pos).getHandle().getSpecificModifier(EnumScoreboardAction.class).write(0, EnumScoreboardAction.REMOVE);
            score.remove(pos);
         
            //create new line of score
            WrapperPlayServerScoreboardScore newScore = new WrapperPlayServerScoreboardScore();
         
            newScore.setItemName(text);
            newScore.setScoreName(ObjName);
            newScore.setValue(pos);
         
            score.add(pos,newScore);
         
        }
    effect...
    [​IMG]

    sorry for my english!
     
  2. Um.... Bukkit has a Scoreboard API
     
    • Agree Agree x 2
  3. As stated above, why not use Bukkit's Scoreboard manager? Is there a specific goal you're trying to achieve here?
     
  4. I want an animated scoreboard and bukkit isn't suitable

    I try use net.minecraft but I had the same problem
     
  5. Animated meaning what exactly? Do you have any screenshots or videos into what you are trying to do?
     
  6. yes,

     
    #6 gamerover98, May 28, 2015
    Last edited: May 28, 2015
  7. If u use teams and suffixes and prefixes with the bukkit api you can get like 32 chars per line ;)
     
  8. prefix + player + suffix = 48 chars ;)
    but i use packets of the classes of minecraft so... -> net.minecraft.server...
     
  9. And you can't achieve this by doing a repeating task and updating a player's scoreboard?
     
  10. if every time you remake the objective, it blink

    example
    [​IMG]
     
    • Agree Agree x 2
Thread Status:
Not open for further replies.