SteamWar/SpigotCore
Archiviert
13
0

WIP: scoreboard #12

Geschlossen
Lixfel möchte 22 Commits von scoreboard nach master mergen
Nur Änderungen aus Commit 2b0f64d86d werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -1,7 +1,15 @@
package de.steamwar.scoreboard;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketContainer;
import net.minecraft.server.v1_12_R1.IScoreboardCriteria;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
public class SWScoreboard_12 {
private SWScoreboard_12() {}
@ -11,7 +19,13 @@ public class SWScoreboard_12 {
}
static void sendCreatePacket(String title, Player player) {
SWScoreboard_8.sendCreatePacket(title, player);
PacketContainer createPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
createPacket.getStrings().write(0, "AAA");
createPacket.getIntegers().write(0, 0);
createPacket.getStrings().write(1, title);
createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0).write(0, IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER);
sendPacket(player, createPacket);
}
static void sendUpdatePacket(String content, Integer line, Player player) {
@ -22,5 +36,13 @@ public class SWScoreboard_12 {
SWScoreboard_8.sendDisplayPacket(player);
}
private static void sendPacket(Player player, PacketContainer packetContainer) {
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packetContainer);
} catch (InvocationTargetException ex) {
Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex);
}
}
}