Compare commits
2 Commits
dev/scoreb
...
dev/title
| Author | SHA1 | Date | |
|---|---|---|---|
|
74a9066a04
|
|||
|
bc2d5a7e75
|
@@ -56,14 +56,11 @@ public enum State {
|
||||
Map.of(
|
||||
PingPacket.class, 0x1F,
|
||||
JoinGamePacket.class, 0x23,
|
||||
ScoreboardDisplayPacket.class, 0x3B,
|
||||
ScoreboardObjectivePacket.class, 0x42,
|
||||
TeamsPacket.class, 0x44,
|
||||
ScoreboardUpdateScorePacket.class, 0x45,
|
||||
SpawnPositionPacket.class, 0x46,
|
||||
ChunkDataPacket.class, 0x20,
|
||||
PlayerAbilitiesPacket.class,0x2C,
|
||||
SPlayerPositionAndLookPacket.class, 0x2F
|
||||
SPlayerPositionAndLookPacket.class, 0x2F,
|
||||
TitlePacket.class, 0x48
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -99,11 +99,6 @@ public class NetByteBuf extends ByteBuf {
|
||||
}
|
||||
|
||||
public void writeString(String string) {
|
||||
if (string == null) {
|
||||
writeVarInt(0);
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] buf = string.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
if (buf.length > Short.MAX_VALUE) {
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package mc.protocol.packets.server;
|
||||
|
||||
import lombok.Data;
|
||||
import mc.protocol.io.NetByteBuf;
|
||||
import mc.protocol.packets.ServerSidePacket;
|
||||
|
||||
/**
|
||||
* Отображение Scoreboard.
|
||||
*
|
||||
* <p>Структура пакета</p>
|
||||
* <pre>
|
||||
* | FIELD | TYPE | NOTES |
|
||||
* |------------|-------------|--------------------------------|
|
||||
* | Position | Byte | Положение: |
|
||||
* | | | 0 - list |
|
||||
* | | | 1 - sidebar |
|
||||
* | | | 2 - below name |
|
||||
* | | | 3-18 - team specific sidebar |
|
||||
* | Score Name | String (16) | Уникальное название Scoreboard |
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="https://wiki.vg/index.php?title=Protocol&oldid=14204#Display_Scoreboard" target="_top">Display Scoreboard</a>
|
||||
*/
|
||||
@Data
|
||||
public class ScoreboardDisplayPacket implements ServerSidePacket {
|
||||
|
||||
private int position;
|
||||
private String scoreName;
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = (position < 0) ? 0 : (Math.min(position, 18));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSelf(NetByteBuf netByteBuf) {
|
||||
netByteBuf.writeByte(this.position);
|
||||
netByteBuf.writeString(this.scoreName);
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package mc.protocol.packets.server;
|
||||
|
||||
import lombok.Data;
|
||||
import mc.protocol.io.NetByteBuf;
|
||||
import mc.protocol.packets.ServerSidePacket;
|
||||
import mc.protocol.utils.ScoreboardObjectiveMode;
|
||||
import mc.protocol.utils.ScoreboardObjectiveType;
|
||||
|
||||
/**
|
||||
* Scoreboard objective packet.
|
||||
*
|
||||
* <p>Структура пакета</p>
|
||||
* <pre>
|
||||
* | FIELD | TYPE | NOTES |
|
||||
* |-----------------|-------------|---------------------------------------------------|
|
||||
* | Objective Name | String (16) | Уникальное наименование цели (objective) |
|
||||
* | Mode | Byte | 0 - создание Scoreboard |
|
||||
* | | | 1 - удаление Scoreboard |
|
||||
* | | | 2 - обновление Scoreboard |
|
||||
* | Objective Value | String (32) | Если "Mode" равен 0 или 2. Отображаемый текст |
|
||||
* | Type | String (16) | Если "Mode" равен 0 или 2. "integer" или "hearts" |
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="https://wiki.vg/index.php?title=Protocol&oldid=14204#Scoreboard_Objective" target="_top">Scoreboard Objective</a>
|
||||
*/
|
||||
@Data
|
||||
public class ScoreboardObjectivePacket implements ServerSidePacket {
|
||||
|
||||
private String objectiveName;
|
||||
private ScoreboardObjectiveMode mode;
|
||||
private String objectiveValue;
|
||||
private ScoreboardObjectiveType type;
|
||||
|
||||
@Override
|
||||
public void writeSelf(NetByteBuf netByteBuf) {
|
||||
netByteBuf.writeString(this.objectiveName);
|
||||
netByteBuf.writeByte(this.mode.getCode());
|
||||
|
||||
if (ScoreboardObjectiveMode.CREATE.equals(this.mode) || ScoreboardObjectiveMode.UPDATE.equals(this.mode)) {
|
||||
netByteBuf.writeString(this.objectiveValue);
|
||||
netByteBuf.writeString(this.type.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package mc.protocol.packets.server;
|
||||
|
||||
import lombok.Data;
|
||||
import mc.protocol.io.NetByteBuf;
|
||||
import mc.protocol.packets.ServerSidePacket;
|
||||
import mc.protocol.utils.ScoreboardUpdateScoreAction;
|
||||
|
||||
/**
|
||||
* Update score packet.
|
||||
*
|
||||
* <p>Структура пакета</p>
|
||||
* <pre>
|
||||
* | FIELD | TYPE | NOTES |
|
||||
* |-----------------|-------------|--------------------------------------------------- |
|
||||
* | Entity Name | String (40) | Сущность, которой принадлежит счет (score). |
|
||||
* | | | Для Игроков - это ник |
|
||||
* | | | Для других сущностей - это UUID |
|
||||
* | Action | Byte | 0 - создать или обновить счет (score); 1 - удалить |
|
||||
* | Objective Name | String (16) | Имя сущности, которой принадлежит счет (score) |
|
||||
* | Value | VarInt | Если "Action" = 0. Значение счета (score) |
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="https://wiki.vg/index.php?title=Protocol&oldid=14204#Update_Score" target="_top">Update Score</a>
|
||||
*/
|
||||
@Data
|
||||
public class ScoreboardUpdateScorePacket implements ServerSidePacket {
|
||||
|
||||
private String entityName;
|
||||
private ScoreboardUpdateScoreAction action;
|
||||
private String objective;
|
||||
private int value;
|
||||
|
||||
@Override
|
||||
public void writeSelf(NetByteBuf netByteBuf) {
|
||||
netByteBuf.writeString(this.entityName);
|
||||
netByteBuf.writeByte(this.action.getCode());
|
||||
netByteBuf.writeString(this.objective);
|
||||
|
||||
if (ScoreboardUpdateScoreAction.CREATE_OR_UPDATE.equals(this.action)) {
|
||||
netByteBuf.writeVarInt(this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package mc.protocol.packets.server;
|
||||
|
||||
import lombok.Data;
|
||||
import mc.protocol.io.NetByteBuf;
|
||||
import mc.protocol.packets.ServerSidePacket;
|
||||
import mc.protocol.utils.TeamsCollisionRule;
|
||||
import mc.protocol.utils.TeamsMode;
|
||||
import mc.protocol.utils.TeamsNameTagVisibility;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Teams packet.
|
||||
*
|
||||
* <p>Структура пакета</p>
|
||||
* <pre>
|
||||
* | FIELD | TYPE | NOTES |
|
||||
* |------------ |-------------|-------------------------------------------------------|
|
||||
* | Team Name | String (16) | Уникальное название команды (совместно со scoreboard) |
|
||||
* | Mode | Byte | Режим. Определяет остальые поля пакета |
|
||||
* | Data Fields | - | Определяется "Mode" |
|
||||
* </pre>
|
||||
*
|
||||
* <p>Варианты "Mode"</p>
|
||||
* <pre>
|
||||
* | MODE | DATA FIELD | TYPE | NOTES |
|
||||
* | VALUE | DESCRIPTION | | | |
|
||||
* |-------|--------------------------|---------------------|----------------------|---------------------------------------------------|
|
||||
* | 0 | create team | Team Display Name | String (32) | |
|
||||
* | | | Team Prefix | String (16) | Отображается перед именем игроков текущей команды |
|
||||
* | | | Team Suffix | String (16) | Отображается после имени игроков текущей команды |
|
||||
* | | | Friendly Flags | Byte | Битовая маска: |
|
||||
* | | | | | 0x01 - разрешён friendly fire |
|
||||
* | | | | | 0x02 - могут видеть невидимок своей команды |
|
||||
* | | | Name Tag Visibility | String (32) | фиксированные значения: |
|
||||
* | | | | | - always |
|
||||
* | | | | | - hideForOtherTeams |
|
||||
* | | | | | - hideForOwnTeam |
|
||||
* | | | | | - never |
|
||||
* | | | Collision Rule | String (32) | фиксированные значения: |
|
||||
* | | | | | - always |
|
||||
* | | | | | - pushOtherTeams |
|
||||
* | | | | | - pushOwnTeam |
|
||||
* | | | | | - never |
|
||||
* | | | Color | Byte | For colors, the same Chat colors (0-15). |
|
||||
* | | | | | -1 indicates RESET/no color. |
|
||||
* | | | Entity Count | VarInt | Количество элементов в поле "Entities" |
|
||||
* | | | Entities | Array of String (40) | Уникальные идентификаторы участников команды. |
|
||||
* | | | | | Для Игроков - это Имена |
|
||||
* | | | | | Для любых других сущностей - это UUID |
|
||||
* | 1 | remove team | - | - | удаление текущей команды |
|
||||
* | 2 | update team info | Team Display Name | String (32) | |
|
||||
* | | | Team Prefix | String (16) | (см. выше) |
|
||||
* | | | Team Suffix | String (16) | (см. выше) |
|
||||
* | | | Friendly Flags | Byte | (см. выше) |
|
||||
* | | | Name Tag Visibility | String (32) | (см. выше) |
|
||||
* | | | Collision Rule | String (32) | (см. выше) |
|
||||
* | | | Color | Byte | (см. выше) |
|
||||
* | 3 | add players to team | Entity Count | VarInt | (см. выше) |
|
||||
* | | | Entities | Array of String (40) | (см. выше) |
|
||||
* | 4 | remove players from team | Entity Count | VarInt | (см. выше) |
|
||||
* | | | Entities | Array of String (40) | (см. выше) |
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="https://wiki.vg/index.php?title=Protocol&oldid=14204#Teams" target="_top">Teams</a>
|
||||
*/
|
||||
@Data
|
||||
public class TeamsPacket implements ServerSidePacket {
|
||||
|
||||
private final List<String> members = new ArrayList<>();
|
||||
|
||||
private String name;
|
||||
private TeamsMode mode;
|
||||
|
||||
private String displayName;
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
private TeamsNameTagVisibility nameTagVisibility;
|
||||
private TeamsCollisionRule collisionRule;
|
||||
private int color;
|
||||
|
||||
@Override
|
||||
public void writeSelf(NetByteBuf netByteBuf) {
|
||||
netByteBuf.writeString(this.name);
|
||||
netByteBuf.writeByte(this.mode.getCode());
|
||||
|
||||
switch (this.mode) {
|
||||
case CREATE:
|
||||
netByteBuf.writeString(this.displayName);
|
||||
netByteBuf.writeString(this.prefix);
|
||||
netByteBuf.writeString(this.suffix);
|
||||
netByteBuf.writeByte(0); // Friendly Flags
|
||||
netByteBuf.writeString(this.nameTagVisibility.getCode());
|
||||
netByteBuf.writeString(this.collisionRule.getCode());
|
||||
netByteBuf.writeByte(this.color);
|
||||
netByteBuf.writeVarInt(this.members.size());
|
||||
this.members.forEach(netByteBuf::writeString);
|
||||
break;
|
||||
case UPDATE:
|
||||
netByteBuf.writeString(this.displayName);
|
||||
netByteBuf.writeString(this.prefix);
|
||||
netByteBuf.writeString(this.suffix);
|
||||
netByteBuf.writeByte(0); // Friendly Flags
|
||||
netByteBuf.writeString(this.nameTagVisibility.getCode());
|
||||
netByteBuf.writeString(this.collisionRule.getCode());
|
||||
netByteBuf.writeByte(this.color);
|
||||
break;
|
||||
case ADD_MEMBER:
|
||||
case REMOVE_MEMBER:
|
||||
netByteBuf.writeVarInt(this.members.size());
|
||||
this.members.forEach(netByteBuf::writeString);
|
||||
break;
|
||||
case REMOVE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package mc.protocol.packets.server;
|
||||
|
||||
import lombok.Data;
|
||||
import mc.protocol.io.NetByteBuf;
|
||||
import mc.protocol.model.text.Text;
|
||||
import mc.protocol.model.text.TextColor;
|
||||
import mc.protocol.model.text.TextStyle;
|
||||
import mc.protocol.packets.ServerSidePacket;
|
||||
import mc.protocol.serializer.TextSerializer;
|
||||
import mc.protocol.utils.TitleAction;
|
||||
|
||||
/**
|
||||
* Title packet.
|
||||
*
|
||||
* <p>Структура пакета</p>
|
||||
* <pre>
|
||||
* | FIELD | TYPE | NOTES |
|
||||
* |-------------|-------------|----------------------------------|
|
||||
* | Action | VarInt | Определяет остальные поля пакета |
|
||||
* | Data fields | - | зависят от "Action" |
|
||||
* </pre>
|
||||
*
|
||||
* <p>Варианты "Action"</p>
|
||||
* <pre>
|
||||
* | ACTION | FIELD | TYPE | NOTES |
|
||||
* | VALUE | DESCRIPTION | | | |
|
||||
* |-------|-----------------------|-----------------|---------|-------------------------------------------------|
|
||||
* | 0 | set title | Title Text | Text | |
|
||||
* | 1 | set subtitle | Subtitle Text | Text | |
|
||||
* | 2 | set action bar | Action bar text | Text | [*] |
|
||||
* | 3 | set times and display | Fade In | Integer | Время (в тиках (tick)) на эфект появления |
|
||||
* | | | Stay | Integer | Время (в тиках (tick)) на отображение на экране |
|
||||
* | | | Fade Out | Integer | Время (в тиках (tick)) на эфект исчезания |
|
||||
* | 4 | hide | - | - | |
|
||||
* | 5 | reset | - | - | |
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* * - стоит обратить внимание, что {@link TextColor} и {@link TextStyle} не работают: клиент не применяет
|
||||
* стилистику в таком виде. Однако метод через символ "§" (\<span>u00a7</span>) работает.
|
||||
* </p>
|
||||
*
|
||||
* @see <a href="https://wiki.vg/index.php?title=Protocol&oldid=14204#Title">Title</a>
|
||||
*/
|
||||
@Data
|
||||
public class TitlePacket implements ServerSidePacket {
|
||||
|
||||
private TitleAction action;
|
||||
|
||||
private Text title;
|
||||
private Text subtitle;
|
||||
private Text actionbar;
|
||||
private Integer fadeIn;
|
||||
private Integer stay;
|
||||
private Integer fadeOut;
|
||||
|
||||
@Override
|
||||
public void writeSelf(NetByteBuf netByteBuf) {
|
||||
netByteBuf.writeVarInt(this.action.getCode());
|
||||
|
||||
switch (this.action) {
|
||||
case SET_TITLE:
|
||||
netByteBuf.writeString(TextSerializer.toJsonObject(this.title).toString());
|
||||
break;
|
||||
case SET_SUBTITLE:
|
||||
netByteBuf.writeString(TextSerializer.toJsonObject(this.subtitle).toString());
|
||||
break;
|
||||
case SET_ACTIONBAR:
|
||||
netByteBuf.writeString(TextSerializer.toJsonObject(this.actionbar).toString());
|
||||
break;
|
||||
case SET_TIMES_AND_DISPLAY:
|
||||
netByteBuf.writeInt(fadeIn);
|
||||
netByteBuf.writeInt(stay);
|
||||
netByteBuf.writeInt(fadeOut);
|
||||
break;
|
||||
case HIDE:
|
||||
case RESET:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package mc.protocol.utils;
|
||||
|
||||
public enum ScoreboardObjectiveType {
|
||||
INTEGER,
|
||||
HEARTS
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package mc.protocol.utils;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public class ScoreboardPosition {
|
||||
public final int LIST = 0;
|
||||
public final int SIDEBAR = 1;
|
||||
public final int BELOW_NAME = 2;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package mc.protocol.utils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public enum ScoreboardUpdateScoreAction {
|
||||
CREATE_OR_UPDATE(0),
|
||||
REMOVE(1);
|
||||
|
||||
@Getter
|
||||
private final int code;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package mc.protocol.utils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public enum TeamsCollisionRule {
|
||||
ALWAYS("always"),
|
||||
PUSH_OTHER_TEAMS("pushOtherTeams"),
|
||||
PUSH_OWN_TEAM("pushOwnTeam"),
|
||||
NEVER("never");
|
||||
|
||||
@Getter
|
||||
private final String code;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package mc.protocol.utils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public enum TeamsMode {
|
||||
CREATE(0),
|
||||
REMOVE(1),
|
||||
UPDATE(2),
|
||||
ADD_MEMBER(3),
|
||||
REMOVE_MEMBER(4);
|
||||
|
||||
@Getter
|
||||
private final int code;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package mc.protocol.utils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public enum TeamsNameTagVisibility {
|
||||
ALWAYS("always"),
|
||||
HIDE_FOR_OTHER_TEAMS("hideForOtherTeams"),
|
||||
HIDE_FOR_OWN_TEAM("hideForOwnTeam"),
|
||||
NEVER("never");
|
||||
|
||||
@Getter
|
||||
private final String code;
|
||||
}
|
||||
@@ -4,10 +4,13 @@ import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public enum ScoreboardObjectiveMode {
|
||||
CREATE(0),
|
||||
REMOVE(1),
|
||||
UPDATE(2);
|
||||
public enum TitleAction {
|
||||
SET_TITLE(0),
|
||||
SET_SUBTITLE(1),
|
||||
SET_ACTIONBAR(2),
|
||||
SET_TIMES_AND_DISPLAY(3),
|
||||
HIDE(4),
|
||||
RESET(5);
|
||||
|
||||
@Getter
|
||||
private final int code;
|
||||
@@ -7,13 +7,17 @@ import mc.protocol.api.ConnectionContext;
|
||||
import mc.protocol.model.Location;
|
||||
import mc.protocol.model.Look;
|
||||
import mc.protocol.model.ServerInfo;
|
||||
import mc.protocol.model.text.Text;
|
||||
import mc.protocol.packets.PingPacket;
|
||||
import mc.protocol.packets.client.HandshakePacket;
|
||||
import mc.protocol.packets.client.LoginStartPacket;
|
||||
import mc.protocol.packets.client.StatusServerRequestPacket;
|
||||
import mc.protocol.packets.server.*;
|
||||
import mc.protocol.serializer.TextSerializer;
|
||||
import mc.protocol.utils.*;
|
||||
import mc.protocol.utils.Difficulty;
|
||||
import mc.protocol.utils.GameMode;
|
||||
import mc.protocol.utils.LevelType;
|
||||
import mc.protocol.utils.TitleAction;
|
||||
import mc.server.config.Config;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
@@ -66,27 +70,23 @@ public class PacketHandler {
|
||||
}
|
||||
|
||||
public void onLoginStart(ConnectionContext context, LoginStartPacket loginStartPacket) {
|
||||
UUID playerUuid = UUID.randomUUID();
|
||||
int playerEid = random.nextInt();
|
||||
String playerName = loginStartPacket.getName();
|
||||
|
||||
var loginSuccessPacket = new LoginSuccessPacket();
|
||||
loginSuccessPacket.setUuid(playerUuid);
|
||||
loginSuccessPacket.setName(playerName);
|
||||
loginSuccessPacket.setUuid(UUID.randomUUID());
|
||||
loginSuccessPacket.setName(loginStartPacket.getName());
|
||||
|
||||
context.sendNow(loginSuccessPacket);
|
||||
context.setState(State.PLAY);
|
||||
|
||||
var joinGamePacket = new JoinGamePacket();
|
||||
joinGamePacket.setEntityId(playerEid);
|
||||
joinGamePacket.setGameMode(GameMode.SPECTATOR);
|
||||
joinGamePacket.setEntityId(random.nextInt());
|
||||
joinGamePacket.setGameMode(GameMode.SURVIVAL);
|
||||
joinGamePacket.setDimension(0/*Overworld*/);
|
||||
joinGamePacket.setDifficulty(Difficulty.PEACEFUL);
|
||||
joinGamePacket.setLevelType(LevelType.FLAT);
|
||||
|
||||
context.send(joinGamePacket);
|
||||
|
||||
Location spawnLocation = new Location(0d, 63d, 0d);
|
||||
Location spawnLocation = new Location(7d, 130d, 7d);
|
||||
|
||||
var spawnPositionPacket = new SpawnPositionPacket();
|
||||
spawnPositionPacket.setSpawn(spawnLocation);
|
||||
@@ -125,33 +125,13 @@ public class PacketHandler {
|
||||
|
||||
context.flushSending();
|
||||
|
||||
// --- Эксперименты --- //
|
||||
// -- Эксперименты -- //
|
||||
|
||||
String scoreboardName = "Score::List";
|
||||
var titlePacket = new TitlePacket();
|
||||
titlePacket.setAction(TitleAction.SET_TITLE);
|
||||
titlePacket.setTitle(Text.of("HELLO"));
|
||||
|
||||
var scoreboardObjectivePacket = new ScoreboardObjectivePacket();
|
||||
scoreboardObjectivePacket.setObjectiveName(scoreboardName);
|
||||
scoreboardObjectivePacket.setMode(ScoreboardObjectiveMode.CREATE);
|
||||
scoreboardObjectivePacket.setObjectiveValue(scoreboardName);
|
||||
scoreboardObjectivePacket.setType(ScoreboardObjectiveType.INTEGER);
|
||||
|
||||
context.send(scoreboardObjectivePacket);
|
||||
|
||||
var scoreboardDisplayPacket = new ScoreboardDisplayPacket();
|
||||
scoreboardDisplayPacket.setPosition(ScoreboardPosition.SIDEBAR);
|
||||
scoreboardDisplayPacket.setScoreName(scoreboardName);
|
||||
|
||||
context.send(scoreboardDisplayPacket);
|
||||
|
||||
var scoreboardUpdateScorePacket = new ScoreboardUpdateScorePacket();
|
||||
scoreboardUpdateScorePacket.setEntityName(playerName);
|
||||
scoreboardUpdateScorePacket.setAction(ScoreboardUpdateScoreAction.CREATE_OR_UPDATE);
|
||||
scoreboardUpdateScorePacket.setObjective(scoreboardName);
|
||||
scoreboardUpdateScorePacket.setValue(100500);
|
||||
|
||||
context.send(scoreboardUpdateScorePacket);
|
||||
|
||||
context.flushSending();
|
||||
context.sendNow(titlePacket);
|
||||
}
|
||||
|
||||
private static String faviconToBase64(Path iconPath) {
|
||||
|
||||
Reference in New Issue
Block a user