ScoreBoard Update Packet

Wenn ihr bei eurem Plugin nicht weiter kommt, könnt ihr hier euer Problem beschreiben und um Hilfe bitten.

ScoreBoard Update Packet

Beitragvon Starmixcraft » Fr 9. Jun 2017, 12:53

´Hallo,
ich habe ein scoreboard mit packets gesenden, das klappt auch nur jedes mal wenn ich es updatet flackert es so komisch, ich habe gehört das es ein update packet gibt aber ich weiß nicht wie ich das verwende könnte mir das einer erklären?

Code: Alles auswählen
  1. public static void setScoreBoard(Player p, int i){
  2.     Scoreboard board = new Scoreboard();
  3.     ScoreboardObjective obj = board.registerObjective("§c§lScoreBoard", IScoreboardCriteria.b);
  4.     obj.setDisplayName("§c§lScoreBoard");
  5.     if(i == 0){
  6.         PacketPlayOutScoreboardObjective removepacket = new PacketPlayOutScoreboardObjective(obj, 1);
  7.         sendPacket(p, removepacket);
  8.         PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
  9.         sendPacket(p, createpacket);
  10.         PacketPlayOutScoreboardDisplayObjective display = new PacketPlayOutScoreboardDisplayObjective(1, obj);
  11.         sendPacket(p, display);
  12.     ScoreboardScore s1 = new ScoreboardScore(board, obj, "§a§lToDo:");
  13.     s1.setScore(10);
  14.     ScoreboardScore s2 = new ScoreboardScore(board, obj, "§2");
  15.     s2.setScore(9);
  16.     ScoreboardScore s3 = new ScoreboardScore(board, obj, "§8» §b" + main.t1);
  17.     s3.setScore(8);
  18.     ScoreboardScore s4 = new ScoreboardScore(board, obj, "§3");
  19.     s4.setScore(7);
  20.     ScoreboardScore s5 = new ScoreboardScore(board, obj, "§§§8» §b" + main.t2);
  21.     s5.setScore(6);
  22.     ScoreboardScore s6 = new ScoreboardScore(board, obj, "§4");
  23.     s6.setScore(5);
  24.     ScoreboardScore s7 = new ScoreboardScore(board, obj, "§ §8» §b" + main.t3);
  25.     s7.setScore(4);
  26.     ScoreboardScore s8 = new ScoreboardScore(board, obj, "§1");
  27.     s8.setScore(3);
  28.     ScoreboardScore s9 = new ScoreboardScore(board, obj, "§§§ §8» §b" + main.t4);
  29.     s9.setScore(2);
  30.     ScoreboardScore s10 = new ScoreboardScore(board, obj, "§9");
  31.     s10.setScore(1);
  32.     ScoreboardScore s11 = new ScoreboardScore(board, obj, "§§§§§8» §b" + main.t5);
  33.     s11.setScore(0);
  34.     PacketPlayOutScoreboardScore ps1 = new PacketPlayOutScoreboardScore(s1);
  35.     PacketPlayOutScoreboardScore ps2 = new PacketPlayOutScoreboardScore(s2);
  36.     PacketPlayOutScoreboardScore ps3 = new PacketPlayOutScoreboardScore(s3);
  37.     PacketPlayOutScoreboardScore ps4 = new PacketPlayOutScoreboardScore(s4);
  38.     PacketPlayOutScoreboardScore ps5 = new PacketPlayOutScoreboardScore(s5);
  39.     PacketPlayOutScoreboardScore ps6 = new PacketPlayOutScoreboardScore(s6);
  40.     PacketPlayOutScoreboardScore ps7 = new PacketPlayOutScoreboardScore(s7);
  41.     PacketPlayOutScoreboardScore ps8 = new PacketPlayOutScoreboardScore(s8);
  42.     PacketPlayOutScoreboardScore ps9 = new PacketPlayOutScoreboardScore(s9);
  43.     PacketPlayOutScoreboardScore ps10 = new PacketPlayOutScoreboardScore(s10);
  44.     PacketPlayOutScoreboardScore ps11 = new PacketPlayOutScoreboardScore(s11);
  45.         sendPacket(p, ps1);
  46.         sendPacket(p, ps2);
  47.         sendPacket(p, ps3);
  48.         sendPacket(p, ps4);
  49.         sendPacket(p, ps5);
  50.         sendPacket(p, ps6);
  51.         sendPacket(p, ps7);
  52.         sendPacket(p, ps8);
  53.         sendPacket(p, ps9);
  54.         sendPacket(p, ps10);
  55.         sendPacket(p, ps11);
  56.     }else{
  57.     PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
  58.     PacketPlayOutScoreboardDisplayObjective display = new PacketPlayOutScoreboardDisplayObjective(1, obj);
  59.     sendPacket(p, display);
  60. ScoreboardScore s1 = new ScoreboardScore(board, obj, "§a§lToDo:");
  61. s1.setScore(10);
  62. ScoreboardScore s2 = new ScoreboardScore(board, obj, "§2");
  63. s2.setScore(9);
  64. ScoreboardScore s3 = new ScoreboardScore(board, obj, "§8» §b" + main.t1);
  65. s3.setScore(8);
  66. ScoreboardScore s4 = new ScoreboardScore(board, obj, "§3");
  67. s4.setScore(7);
  68. ScoreboardScore s5 = new ScoreboardScore(board, obj, "§§§8» §b" + main.t2);
  69. s5.setScore(6);
  70. ScoreboardScore s6 = new ScoreboardScore(board, obj, "§4");
  71. s6.setScore(5);
  72. ScoreboardScore s7 = new ScoreboardScore(board, obj, "§ §8» §b" + main.t3);
  73. s7.setScore(4);
  74. ScoreboardScore s8 = new ScoreboardScore(board, obj, "§1");
  75. s8.setScore(3);
  76. ScoreboardScore s9 = new ScoreboardScore(board, obj, "§§§ §8» §b" + main.t4);
  77. s9.setScore(2);
  78. ScoreboardScore s10 = new ScoreboardScore(board, obj, "§9");
  79. s10.setScore(1);
  80. ScoreboardScore s11 = new ScoreboardScore(board, obj, "§§§§§8» §b" + main.t5);
  81. s11.setScore(0);
  82. PacketPlayOutScoreboardScore ps1 = new PacketPlayOutScoreboardScore(s1);
  83. PacketPlayOutScoreboardScore ps2 = new PacketPlayOutScoreboardScore(s2);
  84. PacketPlayOutScoreboardScore ps3 = new PacketPlayOutScoreboardScore(s3);
  85. PacketPlayOutScoreboardScore ps4 = new PacketPlayOutScoreboardScore(s4);
  86. PacketPlayOutScoreboardScore ps5 = new PacketPlayOutScoreboardScore(s5);
  87. PacketPlayOutScoreboardScore ps6 = new PacketPlayOutScoreboardScore(s6);
  88. PacketPlayOutScoreboardScore ps7 = new PacketPlayOutScoreboardScore(s7);
  89. PacketPlayOutScoreboardScore ps8 = new PacketPlayOutScoreboardScore(s8);
  90. PacketPlayOutScoreboardScore ps9 = new PacketPlayOutScoreboardScore(s9);
  91. PacketPlayOutScoreboardScore ps10 = new PacketPlayOutScoreboardScore(s10);
  92. PacketPlayOutScoreboardScore ps11 = new PacketPlayOutScoreboardScore(s11);
  93.     sendPacket(p, ps1);
  94.     sendPacket(p, ps2);
  95.     sendPacket(p, ps3);
  96.     sendPacket(p, ps4);
  97.     sendPacket(p, ps5);
  98.     sendPacket(p, ps6);
  99.     sendPacket(p, ps7);
  100.     sendPacket(p, ps8);
  101.     sendPacket(p, ps9);
  102.     sendPacket(p, ps10);
  103.     sendPacket(p, ps11);
  104.     sendPacket(p, createpacket);
  105. }
  106. }
  107. private static void sendPacket(Player p, Packet<?> packet) {
  108. ((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
  109. }



der int oben sagt nur ob es gesetzt werden soll 0, oder geupdatet 1

wäre echt nice wenn mir eine helfen könnte,

Danke im voraus,
Starmixcraft


PS: nein ich kann nicht die bukkit ScoreBoard API verwenden ich will nämlich 2 ScoreBoards haben deshalb muss ich 1 per Packet senden
Benutzeravatar
Starmixcraft
 
Beiträge: 1
Registriert: Fr 9. Jun 2017, 12:51

Re: ScoreBoard Update Packet

Beitragvon ServerGoogle » Di 20. Jun 2017, 14:54

Ich bin grade leider am Handy aber du solltest dir mal bei YouTube parr Videos anschauen und dann dir das raussuchen was deinen Erwartungen entspricht ich hab iergentwo auf mein Rechner eine fertige klasse programmiert ohne das flakkern
Wen ich zuhause wieder bin kann ich dir ja mal ein Stöpsel hochladen MfG ServerGoogle
Benutzeravatar
ServerGoogle
 
Beiträge: 11
Registriert: Mo 19. Jun 2017, 17:07


Zurück zu Hilfe und Support

Wer ist online?

Mitglieder in diesem Forum: Google [Bot] und 3 Gäste