WIP: scoreboard #12
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren