mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-12 08:41:00 -05:00
Clean up some Lombok annotations.
This commit is contained in:
parent
48860a8084
commit
840c8e2483
9 changed files with 37 additions and 38 deletions
|
@ -8,20 +8,18 @@ import com.github.steveice10.packetlib.packet.Packet;
|
|||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.Setter;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Setter(AccessLevel.NONE)
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor
|
||||
public class ClientCraftingBookStatePacket implements Packet {
|
||||
private @NonNull CraftingBookStateType type;
|
||||
private boolean bookOpen;
|
||||
|
|
|
@ -6,20 +6,18 @@ import com.github.steveice10.packetlib.packet.Packet;
|
|||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.Setter;
|
||||
import lombok.With;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Setter(AccessLevel.NONE)
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor
|
||||
public class ClientDisplayedRecipePacket implements Packet {
|
||||
private @NonNull String recipeId;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ServerPlayerActionAckPacket implements Packet {
|
|||
private @NonNull PlayerAction action;
|
||||
private boolean successful;
|
||||
private @NonNull Position position;
|
||||
private @NonNull int newState;
|
||||
private int newState;
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
|
|
|
@ -9,6 +9,7 @@ import lombok.AccessLevel;
|
|||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.With;
|
||||
|
||||
|
@ -21,7 +22,7 @@ import java.util.List;
|
|||
@With
|
||||
@Setter(AccessLevel.NONE)
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor
|
||||
public class ServerPlayerPositionRotationPacket implements Packet {
|
||||
private double x;
|
||||
private double y;
|
||||
|
@ -29,16 +30,10 @@ public class ServerPlayerPositionRotationPacket implements Packet {
|
|||
private float yaw;
|
||||
private float pitch;
|
||||
private int teleportId;
|
||||
private List<PositionElement> relative;
|
||||
private @NonNull List<PositionElement> relative;
|
||||
|
||||
public ServerPlayerPositionRotationPacket(double x, double y, double z, float yaw, float pitch, int teleportId, PositionElement... relative) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
this.teleportId = teleportId;
|
||||
this.relative = Arrays.asList(relative != null ? relative : new PositionElement[0]);
|
||||
this(x, y, z, yaw, pitch, teleportId, Arrays.asList(relative != null ? relative : new PositionElement[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,14 +28,24 @@ public class ServerScoreboardObjectivePacket implements Packet {
|
|||
private Component displayName;
|
||||
private ScoreType type;
|
||||
|
||||
/**
|
||||
* Constructs a ServerScoreboardObjectivePacket for removing an objective.
|
||||
* @param name Name of the objective.
|
||||
*/
|
||||
public ServerScoreboardObjectivePacket(@NonNull String name) {
|
||||
this.name = name;
|
||||
this.action = ObjectiveAction.REMOVE;
|
||||
this(name, ObjectiveAction.REMOVE, null, null);
|
||||
}
|
||||
|
||||
public ServerScoreboardObjectivePacket(@NonNull String name, @NonNull ObjectiveAction action, @NonNull Component displayName, @NonNull ScoreType type) {
|
||||
if(action != ObjectiveAction.ADD && action != ObjectiveAction.UPDATE) {
|
||||
throw new IllegalArgumentException("(name, action, displayName, type) constructor only valid for adding and updating objectives.");
|
||||
/**
|
||||
* Constructs a ServerScoreboardObjectivePacket for adding or updating an objective.
|
||||
* @param name Name of the objective.
|
||||
* @param action Action to perform.
|
||||
* @param displayName Display name of the objective.
|
||||
* @param type Type of score.
|
||||
*/
|
||||
public ServerScoreboardObjectivePacket(@NonNull String name, @NonNull ObjectiveAction action, Component displayName, ScoreType type) {
|
||||
if((action == ObjectiveAction.ADD || action == ObjectiveAction.UPDATE) && (displayName == null || type == null)) {
|
||||
throw new IllegalArgumentException("ADD and UPDATE actions require display name and type.");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
|
|
|
@ -9,6 +9,7 @@ import lombok.AccessLevel;
|
|||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.With;
|
||||
|
||||
|
@ -20,18 +21,18 @@ import java.io.IOException;
|
|||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class ServerUpdateScorePacket implements Packet {
|
||||
private String entry;
|
||||
private ScoreboardAction action;
|
||||
private String objective;
|
||||
private @NonNull String entry;
|
||||
private @NonNull ScoreboardAction action;
|
||||
private @NonNull String objective;
|
||||
private int value;
|
||||
|
||||
public ServerUpdateScorePacket(String entry, String objective) {
|
||||
public ServerUpdateScorePacket(@NonNull String entry, @NonNull String objective) {
|
||||
this.entry = entry;
|
||||
this.action = ScoreboardAction.REMOVE;
|
||||
this.objective = objective;
|
||||
}
|
||||
|
||||
public ServerUpdateScorePacket(String entry, String objective, int value) {
|
||||
public ServerUpdateScorePacket(@NonNull String entry, @NonNull String objective, int value) {
|
||||
this.entry = entry;
|
||||
this.action = ScoreboardAction.ADD_OR_UPDATE;
|
||||
this.objective = objective;
|
||||
|
|
|
@ -11,6 +11,7 @@ import lombok.AccessLevel;
|
|||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.With;
|
||||
|
||||
|
@ -23,8 +24,8 @@ import java.io.IOException;
|
|||
@AllArgsConstructor
|
||||
public class ServerBlockBreakAnimPacket implements Packet {
|
||||
private int breakerEntityId;
|
||||
private Position position;
|
||||
private BlockBreakStage stage;
|
||||
private @NonNull Position position;
|
||||
private @NonNull BlockBreakStage stage;
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.github.steveice10.packetlib.io.NetInput;
|
|||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
@ -15,6 +16,7 @@ import java.io.IOException;
|
|||
@With
|
||||
@Setter(AccessLevel.NONE)
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor
|
||||
public class LoginPluginResponsePacket implements Packet {
|
||||
private int messageId;
|
||||
private byte[] data;
|
||||
|
@ -23,11 +25,6 @@ public class LoginPluginResponsePacket implements Packet {
|
|||
this(messageId, null);
|
||||
}
|
||||
|
||||
public LoginPluginResponsePacket(int messageId, byte[] data) {
|
||||
this.messageId = messageId;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.messageId = in.readVarInt();
|
||||
|
|
|
@ -12,7 +12,6 @@ import lombok.With;
|
|||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@With
|
||||
@Setter(AccessLevel.NONE)
|
||||
@NoArgsConstructor
|
||||
public class StatusQueryPacket implements Packet {
|
||||
|
|
Loading…
Reference in a new issue