Skip to content

Commit

Permalink
refactor: fix lombok
Browse files Browse the repository at this point in the history
  • Loading branch information
brenoepics committed Jun 9, 2024
1 parent 8c53f2b commit bfc2c7c
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@ResourceType(name = "RewardPreviewExcelConfigData.json", loadPriority = LoadPriority.HIGH)
public class RewardPreviewData extends GameResource {
@Getter(onMethod_ = @Override)
@Getter(onMethod = @__(@Override))
private int id;

private ItemParamStringData[] previewItems;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@Getter
@ResourceType(name = "QuestExcelConfigData.json")
@Getter
@ToString
public class QuestData extends GameResource {
private int subId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@ResourceType(name = "ReliquaryMainPropExcelConfigData.json")
@Getter
public class ReliquaryMainPropData extends GameResource {
@Getter(onMethod_ = @Override)
@Getter(onMethod = @__(@Override))
private int id;

private int propDepotId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@ResourceType(name = "SceneExcelConfigData.json")
@Getter
public final class SceneData extends GameResource {
@Getter(onMethod_ = @Override)
@Getter(onMethod = @__(@Override))
private int id;

@SerializedName("type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@ResourceType(name = "SceneTagConfigData.json")
@Getter
public final class SceneTagData extends GameResource {
@Getter(onMethod_ = @Override)
@Getter(onMethod = @__(@Override))
private int id;

@SerializedName("DJCOAOBDIHP")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
public class TrialAvatarActivityDataData extends GameResource {
@Getter(onMethod_ = @Override)
@Getter(onMethod = @__({@Override}))
private int id;

private int trialAvatarIndexId;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/emu/grasscutter/game/friends/FriendsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public synchronized void handleFriendRequest(int targetUid, DealAddFriendResultT

// Handle
if (result == DealAddFriendResultType.DEAL_ADD_FRIEND_RESULT_TYPE_ACCEPT) { // Request accepted
myFriendship.setIsFriend(true);
theirFriendship.setIsFriend(true);
myFriendship.setFriend(true);
theirFriendship.setFriend(true);

this.getPendingFriends().remove(myFriendship.getOwnerId());
this.addFriend(myFriendship);
Expand Down
188 changes: 99 additions & 89 deletions src/main/java/emu/grasscutter/game/inventory/Inventory.java

Large diffs are not rendered by default.

21 changes: 16 additions & 5 deletions src/main/java/emu/grasscutter/net/packet/BasePacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@

import com.google.protobuf.GeneratedMessageV3;
import emu.grasscutter.net.proto.PacketHeadOuterClass.PacketHead;
import java.io.*;
import lombok.Getter;
import lombok.Setter;

import java.io.*;

public class BasePacket {
private static final int const1 = 17767; // 0x4567
private static final int const2 = -30293; // 0x89ab
public final boolean shouldEncrypt = true;
@Setter @Getter private int opcode;
@Setter
@Getter
private int opcode;
private boolean shouldBuildHeader = false;
@Setter @Getter private byte[] header;
@Setter @Getter private byte[] data;
@Setter
@Getter
private byte[] header;
@Getter
private byte[] data;
// Encryption
@Setter private boolean useDispatchKey;
@Setter
private boolean useDispatchKey;

public BasePacket(int opcode) {
this.opcode = opcode;
Expand Down Expand Up @@ -48,6 +55,10 @@ public void setData(GeneratedMessageV3.Builder proto) {
this.data = proto.build().toByteArray();
}

public void setData(byte[] packet) {
this.data = packet;
}

public BasePacket buildHeader(int clientSequence) {
if (this.getHeader() != null && clientSequence == 0) {
return this;
Expand Down

0 comments on commit bfc2c7c

Please sign in to comment.