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.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.ToString;
|
import lombok.Setter;
|
||||||
import lombok.With;
|
import lombok.With;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@With
|
@With
|
||||||
@ToString
|
@Setter(AccessLevel.NONE)
|
||||||
@EqualsAndHashCode
|
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
@AllArgsConstructor
|
||||||
public class ClientCraftingBookStatePacket implements Packet {
|
public class ClientCraftingBookStatePacket implements Packet {
|
||||||
private @NonNull CraftingBookStateType type;
|
private @NonNull CraftingBookStateType type;
|
||||||
private boolean bookOpen;
|
private boolean bookOpen;
|
||||||
|
|
|
@ -6,20 +6,18 @@ import com.github.steveice10.packetlib.packet.Packet;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.ToString;
|
import lombok.Setter;
|
||||||
import lombok.With;
|
import lombok.With;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@With
|
@With
|
||||||
@ToString
|
@Setter(AccessLevel.NONE)
|
||||||
@EqualsAndHashCode
|
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
@AllArgsConstructor
|
||||||
public class ClientDisplayedRecipePacket implements Packet {
|
public class ClientDisplayedRecipePacket implements Packet {
|
||||||
private @NonNull String recipeId;
|
private @NonNull String recipeId;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class ServerPlayerActionAckPacket implements Packet {
|
||||||
private @NonNull PlayerAction action;
|
private @NonNull PlayerAction action;
|
||||||
private boolean successful;
|
private boolean successful;
|
||||||
private @NonNull Position position;
|
private @NonNull Position position;
|
||||||
private @NonNull int newState;
|
private int newState;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NetInput in) throws IOException {
|
public void read(NetInput in) throws IOException {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.With;
|
import lombok.With;
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ import java.util.List;
|
||||||
@With
|
@With
|
||||||
@Setter(AccessLevel.NONE)
|
@Setter(AccessLevel.NONE)
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
@AllArgsConstructor
|
||||||
public class ServerPlayerPositionRotationPacket implements Packet {
|
public class ServerPlayerPositionRotationPacket implements Packet {
|
||||||
private double x;
|
private double x;
|
||||||
private double y;
|
private double y;
|
||||||
|
@ -29,16 +30,10 @@ public class ServerPlayerPositionRotationPacket implements Packet {
|
||||||
private float yaw;
|
private float yaw;
|
||||||
private float pitch;
|
private float pitch;
|
||||||
private int teleportId;
|
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) {
|
public ServerPlayerPositionRotationPacket(double x, double y, double z, float yaw, float pitch, int teleportId, PositionElement... relative) {
|
||||||
this.x = x;
|
this(x, y, z, yaw, pitch, teleportId, Arrays.asList(relative != null ? relative : new PositionElement[0]));
|
||||||
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]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,14 +28,24 @@ public class ServerScoreboardObjectivePacket implements Packet {
|
||||||
private Component displayName;
|
private Component displayName;
|
||||||
private ScoreType type;
|
private ScoreType type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a ServerScoreboardObjectivePacket for removing an objective.
|
||||||
|
* @param name Name of the objective.
|
||||||
|
*/
|
||||||
public ServerScoreboardObjectivePacket(@NonNull String name) {
|
public ServerScoreboardObjectivePacket(@NonNull String name) {
|
||||||
this.name = name;
|
this(name, ObjectiveAction.REMOVE, null, null);
|
||||||
this.action = ObjectiveAction.REMOVE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerScoreboardObjectivePacket(@NonNull String name, @NonNull ObjectiveAction action, @NonNull Component displayName, @NonNull ScoreType type) {
|
/**
|
||||||
if(action != ObjectiveAction.ADD && action != ObjectiveAction.UPDATE) {
|
* Constructs a ServerScoreboardObjectivePacket for adding or updating an objective.
|
||||||
throw new IllegalArgumentException("(name, action, displayName, type) constructor only valid for adding and updating objectives.");
|
* @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;
|
this.name = name;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.With;
|
import lombok.With;
|
||||||
|
|
||||||
|
@ -20,18 +21,18 @@ import java.io.IOException;
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public class ServerUpdateScorePacket implements Packet {
|
public class ServerUpdateScorePacket implements Packet {
|
||||||
private String entry;
|
private @NonNull String entry;
|
||||||
private ScoreboardAction action;
|
private @NonNull ScoreboardAction action;
|
||||||
private String objective;
|
private @NonNull String objective;
|
||||||
private int value;
|
private int value;
|
||||||
|
|
||||||
public ServerUpdateScorePacket(String entry, String objective) {
|
public ServerUpdateScorePacket(@NonNull String entry, @NonNull String objective) {
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
this.action = ScoreboardAction.REMOVE;
|
this.action = ScoreboardAction.REMOVE;
|
||||||
this.objective = objective;
|
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.entry = entry;
|
||||||
this.action = ScoreboardAction.ADD_OR_UPDATE;
|
this.action = ScoreboardAction.ADD_OR_UPDATE;
|
||||||
this.objective = objective;
|
this.objective = objective;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.With;
|
import lombok.With;
|
||||||
|
|
||||||
|
@ -23,8 +24,8 @@ import java.io.IOException;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ServerBlockBreakAnimPacket implements Packet {
|
public class ServerBlockBreakAnimPacket implements Packet {
|
||||||
private int breakerEntityId;
|
private int breakerEntityId;
|
||||||
private Position position;
|
private @NonNull Position position;
|
||||||
private BlockBreakStage stage;
|
private @NonNull BlockBreakStage stage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NetInput in) throws IOException {
|
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.io.NetOutput;
|
||||||
import com.github.steveice10.packetlib.packet.Packet;
|
import com.github.steveice10.packetlib.packet.Packet;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
@ -15,6 +16,7 @@ import java.io.IOException;
|
||||||
@With
|
@With
|
||||||
@Setter(AccessLevel.NONE)
|
@Setter(AccessLevel.NONE)
|
||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
@AllArgsConstructor
|
||||||
public class LoginPluginResponsePacket implements Packet {
|
public class LoginPluginResponsePacket implements Packet {
|
||||||
private int messageId;
|
private int messageId;
|
||||||
private byte[] data;
|
private byte[] data;
|
||||||
|
@ -23,11 +25,6 @@ public class LoginPluginResponsePacket implements Packet {
|
||||||
this(messageId, null);
|
this(messageId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginPluginResponsePacket(int messageId, byte[] data) {
|
|
||||||
this.messageId = messageId;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NetInput in) throws IOException {
|
public void read(NetInput in) throws IOException {
|
||||||
this.messageId = in.readVarInt();
|
this.messageId = in.readVarInt();
|
||||||
|
|
|
@ -12,7 +12,6 @@ import lombok.With;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@With
|
|
||||||
@Setter(AccessLevel.NONE)
|
@Setter(AccessLevel.NONE)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class StatusQueryPacket implements Packet {
|
public class StatusQueryPacket implements Packet {
|
||||||
|
|
Loading…
Reference in a new issue