Skip to content

Commit

Permalink
Finish Javadoc in packet classes
Browse files Browse the repository at this point in the history
  • Loading branch information
NEZNAMY committed Jun 22, 2024
1 parent 553787f commit 4209468
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,30 @@ public boolean handle(MinecraftSessionHandler minecraftSessionHandler) {
return PacketHandler.handle(minecraftSessionHandler, this);
}

/**
* Returns priority of this packet.
*
* @return priority of this packet
*/
public int getPacketPriority() {
return packetPriority;
}

/**
* Returns position the objective was assigned to.
*
* @return position the objective was assigned
*/
@NotNull
public DisplaySlot getPosition() {
return position;
}

/**
* Returns name of objective to assign position to.
*
* @return name of objective to assign position to
*/
@NotNull
public String getObjectiveName() {
return objectiveName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,32 +148,63 @@ public boolean handle(MinecraftSessionHandler minecraftSessionHandler) {
return PacketHandler.handle(minecraftSessionHandler, this);
}


/**
* Returns priority of this packet.
*
* @return priority of this packet
*/
public int getPacketPriority() {
return packetPriority;
}

/**
* Returns objective action.
*
* @return objective action
*/
@NotNull
public ObjectiveAction getAction() {
return action;
}

/**
* Returns name of the objective.
*
* @return name of the objective
*/
@NotNull
public String getObjectiveName() {
return objectiveName;
}

/**
* Returns title of the objective (for register and update actions only).
*
* @return title of the objective
*/
@Nullable
public TextHolder getTitle() {
return title;
}

/**
* Returns health display of the objective.
*
* @return health display of the objective
*/
@Nullable
public HealthDisplay getHealthDisplay() {
return healthDisplay;
}

/**
* Returns default number format for all scores in this objective.
*
* @return default number format for all scores in this objective
*/
@Nullable
public NumberFormat readNumberFormat() {
public NumberFormat getNumberFormat() {
return numberFormat;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public class ScorePacket implements MinecraftPacket {
/** Packet priority (higher value = higher priority) */
private final int packetPriority;

/** Packet action (0 = set, 1 = remove) */
/** Packet action */
private ScoreAction action;

/** Score holder who the score belongs to */
private String scoreHolder;

/** Objective from which the holder should be removed (null for all objectives ?) */
/** Objective where the score should be modified */
private String objectiveName;

/** Score value */
Expand Down Expand Up @@ -112,25 +112,50 @@ public boolean handle(MinecraftSessionHandler minecraftSessionHandler) {
return PacketHandler.handle(minecraftSessionHandler, this);
}

/**
* Returns priority of this packet.
*
* @return priority of this packet
*/
public int getPacketPriority() {
return packetPriority;
}

/**
* Returns packet action.
*
* @return packet action
*/
@NotNull
public ScoreAction getAction() {
return action;
}

/**
* Returns score holder.
*
* @return score holder
*/
@NotNull
public String getScoreHolder() {
return scoreHolder;
}

/**
* Returns objective where this score should be modified.
*
* @return objective where this score should be modified
*/
@Nullable
public String getObjectiveName() {
return objectiveName;
}

/**
* Returns score value.
*
* @return score value
*/
public int getValue() {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,30 @@ public boolean handle(MinecraftSessionHandler minecraftSessionHandler) {
return PacketHandler.handle(minecraftSessionHandler, this);
}

/**
* Returns priority of this packet.
*
* @return priority of this packet
*/
public int getPacketPriority() {
return packetPriority;
}

/**
* Returns score holder who should be removed from objective.
*
* @return score holder who should be removed from objective
*/
@NotNull
public String getScoreHolder() {
return scoreHolder;
}

/**
* Returns objective from which the holder should be removed, null for all objectives.
*
* @return objective from which the holder should be removed
*/
@Nullable
public String getObjectiveName() {
return objectiveName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,29 +115,59 @@ public boolean handle(MinecraftSessionHandler minecraftSessionHandler) {
return PacketHandler.handle(minecraftSessionHandler, this);
}

/**
* Returns priority of this packet.
*
* @return priority of this packet
*/
public int getPacketPriority() {
return packetPriority;
}

/**
* Return score holder who should be set in the objective.
*
* @return score holder who should be set in the objective
*/
@NotNull
public String getScoreHolder() {
return scoreHolder;
}

/**
* Returns name of objective where holder should be set.
*
* @return name of objective where holder should be set
*/
@NotNull
public String getObjectiveName() {
return objectiveName;
}

/**
* Returns value assigned to score holder.
*
* @return value assigned to score holder
*/
public int getValue() {
return value;
}

/**
* Returns custom name for the score holder.
*
* @return custom name for the score holder
*/
@Nullable
public ComponentHolder getDisplayName() {
return displayName;
}

/**
* Returns number format for the score.
*
* @return number format for the score
*/
@Nullable
public NumberFormat getNumberFormat() {
return numberFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ public TeamPacket(int packetPriority) {
this.packetPriority = packetPriority;
}

/**
* Constructs new instance with given parameters.
*
* @param packetPriority
* Priority of the packet
* @param action
* Team action
* @param name
* Team name
* @param properties
* Team properties
* @param entries
* Entries in the team
*/
public TeamPacket(int packetPriority, @NotNull TeamAction action, @NotNull String name,
@Nullable TeamProperties properties, @Nullable Collection<String> entries) {
this.packetPriority = packetPriority;
Expand Down Expand Up @@ -157,25 +171,50 @@ public boolean handle(MinecraftSessionHandler minecraftSessionHandler) {
return PacketHandler.handle(minecraftSessionHandler, this);
}

/**
* Returns priority of this packet.
*
* @return priority of this packet
*/
public int getPacketPriority() {
return packetPriority;
}

/**
* Returns team action.
*
* @return team action
*/
@NotNull
public TeamAction getAction() {
return action;
}

/**
* Returns team name.
*
* @return team name
*/
@NotNull
public String getName() {
return name;
}

/**
* Returns team properties (only for register and update actions).
*
* @return team properties
*/
@Nullable
public TeamProperties getProperties() {
return properties;
}

/**
* Returns entries in the team (only for register / add player / remove player).
*
* @return entries in the team
*/
@Nullable
public Collection<String> getEntries() {
return entries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setDisplaySlot(@Nullable DisplaySlot displaySlot) {
public void update(@NotNull ObjectivePacket packet) {
title = packet.getTitle();
healthDisplay = packet.getHealthDisplay();
numberFormat = packet.readNumberFormat();
numberFormat = packet.getNumberFormat();
}

public void setScore(@NotNull String holder, int value, @Nullable ComponentHolder displayName, @Nullable NumberFormat numberFormat) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void handle(@NotNull ObjectivePacket packet) {
packet.getObjectiveName(),
packet.getTitle(),
packet.getHealthDisplay(),
packet.readNumberFormat(),
packet.getNumberFormat(),
null
));
}
Expand Down

0 comments on commit 4209468

Please sign in to comment.