SteamWar/SpigotCore
Archiviert
13
0

untested rework of dependent scoreboard source

Dieser Commit ist enthalten in:
BuildTools 2019-12-05 20:01:37 +01:00
Ursprung b15552ae74
Commit 2b0f64d86d

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);
}
}
}