mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 21:01:02 -05:00
Update ServerScoreboardObjectivePacket
This commit is contained in:
parent
90127e16ed
commit
d1f061bb86
2 changed files with 10 additions and 9 deletions
|
@ -814,8 +814,8 @@ public class MagicValues {
|
|||
register(TeamColor.YELLOW, 14);
|
||||
register(TeamColor.WHITE, 15);
|
||||
|
||||
register(ScoreType.INTEGER, "integer");
|
||||
register(ScoreType.HEARTS, "hearts");
|
||||
register(ScoreType.INTEGER, 0);
|
||||
register(ScoreType.HEARTS, 1);
|
||||
|
||||
register(Advancement.DisplayData.FrameType.TASK, 0);
|
||||
register(Advancement.DisplayData.FrameType.CHALLENGE, 1);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard;
|
|||
import com.github.steveice10.mc.protocol.data.MagicValues;
|
||||
import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreType;
|
||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
@ -12,7 +13,7 @@ import java.io.IOException;
|
|||
public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
||||
private String name;
|
||||
private ObjectiveAction action;
|
||||
private String displayName;
|
||||
private Message displayName;
|
||||
private ScoreType type;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -24,7 +25,7 @@ public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
|||
this.action = ObjectiveAction.REMOVE;
|
||||
}
|
||||
|
||||
public ServerScoreboardObjectivePacket(String name, ObjectiveAction action, String displayName, ScoreType type) {
|
||||
public ServerScoreboardObjectivePacket(String name, ObjectiveAction action, Message displayName, ScoreType type) {
|
||||
if(action != ObjectiveAction.ADD && action != ObjectiveAction.UPDATE) {
|
||||
throw new IllegalArgumentException("(name, action, displayName) constructor only valid for adding and updating objectives.");
|
||||
}
|
||||
|
@ -43,7 +44,7 @@ public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
|||
return this.action;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
public Message getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
|
@ -56,8 +57,8 @@ public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
|||
this.name = in.readString();
|
||||
this.action = MagicValues.key(ObjectiveAction.class, in.readByte());
|
||||
if(this.action == ObjectiveAction.ADD || this.action == ObjectiveAction.UPDATE) {
|
||||
this.displayName = in.readString();
|
||||
this.type = MagicValues.key(ScoreType.class, in.readString());
|
||||
this.displayName = Message.fromString(in.readString());
|
||||
this.type = MagicValues.key(ScoreType.class, in.readVarInt());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,8 +67,8 @@ public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
|||
out.writeString(this.name);
|
||||
out.writeByte(MagicValues.value(Integer.class, this.action));
|
||||
if(this.action == ObjectiveAction.ADD || this.action == ObjectiveAction.UPDATE) {
|
||||
out.writeString(this.displayName);
|
||||
out.writeString(MagicValues.value(String.class, this.type));
|
||||
out.writeString(this.displayName.toJsonString());
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue