Skip to content

Commit

Permalink
Add nkx compatible Scoreboard class & Scoreboard related package name…
Browse files Browse the repository at this point in the history
… synchronization protocol library
  • Loading branch information
lt-name committed Oct 20, 2024
1 parent 2d9ea73 commit 00db25b
Show file tree
Hide file tree
Showing 5 changed files with 361 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/main/java/cn/nukkit/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -7169,9 +7169,9 @@ private List<ExperimentData> getExperiments() {
public void display(IScoreboard scoreboard, DisplaySlot slot) {
SetDisplayObjectivePacket pk = new SetDisplayObjectivePacket();
pk.displaySlot = slot;
pk.objectiveName = scoreboard.getObjectiveName();
pk.objectiveId = scoreboard.getObjectiveName();
pk.displayName = scoreboard.getDisplayName();
pk.criteriaName = scoreboard.getCriteriaName();
pk.criteria = scoreboard.getCriteriaName();
pk.sortOrder = scoreboard.getSortOrder();
this.dataPacket(pk);

Expand All @@ -7194,9 +7194,9 @@ public void display(IScoreboard scoreboard, DisplaySlot slot) {
public void hide(DisplaySlot slot) {
SetDisplayObjectivePacket pk = new SetDisplayObjectivePacket();
pk.displaySlot = slot;
pk.objectiveName = "";
pk.objectiveId = "";
pk.displayName = "";
pk.criteriaName = "";
pk.criteria = "";
pk.sortOrder = SortOrder.ASCENDING;
this.dataPacket(pk);

Expand All @@ -7209,7 +7209,7 @@ public void hide(DisplaySlot slot) {
@Override
public void removeScoreboard(IScoreboard scoreboard) {
RemoveObjectivePacket pk = new RemoveObjectivePacket();
pk.objectiveName = scoreboard.getObjectiveName();
pk.objectiveId = scoreboard.getObjectiveName();

this.dataPacket(pk);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class RemoveObjectivePacket extends DataPacket {

public static final byte NETWORK_ID = ProtocolInfo.REMOVE_OBJECTIVE_PACKET;

public String objectiveName;
public String objectiveId;

@Override
public byte pid() {
Expand All @@ -23,14 +23,14 @@ public void decode() {
@Override
public void encode() {
this.reset();
this.putString(this.objectiveName);
this.putString(this.objectiveId);
}

public void setObjectiveName(@NotNull String objectiveName) {
this.objectiveName = objectiveName;
public void setObjectiveId(@NotNull String objectiveName) {
this.objectiveId = objectiveName;
}

public String getObjectiveName() {
return this.objectiveName;
public String getObjectiveId() {
return this.objectiveId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
public class SetDisplayObjectivePacket extends DataPacket {

public DisplaySlot displaySlot;

public String
objectiveName,
displayName,
criteriaName;

public String objectiveId;
public String displayName;
public String criteria;
public SortOrder sortOrder;

@Override
Expand All @@ -30,9 +27,9 @@ public void decode() {
public void encode() {
this.reset();
this.putString(this.displaySlot.getSlotName());
this.putString(this.objectiveName);
this.putString(this.objectiveId);
this.putString(this.displayName);
this.putString(this.criteriaName);
this.putString(this.criteria);
this.putVarInt(this.sortOrder.ordinal());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@ToString
public class SetScorePacket extends DataPacket {

public Action action;
public List<ScoreInfo> infos = new ArrayList<>();

Expand Down
Loading

0 comments on commit 00db25b

Please sign in to comment.