From dd9f59fbfc40c46d201741a8f7d4022ead134106 Mon Sep 17 00:00:00 2001 From: "Breno A." Date: Sun, 9 Jun 2024 09:55:51 -0300 Subject: [PATCH] refactor(lombok): add Setter where possible --- .../command/commands/ClearCommand.java | 7 +-- .../data/excels/StatuePromoteData.java | 11 +++-- .../java/emu/grasscutter/game/Account.java | 46 ++++--------------- .../TrialAvatarActivityHandler.java | 3 +- .../game/battlepass/BattlePassMission.java | 11 ++--- .../grasscutter/game/city/CityInfoData.java | 6 +-- .../game/combine/CombineResult.java | 17 +------ .../game/combine/ReliquaryDecomposeEntry.java | 9 +--- .../emu/grasscutter/game/drop/DropData.java | 11 ++--- .../game/dungeons/DungeonDrop.java | 9 +--- .../game/dungeons/DungeonDropEntry.java | 21 +-------- .../dungeons/challenge/DungeonChallenge.java | 6 +-- .../entity/gadget/platform/BaseRoute.java | 11 +++-- .../entity/gadget/platform/ConfigRoute.java | 7 +-- .../gadget/platform/PointArrayRoute.java | 5 +- .../grasscutter/game/friends/Friendship.java | 16 ++----- .../grasscutter/game/gacha/GachaRecord.java | 22 +-------- .../grasscutter/game/inventory/ItemDef.java | 9 +--- .../java/emu/grasscutter/game/mail/Mail.java | 6 +-- .../managers/forging/ActiveForgeData.java | 31 +++---------- .../emu/grasscutter/game/player/TeamInfo.java | 6 +-- .../emu/grasscutter/game/shop/ShopLimit.java | 17 +------ .../emu/grasscutter/game/shop/ShopTable.java | 9 +--- .../game/tower/TowerLevelRecord.java | 13 +----- .../game/tower/TowerScheduleConfig.java | 13 +----- .../grasscutter/game/world/GridPosition.java | 7 +-- .../emu/grasscutter/game/world/Location.java | 3 +- .../emu/grasscutter/game/world/Position.java | 4 +- .../emu/grasscutter/game/world/World.java | 6 +-- .../grasscutter/net/packet/BasePacket.java | 21 ++------- .../grasscutter/scripts/data/SceneBlock.java | 5 +- .../grasscutter/scripts/data/SceneGadget.java | 4 +- .../grasscutter/scripts/data/SceneGroup.java | 5 +- .../event/dispatch/QueryAllRegionsEvent.java | 5 +- .../dispatch/QueryCurrentRegionEvent.java | 5 +- .../event/entity/EntityCreationEvent.java | 7 +-- .../event/game/PlayerCreationEvent.java | 5 +- .../game/ReceiveCommandFeedbackEvent.java | 6 +-- .../server/event/game/ReceivePacketEvent.java | 5 +- .../server/event/game/SendPacketEvent.java | 5 +- .../event/player/PlayerForgeItemEvent.java | 3 +- .../event/player/PlayerOpenChestEvent.java | 6 +-- .../event/player/PlayerReceiveMailEvent.java | 5 +- .../utils/objects/ServerLogEventAppender.java | 5 +- 44 files changed, 122 insertions(+), 312 deletions(-) diff --git a/src/main/java/emu/grasscutter/command/commands/ClearCommand.java b/src/main/java/emu/grasscutter/command/commands/ClearCommand.java index bbfb47078..ff2cf4c2c 100644 --- a/src/main/java/emu/grasscutter/command/commands/ClearCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ClearCommand.java @@ -93,9 +93,10 @@ public final class ClearCommand implements CommandHandler { } } + @Setter private static class ClearItemParameters { - @Setter public int lvl = 1; - @Setter public int refinement = 1; - @Setter public int rank = 4; + public int lvl = 1; + public int refinement = 1; + public int rank = 4; } } diff --git a/src/main/java/emu/grasscutter/data/excels/StatuePromoteData.java b/src/main/java/emu/grasscutter/data/excels/StatuePromoteData.java index 32d3f205d..0ddb6c439 100644 --- a/src/main/java/emu/grasscutter/data/excels/StatuePromoteData.java +++ b/src/main/java/emu/grasscutter/data/excels/StatuePromoteData.java @@ -4,14 +4,15 @@ import emu.grasscutter.data.*; import emu.grasscutter.data.common.ItemParamData; import lombok.*; +@Setter @Getter @ResourceType(name = "StatuePromoteExcelConfigData.json") public class StatuePromoteData extends GameResource { - @Setter private int level; - @Setter private int cityId; - @Setter private ItemParamData[] costItems; - @Setter private int[] rewardIdList; - @Setter private int stamina; + private int level; + private int cityId; + private ItemParamData[] costItems; + private int[] rewardIdList; + private int stamina; @Override public int getId() { diff --git a/src/main/java/emu/grasscutter/game/Account.java b/src/main/java/emu/grasscutter/game/Account.java index bbdab85c4..35f54dafd 100644 --- a/src/main/java/emu/grasscutter/game/Account.java +++ b/src/main/java/emu/grasscutter/game/Account.java @@ -9,24 +9,30 @@ import java.util.*; import java.util.stream.Stream; import lombok.Getter; +import lombok.Setter; import org.bson.Document; @Entity(value = "accounts", useDiscriminator = false) public class Account { + @Setter @Getter @Id private String id; + @Setter @Getter @Indexed(options = @IndexOptions(unique = true)) @Collation(locale = "simple", caseLevel = true) private String username; + @Setter @Getter private String password; // Unused for now private int reservedPlayerId; + @Setter private String email; + @Setter @Getter private String token; @Getter @@ -37,13 +43,17 @@ public class Account { */ @Getter private final List permissions; + @Setter @Getter private Locale locale; + @Setter @Getter private String banReason; + @Setter @Getter private int banEndTime; + @Setter @Getter private int banStartTime; private boolean isBanned; @@ -80,22 +90,6 @@ public class Account { return (wildcardParts.length == permissionParts.length); } - public void setId(String id) { - this.id = id; - } - - public void setUsername(String username) { - this.username = username; - } - - public void setPassword(String password) { - this.password = password; - } - - public void setToken(String token) { - this.token = token; - } - public int getReservedPlayerUid() { return this.reservedPlayerId; } @@ -113,32 +107,12 @@ public class Account { } } - public void setEmail(String email) { - this.email = email; - } - public String generateSessionKey() { this.sessionKey = Utils.bytesToHex(Crypto.createSessionKey(32)); this.save(); return this.sessionKey; } - public void setLocale(Locale locale) { - this.locale = locale; - } - - public void setBanReason(String banReason) { - this.banReason = banReason; - } - - public void setBanEndTime(int banEndTime) { - this.banEndTime = banEndTime; - } - - public void setBanStartTime(int banStartTime) { - this.banStartTime = banStartTime; - } - public boolean isBanned() { if (banEndTime > 0 && banEndTime < System.currentTimeMillis() / 1000) { this.isBanned = false; diff --git a/src/main/java/emu/grasscutter/game/activity/trialavatar/TrialAvatarActivityHandler.java b/src/main/java/emu/grasscutter/game/activity/trialavatar/TrialAvatarActivityHandler.java index 20835fe81..76f358a05 100644 --- a/src/main/java/emu/grasscutter/game/activity/trialavatar/TrialAvatarActivityHandler.java +++ b/src/main/java/emu/grasscutter/game/activity/trialavatar/TrialAvatarActivityHandler.java @@ -16,10 +16,11 @@ import java.util.*; import java.util.stream.Stream; import lombok.*; +@Setter @Getter @GameActivity(ActivityType.NEW_ACTIVITY_TRIAL_AVATAR) public class TrialAvatarActivityHandler extends ActivityHandler { - @Setter private int selectedTrialAvatarIndex; + private int selectedTrialAvatarIndex; @Override public void onInitPlayerActivityData(PlayerActivityData playerActivityData) { diff --git a/src/main/java/emu/grasscutter/game/battlepass/BattlePassMission.java b/src/main/java/emu/grasscutter/game/battlepass/BattlePassMission.java index 27286ad00..b22bc7de0 100644 --- a/src/main/java/emu/grasscutter/game/battlepass/BattlePassMission.java +++ b/src/main/java/emu/grasscutter/game/battlepass/BattlePassMission.java @@ -5,13 +5,16 @@ import emu.grasscutter.data.GameData; import emu.grasscutter.data.excels.BattlePassMissionData; import emu.grasscutter.game.props.BattlePassMissionStatus; import lombok.Getter; +import lombok.Setter; @Entity public class BattlePassMission { @Getter private int id; + @Setter @Getter private int progress; + @Setter private BattlePassMissionStatus status; @Transient private BattlePassMissionData data; @@ -30,10 +33,6 @@ public class BattlePassMission { return this.data; } - public void setProgress(int value) { - this.progress = value; - } - public void addProgress(int addProgress, int maxProgress) { this.progress = Math.min(addProgress + this.progress, maxProgress); } @@ -43,10 +42,6 @@ public class BattlePassMission { return status; } - public void setStatus(BattlePassMissionStatus status) { - this.status = status; - } - public boolean isFinshed() { return getStatus().getValue() >= 2; } diff --git a/src/main/java/emu/grasscutter/game/city/CityInfoData.java b/src/main/java/emu/grasscutter/game/city/CityInfoData.java index 6cff23158..e9fa10657 100644 --- a/src/main/java/emu/grasscutter/game/city/CityInfoData.java +++ b/src/main/java/emu/grasscutter/game/city/CityInfoData.java @@ -4,15 +4,15 @@ import dev.morphia.annotations.Entity; import emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo; import lombok.*; +@Setter @Getter @Entity public class CityInfoData { - @Setter private int cityId; + private int cityId; - @Setter private int level = 1; // level of the city (include level SotS, level Frostbearing Trees, etc.) - @Setter private int numCrystal = 0; // number of crystals in the city + private int numCrystal = 0; // number of crystals in the city public CityInfoData(int cityId) { this.cityId = cityId; diff --git a/src/main/java/emu/grasscutter/game/combine/CombineResult.java b/src/main/java/emu/grasscutter/game/combine/CombineResult.java index e5099e755..4f372cc25 100644 --- a/src/main/java/emu/grasscutter/game/combine/CombineResult.java +++ b/src/main/java/emu/grasscutter/game/combine/CombineResult.java @@ -2,9 +2,11 @@ package emu.grasscutter.game.combine; import emu.grasscutter.data.common.ItemParamData; import lombok.Getter; +import lombok.Setter; import java.util.List; +@Setter @Getter public class CombineResult { private List material; @@ -12,19 +14,4 @@ public class CombineResult { private List extra; private List back; - public void setMaterial(List material) { - this.material = material; - } - - public void setResult(List result) { - this.result = result; - } - - public void setExtra(List extra) { - this.extra = extra; - } - - public void setBack(List back) { - this.back = back; - } } diff --git a/src/main/java/emu/grasscutter/game/combine/ReliquaryDecomposeEntry.java b/src/main/java/emu/grasscutter/game/combine/ReliquaryDecomposeEntry.java index ae2697af5..cf6427752 100644 --- a/src/main/java/emu/grasscutter/game/combine/ReliquaryDecomposeEntry.java +++ b/src/main/java/emu/grasscutter/game/combine/ReliquaryDecomposeEntry.java @@ -1,19 +1,14 @@ package emu.grasscutter.game.combine; import lombok.Getter; +import lombok.Setter; import java.util.List; +@Setter @Getter public class ReliquaryDecomposeEntry { private int configId; private List items; - public void setConfigId(int configId) { - this.configId = configId; - } - - public void setItems(List items) { - this.items = items; - } } diff --git a/src/main/java/emu/grasscutter/game/drop/DropData.java b/src/main/java/emu/grasscutter/game/drop/DropData.java index 9cc033b02..5d2cbbef0 100644 --- a/src/main/java/emu/grasscutter/game/drop/DropData.java +++ b/src/main/java/emu/grasscutter/game/drop/DropData.java @@ -1,26 +1,21 @@ package emu.grasscutter.game.drop; import lombok.Getter; +import lombok.Setter; @Getter @Deprecated public class DropData { private int minWeight; private int maxWeight; + @Setter private int itemId; private int minCount; private int maxCount; private boolean share = false; + @Setter private boolean give = false; - public void setGive(boolean give) { - this.give = give; - } - - public void setItemId(int itemId) { - this.itemId = itemId; - } - public void setIsShare(boolean share) { this.share = share; } diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonDrop.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonDrop.java index 23807a498..941b39405 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonDrop.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonDrop.java @@ -1,19 +1,14 @@ package emu.grasscutter.game.dungeons; import lombok.Getter; +import lombok.Setter; import java.util.List; +@Setter @Getter public class DungeonDrop { private int dungeonId; private List drops; - public void setDungeonId(int dungeonId) { - this.dungeonId = dungeonId; - } - - public void setDrops(List drops) { - this.drops = drops; - } } diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonDropEntry.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonDropEntry.java index a44592b54..a509a1786 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonDropEntry.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonDropEntry.java @@ -1,9 +1,11 @@ package emu.grasscutter.game.dungeons; import lombok.Getter; +import lombok.Setter; import java.util.List; +@Setter @Getter public class DungeonDropEntry { private List counts; @@ -12,23 +14,4 @@ public class DungeonDropEntry { private List itemProbabilities; private boolean mpDouble; - public void setCounts(List counts) { - this.counts = counts; - } - - public void setItems(List items) { - this.items = items; - } - - public void setProbabilities(List probabilities) { - this.probabilities = probabilities; - } - - public void setItemProbabilities(List itemProbabilities) { - this.itemProbabilities = itemProbabilities; - } - - public void setMpDouble(boolean mpDouble) { - this.mpDouble = mpDouble; - } } diff --git a/src/main/java/emu/grasscutter/game/dungeons/challenge/DungeonChallenge.java b/src/main/java/emu/grasscutter/game/dungeons/challenge/DungeonChallenge.java index ab218b57f..adeef9d21 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/challenge/DungeonChallenge.java +++ b/src/main/java/emu/grasscutter/game/dungeons/challenge/DungeonChallenge.java @@ -5,9 +5,11 @@ import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType; import emu.grasscutter.game.world.Scene; import emu.grasscutter.scripts.data.SceneGroup; import lombok.Getter; +import lombok.Setter; import java.util.List; +@Setter @Getter public final class DungeonChallenge extends WorldChallenge { @@ -24,10 +26,6 @@ public final class DungeonChallenge extends WorldChallenge { super(scene, group, challengeId, challengeIndex, paramList, timeLimit, goal, challengeTriggers); } - public void setStage(boolean stage) { - this.stage = stage; - } - @Override public void done() { super.done(); diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/platform/BaseRoute.java b/src/main/java/emu/grasscutter/game/entity/gadget/platform/BaseRoute.java index 221cfbd90..5786cb384 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/platform/BaseRoute.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/platform/BaseRoute.java @@ -6,13 +6,14 @@ import emu.grasscutter.net.proto.PlatformInfoOuterClass.PlatformInfo; import emu.grasscutter.scripts.data.SceneGadget; import lombok.*; +@Setter @Getter public abstract class BaseRoute { - @Setter private boolean isStarted; - @Setter private boolean isActive; - @Setter private Position startRot; - @Setter private int startSceneTime; - @Setter private int stopSceneTime; + private boolean isStarted; + private boolean isActive; + private Position startRot; + private int startSceneTime; + private int stopSceneTime; BaseRoute(Position startRot, boolean isStarted, boolean isActive) { this.startRot = startRot; diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/platform/ConfigRoute.java b/src/main/java/emu/grasscutter/game/entity/gadget/platform/ConfigRoute.java index 26ff78b29..b79f10ca4 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/platform/ConfigRoute.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/platform/ConfigRoute.java @@ -6,12 +6,13 @@ import emu.grasscutter.scripts.data.SceneGadget; import java.util.*; import lombok.*; +@Setter @Getter public class ConfigRoute extends BaseRoute { - @Setter private int routeId; - @Setter private int startIndex; - @Setter private List scheduledIndexes; + private int routeId; + private int startIndex; + private List scheduledIndexes; public ConfigRoute(SceneGadget gadget) { super(gadget); diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/platform/PointArrayRoute.java b/src/main/java/emu/grasscutter/game/entity/gadget/platform/PointArrayRoute.java index 3174ba9e7..b3455e739 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/platform/PointArrayRoute.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/platform/PointArrayRoute.java @@ -6,11 +6,12 @@ import emu.grasscutter.scripts.data.SceneGadget; import lombok.*; /** TODO implement point array routes, read from missing resources */ +@Setter @Getter public class PointArrayRoute extends BaseRoute { - @Setter int currentPoint; - @Setter int pointArrayId; + int currentPoint; + int pointArrayId; public PointArrayRoute(SceneGadget gadget) { super(gadget); diff --git a/src/main/java/emu/grasscutter/game/friends/Friendship.java b/src/main/java/emu/grasscutter/game/friends/Friendship.java index 41d80133a..af17ea1ac 100644 --- a/src/main/java/emu/grasscutter/game/friends/Friendship.java +++ b/src/main/java/emu/grasscutter/game/friends/Friendship.java @@ -8,12 +8,14 @@ import emu.grasscutter.net.proto.FriendOnlineStateOuterClass.FriendOnlineState; import emu.grasscutter.net.proto.PlatformTypeOuterClass; import emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture; import lombok.Getter; +import lombok.Setter; import org.bson.types.ObjectId; @Entity(value = "friendships", useDiscriminator = false) public class Friendship { @Id private ObjectId id; + @Setter @Getter @Transient private Player owner; @@ -21,7 +23,9 @@ public class Friendship { @Indexed private int ownerId; @Getter @Indexed private int friendId; + @Setter private boolean isFriend; + @Setter @Getter private int askerId; @@ -38,22 +42,10 @@ public class Friendship { this.askerId = asker.getUid(); } - public void setOwner(Player owner) { - this.owner = owner; - } - public boolean isFriend() { return isFriend; } - public void setIsFriend(boolean b) { - this.isFriend = b; - } - - public void setAskerId(int askerId) { - this.askerId = askerId; - } - public PlayerProfile getFriendProfile() { return profile; } diff --git a/src/main/java/emu/grasscutter/game/gacha/GachaRecord.java b/src/main/java/emu/grasscutter/game/gacha/GachaRecord.java index 3122e81b2..d66c12f3d 100644 --- a/src/main/java/emu/grasscutter/game/gacha/GachaRecord.java +++ b/src/main/java/emu/grasscutter/game/gacha/GachaRecord.java @@ -4,8 +4,10 @@ import dev.morphia.annotations.*; import java.util.Date; import lombok.Getter; +import lombok.Setter; import org.bson.types.ObjectId; +@Setter @Getter @Entity(value = "gachas", useDiscriminator = false) public class GachaRecord { @@ -26,26 +28,6 @@ public class GachaRecord { this.gachaType = gachaType; } - public void setOwnerId(int ownerId) { - this.ownerId = ownerId; - } - - public void setGachaType(int type) { - this.gachaType = type; - } - - public void setTransactionDate(Date transactionDate) { - this.transactionDate = transactionDate; - } - - public void setItemID(int itemID) { - this.itemID = itemID; - } - - public void setId(ObjectId id) { - this.id = id; - } - public String toString() { return toJsonString(); } diff --git a/src/main/java/emu/grasscutter/game/inventory/ItemDef.java b/src/main/java/emu/grasscutter/game/inventory/ItemDef.java index c1dd29797..e09d40a97 100644 --- a/src/main/java/emu/grasscutter/game/inventory/ItemDef.java +++ b/src/main/java/emu/grasscutter/game/inventory/ItemDef.java @@ -1,7 +1,9 @@ package emu.grasscutter.game.inventory; import lombok.Getter; +import lombok.Setter; +@Setter @Getter public class ItemDef { private int itemId; @@ -12,11 +14,4 @@ public class ItemDef { this.count = count; } - public void setItemId(int itemId) { - this.itemId = itemId; - } - - public void setCount(int count) { - this.count = count; - } } diff --git a/src/main/java/emu/grasscutter/game/mail/Mail.java b/src/main/java/emu/grasscutter/game/mail/Mail.java index be585a000..8558e9de2 100644 --- a/src/main/java/emu/grasscutter/game/mail/Mail.java +++ b/src/main/java/emu/grasscutter/game/mail/Mail.java @@ -13,12 +13,14 @@ import java.time.Instant; import java.util.*; import lombok.Getter; +import lombok.Setter; import org.bson.types.ObjectId; @Entity(value = "mail", useDiscriminator = false) public final class Mail { @Getter @Id private ObjectId id; + @Setter @Getter @Indexed private int ownerUid; public final MailContent mailContent; @@ -63,10 +65,6 @@ public final class Mail { this.stateValue = state; // Different mailboxes, 1 = Default, 3 = Gift-box. } - public void setOwnerUid(int ownerUid) { - this.ownerUid = ownerUid; - } - public MailDataOuterClass.MailData toProto(Player player) { return MailDataOuterClass.MailData.newBuilder() .setMailId(player.getMailId(this)) diff --git a/src/main/java/emu/grasscutter/game/managers/forging/ActiveForgeData.java b/src/main/java/emu/grasscutter/game/managers/forging/ActiveForgeData.java index f27d5cc9a..dedb26ac8 100644 --- a/src/main/java/emu/grasscutter/game/managers/forging/ActiveForgeData.java +++ b/src/main/java/emu/grasscutter/game/managers/forging/ActiveForgeData.java @@ -2,22 +2,29 @@ package emu.grasscutter.game.managers.forging; import dev.morphia.annotations.Entity; import lombok.Getter; +import lombok.Setter; @Entity public class ActiveForgeData { + @Setter @Getter private int forgeId; + @Setter @Getter private int avatarId; + @Setter @Getter private int count; + @Setter @Getter private int startTime; + @Setter @Getter private int forgeTime; private int lastUnfinishedCount; + @Setter @Getter private boolean changed; @@ -42,30 +49,6 @@ public class ActiveForgeData { return this.startTime + this.forgeTime * this.count; } - public void setForgeId(int value) { - this.forgeId = value; - } - - public void setAvatarId(int value) { - this.avatarId = value; - } - - public void setCount(int value) { - this.count = value; - } - - public void setStartTime(int value) { - this.startTime = value; - } - - public void setForgeTime(int value) { - this.forgeTime = value; - } - - public void setChanged(boolean value) { - this.changed = value; - } - public boolean updateChanged(int currentTime) { int currentUnfinished = this.getUnfinishedCount(currentTime); diff --git a/src/main/java/emu/grasscutter/game/player/TeamInfo.java b/src/main/java/emu/grasscutter/game/player/TeamInfo.java index 86c76fef5..4fffba9a4 100644 --- a/src/main/java/emu/grasscutter/game/player/TeamInfo.java +++ b/src/main/java/emu/grasscutter/game/player/TeamInfo.java @@ -6,12 +6,14 @@ import dev.morphia.annotations.Entity; import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam; import lombok.Getter; +import lombok.Setter; import java.util.*; @Getter @Entity public final class TeamInfo { + @Setter private String name; private final List avatars; @@ -25,10 +27,6 @@ public final class TeamInfo { this.avatars = avatars; } - public void setName(String name) { - this.name = name; - } - public int size() { return avatars.size(); } diff --git a/src/main/java/emu/grasscutter/game/shop/ShopLimit.java b/src/main/java/emu/grasscutter/game/shop/ShopLimit.java index e75e7ef24..376d46326 100644 --- a/src/main/java/emu/grasscutter/game/shop/ShopLimit.java +++ b/src/main/java/emu/grasscutter/game/shop/ShopLimit.java @@ -2,7 +2,9 @@ package emu.grasscutter.game.shop; import dev.morphia.annotations.Entity; import lombok.Getter; +import lombok.Setter; +@Setter @Getter @Entity public class ShopLimit { @@ -11,19 +13,4 @@ public class ShopLimit { private int hasBoughtInPeriod = 0; private int nextRefreshTime = 0; - public void setShopGoodId(int shopGoodId) { - this.shopGoodId = shopGoodId; - } - - public void setHasBought(int hasBought) { - this.hasBought = hasBought; - } - - public void setNextRefreshTime(int nextRefreshTime) { - this.nextRefreshTime = nextRefreshTime; - } - - public void setHasBoughtInPeriod(int hasBoughtInPeriod) { - this.hasBoughtInPeriod = hasBoughtInPeriod; - } } diff --git a/src/main/java/emu/grasscutter/game/shop/ShopTable.java b/src/main/java/emu/grasscutter/game/shop/ShopTable.java index 78a8c201e..1cd9831a2 100644 --- a/src/main/java/emu/grasscutter/game/shop/ShopTable.java +++ b/src/main/java/emu/grasscutter/game/shop/ShopTable.java @@ -1,19 +1,14 @@ package emu.grasscutter.game.shop; import lombok.Getter; +import lombok.Setter; import java.util.*; +@Setter @Getter public class ShopTable { private int shopId; private List items = new ArrayList<>(); - public void setShopId(int shopId) { - this.shopId = shopId; - } - - public void setItems(List items) { - this.items = items; - } } diff --git a/src/main/java/emu/grasscutter/game/tower/TowerLevelRecord.java b/src/main/java/emu/grasscutter/game/tower/TowerLevelRecord.java index 12afe9f58..a63cbf0f4 100644 --- a/src/main/java/emu/grasscutter/game/tower/TowerLevelRecord.java +++ b/src/main/java/emu/grasscutter/game/tower/TowerLevelRecord.java @@ -2,9 +2,11 @@ package emu.grasscutter.game.tower; import dev.morphia.annotations.Entity; import lombok.Getter; +import lombok.Setter; import java.util.*; +@Setter @Getter @Entity public class TowerLevelRecord { @@ -36,15 +38,4 @@ public class TowerLevelRecord { return passedLevelMap.values().stream().mapToInt(Integer::intValue).sum(); } - public void setFloorId(int floorId) { - this.floorId = floorId; - } - - public void setPassedLevelMap(Map passedLevelMap) { - this.passedLevelMap = passedLevelMap; - } - - public void setFloorStarRewardProgress(int floorStarRewardProgress) { - this.floorStarRewardProgress = floorStarRewardProgress; - } } diff --git a/src/main/java/emu/grasscutter/game/tower/TowerScheduleConfig.java b/src/main/java/emu/grasscutter/game/tower/TowerScheduleConfig.java index c82ca6e23..fa4e653c0 100644 --- a/src/main/java/emu/grasscutter/game/tower/TowerScheduleConfig.java +++ b/src/main/java/emu/grasscutter/game/tower/TowerScheduleConfig.java @@ -1,9 +1,11 @@ package emu.grasscutter.game.tower; import lombok.Getter; +import lombok.Setter; import java.util.Date; +@Setter @Getter public class TowerScheduleConfig { private int scheduleId; @@ -11,15 +13,4 @@ public class TowerScheduleConfig { private Date scheduleStartTime; private Date nextScheduleChangeTime; - public void setScheduleId(int scheduleId) { - this.scheduleId = scheduleId; - } - - public void setScheduleStartTime(Date scheduleStartTime) { - this.scheduleStartTime = scheduleStartTime; - } - - public void setNextScheduleChangeTime(Date nextScheduleChangeTime) { - this.nextScheduleChangeTime = nextScheduleChangeTime; - } } diff --git a/src/main/java/emu/grasscutter/game/world/GridPosition.java b/src/main/java/emu/grasscutter/game/world/GridPosition.java index e7e02d5ba..13caa8eaa 100644 --- a/src/main/java/emu/grasscutter/game/world/GridPosition.java +++ b/src/main/java/emu/grasscutter/game/world/GridPosition.java @@ -6,17 +6,18 @@ import java.io.*; import java.util.List; import lombok.*; +@Setter @Getter @Entity public final class GridPosition implements Serializable { @Serial private static final long serialVersionUID = -2001232300615923575L; - @Setter private int x; + private int x; - @Setter private int z; + private int z; - @Setter private int width; + private int width; public GridPosition() {} diff --git a/src/main/java/emu/grasscutter/game/world/Location.java b/src/main/java/emu/grasscutter/game/world/Location.java index a1c720ee5..16ed72ae4 100644 --- a/src/main/java/emu/grasscutter/game/world/Location.java +++ b/src/main/java/emu/grasscutter/game/world/Location.java @@ -3,11 +3,12 @@ package emu.grasscutter.game.world; import dev.morphia.annotations.*; import lombok.*; +@Setter @Getter @Entity public class Location extends Position { @Transient - @Setter private Scene scene; + private Scene scene; public Location(Scene scene, Position position) { this.set(position); diff --git a/src/main/java/emu/grasscutter/game/world/Position.java b/src/main/java/emu/grasscutter/game/world/Position.java index 854c57aaa..6e3348e02 100644 --- a/src/main/java/emu/grasscutter/game/world/Position.java +++ b/src/main/java/emu/grasscutter/game/world/Position.java @@ -12,6 +12,7 @@ import java.util.List; import lombok.*; import lombok.experimental.Accessors; +@Setter @Getter @Entity @Accessors(chain = true) @@ -25,19 +26,16 @@ public class Position implements Serializable { @SerializedName( value = "x", alternate = {"_x", "X"}) - @Setter private float x; @SerializedName( value = "y", alternate = {"_y", "Y"}) - @Setter private float y; @SerializedName( value = "z", alternate = {"_z", "Z"}) - @Setter private float z; public Position() {} diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index bc7c6b8b7..ed32b1e1a 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -39,6 +39,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; import lombok.Getter; +import lombok.Setter; import lombok.val; import org.jetbrains.annotations.NotNull; @@ -51,6 +52,7 @@ public class World implements Iterable { @Getter private final EntityWorld entity; private int nextEntityId = 0; private int nextPeerId = 0; + @Setter @Getter private int worldLevel; @@ -122,10 +124,6 @@ public class World implements Iterable { return ++this.nextPeerId; } - public void setWorldLevel(int worldLevel) { - this.worldLevel = worldLevel; - } - protected synchronized void setHost(Player host) { this.host = host; } diff --git a/src/main/java/emu/grasscutter/net/packet/BasePacket.java b/src/main/java/emu/grasscutter/net/packet/BasePacket.java index e6bf489f6..438b98f89 100644 --- a/src/main/java/emu/grasscutter/net/packet/BasePacket.java +++ b/src/main/java/emu/grasscutter/net/packet/BasePacket.java @@ -3,6 +3,7 @@ package emu.grasscutter.net.packet; import com.google.protobuf.GeneratedMessageV3; import emu.grasscutter.net.proto.PacketHeadOuterClass.PacketHead; import lombok.Getter; +import lombok.Setter; import java.io.*; @@ -10,14 +11,18 @@ 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; private boolean shouldBuildHeader = false; + @Setter @Getter private byte[] header; + @Setter @Getter private byte[] data; // Encryption + @Setter private boolean useDispatchKey; public BasePacket(int opcode) { @@ -34,30 +39,14 @@ public class BasePacket { this.shouldBuildHeader = buildHeader; } - public void setOpcode(int opcode) { - this.opcode = opcode; - } - public boolean useDispatchKey() { return useDispatchKey; } - public void setUseDispatchKey(boolean useDispatchKey) { - this.useDispatchKey = useDispatchKey; - } - - public void setHeader(byte[] header) { - this.header = header; - } - public boolean shouldBuildHeader() { return shouldBuildHeader; } - public void setData(byte[] data) { - this.data = data; - } - public void setData(GeneratedMessageV3 proto) { this.data = proto.toByteArray(); } diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneBlock.java b/src/main/java/emu/grasscutter/scripts/data/SceneBlock.java index 58138fa27..782ef2a8c 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneBlock.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneBlock.java @@ -22,13 +22,10 @@ public class SceneBlock { public Map groups; public RTree sceneGroupIndex; + @Setter @Getter private transient boolean loaded; // Not an actual variable in the scripts either - public void setLoaded(boolean loaded) { - this.loaded = loaded; - } - public boolean contains(Position pos) { int range = Grasscutter.getConfig().server.game.loadEntitiesForPlayerRange; return pos.getX() <= (this.max.getX() + range) diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneGadget.java b/src/main/java/emu/grasscutter/scripts/data/SceneGadget.java index 8c8821ca7..8cd7d6d9c 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneGadget.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneGadget.java @@ -24,6 +24,7 @@ public class SceneGadget extends SceneObject { * isOneOff=false, like investigation points, it will disappear temporarily, and appear again in * next big world resource refresh routine. */ + @Setter public boolean isOneoff; public int draft_id; @@ -35,7 +36,4 @@ public class SceneGadget extends SceneObject { public Explore explore; public int trigger_count; - public void setIsOneoff(boolean isOneoff) { - this.isOneoff = isOneoff; - } } diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneGroup.java b/src/main/java/emu/grasscutter/scripts/data/SceneGroup.java index 9728ca900..ccfe70b82 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneGroup.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneGroup.java @@ -37,6 +37,7 @@ public final class SceneGroup { public SceneReplaceable is_replaceable; /* These are not script variables. */ + @Setter @Getter private transient boolean loaded; @Getter @@ -51,10 +52,6 @@ public final class SceneGroup { return group; } - public void setLoaded(boolean loaded) { - this.loaded = loaded; - } - public int getBusinessType() { return this.business == null ? 0 : this.business.type; } diff --git a/src/main/java/emu/grasscutter/server/event/dispatch/QueryAllRegionsEvent.java b/src/main/java/emu/grasscutter/server/event/dispatch/QueryAllRegionsEvent.java index e2f4c3439..c54b4750c 100644 --- a/src/main/java/emu/grasscutter/server/event/dispatch/QueryAllRegionsEvent.java +++ b/src/main/java/emu/grasscutter/server/event/dispatch/QueryAllRegionsEvent.java @@ -2,7 +2,9 @@ package emu.grasscutter.server.event.dispatch; import emu.grasscutter.server.event.types.ServerEvent; import lombok.Getter; +import lombok.Setter; +@Setter @Getter public final class QueryAllRegionsEvent extends ServerEvent { private String regionList; @@ -13,7 +15,4 @@ public final class QueryAllRegionsEvent extends ServerEvent { this.regionList = regionList; } - public void setRegionList(String regionList) { - this.regionList = regionList; - } } diff --git a/src/main/java/emu/grasscutter/server/event/dispatch/QueryCurrentRegionEvent.java b/src/main/java/emu/grasscutter/server/event/dispatch/QueryCurrentRegionEvent.java index c0a8e4743..b6c0a0cff 100644 --- a/src/main/java/emu/grasscutter/server/event/dispatch/QueryCurrentRegionEvent.java +++ b/src/main/java/emu/grasscutter/server/event/dispatch/QueryCurrentRegionEvent.java @@ -2,7 +2,9 @@ package emu.grasscutter.server.event.dispatch; import emu.grasscutter.server.event.types.ServerEvent; import lombok.Getter; +import lombok.Setter; +@Setter @Getter public final class QueryCurrentRegionEvent extends ServerEvent { private String regionInfo; @@ -13,7 +15,4 @@ public final class QueryCurrentRegionEvent extends ServerEvent { this.regionInfo = regionInfo; } - public void setRegionInfo(String regionInfo) { - this.regionInfo = regionInfo; - } } diff --git a/src/main/java/emu/grasscutter/server/event/entity/EntityCreationEvent.java b/src/main/java/emu/grasscutter/server/event/entity/EntityCreationEvent.java index e6dc26fe9..9019d1ca4 100644 --- a/src/main/java/emu/grasscutter/server/event/entity/EntityCreationEvent.java +++ b/src/main/java/emu/grasscutter/server/event/entity/EntityCreationEvent.java @@ -6,6 +6,7 @@ import javax.annotation.Nullable; import lombok.*; /** Invoked when an entity is created. */ +@Setter @Getter @AllArgsConstructor public final class EntityCreationEvent extends Event { @@ -22,9 +23,9 @@ public final class EntityCreationEvent extends Event { return type.cast(event.getEntity()); } - @Setter private Class entityType; - @Setter private Class[] constructorArgTypes; - @Setter private Object[] constructorArgs; + private Class entityType; + private Class[] constructorArgTypes; + private Object[] constructorArgs; /** * Creates a new entity. Returns null if the entity could not be created. diff --git a/src/main/java/emu/grasscutter/server/event/game/PlayerCreationEvent.java b/src/main/java/emu/grasscutter/server/event/game/PlayerCreationEvent.java index b234c8e1c..699105d16 100644 --- a/src/main/java/emu/grasscutter/server/event/game/PlayerCreationEvent.java +++ b/src/main/java/emu/grasscutter/server/event/game/PlayerCreationEvent.java @@ -4,10 +4,12 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.server.event.types.GameEvent; import emu.grasscutter.server.game.GameSession; import lombok.Getter; +import lombok.Setter; @Getter public final class PlayerCreationEvent extends GameEvent { private final GameSession session; + @Setter private Class playerClass; public PlayerCreationEvent(GameSession session, Class playerClass) { @@ -15,7 +17,4 @@ public final class PlayerCreationEvent extends GameEvent { this.playerClass = playerClass; } - public void setPlayerClass(Class playerClass) { - this.playerClass = playerClass; - } } diff --git a/src/main/java/emu/grasscutter/server/event/game/ReceiveCommandFeedbackEvent.java b/src/main/java/emu/grasscutter/server/event/game/ReceiveCommandFeedbackEvent.java index 5709deb30..fc6f247cc 100644 --- a/src/main/java/emu/grasscutter/server/event/game/ReceiveCommandFeedbackEvent.java +++ b/src/main/java/emu/grasscutter/server/event/game/ReceiveCommandFeedbackEvent.java @@ -4,11 +4,13 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.server.event.Cancellable; import emu.grasscutter.server.event.types.ServerEvent; import lombok.Getter; +import lombok.Setter; import javax.annotation.Nullable; public final class ReceiveCommandFeedbackEvent extends ServerEvent implements Cancellable { @Nullable private final Player player; + @Setter @Getter private String message; @@ -19,10 +21,6 @@ public final class ReceiveCommandFeedbackEvent extends ServerEvent implements Ca this.message = message; } - public void setMessage(String message) { - this.message = message; - } - @Nullable public Player getPlayer() { return this.player; } diff --git a/src/main/java/emu/grasscutter/server/event/game/ReceivePacketEvent.java b/src/main/java/emu/grasscutter/server/event/game/ReceivePacketEvent.java index 8eab8e2c9..9419aef77 100644 --- a/src/main/java/emu/grasscutter/server/event/game/ReceivePacketEvent.java +++ b/src/main/java/emu/grasscutter/server/event/game/ReceivePacketEvent.java @@ -4,11 +4,13 @@ import emu.grasscutter.server.event.Cancellable; import emu.grasscutter.server.event.types.ServerEvent; import emu.grasscutter.server.game.GameSession; import lombok.Getter; +import lombok.Setter; @Getter public final class ReceivePacketEvent extends ServerEvent implements Cancellable { private final GameSession gameSession; private final int packetId; + @Setter private byte[] packetData; public ReceivePacketEvent(GameSession gameSession, int packetId, byte[] packetData) { @@ -19,7 +21,4 @@ public final class ReceivePacketEvent extends ServerEvent implements Cancellable this.packetData = packetData; } - public void setPacketData(byte[] packetData) { - this.packetData = packetData; - } } diff --git a/src/main/java/emu/grasscutter/server/event/game/SendPacketEvent.java b/src/main/java/emu/grasscutter/server/event/game/SendPacketEvent.java index b37722bd4..9d6d724ca 100644 --- a/src/main/java/emu/grasscutter/server/event/game/SendPacketEvent.java +++ b/src/main/java/emu/grasscutter/server/event/game/SendPacketEvent.java @@ -5,10 +5,12 @@ import emu.grasscutter.server.event.Cancellable; import emu.grasscutter.server.event.types.ServerEvent; import emu.grasscutter.server.game.GameSession; import lombok.Getter; +import lombok.Setter; @Getter public final class SendPacketEvent extends ServerEvent implements Cancellable { private final GameSession gameSession; + @Setter private BasePacket packet; public SendPacketEvent(GameSession gameSession, BasePacket packet) { @@ -18,7 +20,4 @@ public final class SendPacketEvent extends ServerEvent implements Cancellable { this.packet = packet; } - public void setPacket(BasePacket packet) { - this.packet = packet; - } } diff --git a/src/main/java/emu/grasscutter/server/event/player/PlayerForgeItemEvent.java b/src/main/java/emu/grasscutter/server/event/player/PlayerForgeItemEvent.java index 42681438f..b62394331 100644 --- a/src/main/java/emu/grasscutter/server/event/player/PlayerForgeItemEvent.java +++ b/src/main/java/emu/grasscutter/server/event/player/PlayerForgeItemEvent.java @@ -5,9 +5,10 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.server.event.types.PlayerEvent; import lombok.*; +@Setter @Getter public final class PlayerForgeItemEvent extends PlayerEvent { - @Setter private GameItem itemForged; + private GameItem itemForged; public PlayerForgeItemEvent(Player player, GameItem itemForged) { super(player); diff --git a/src/main/java/emu/grasscutter/server/event/player/PlayerOpenChestEvent.java b/src/main/java/emu/grasscutter/server/event/player/PlayerOpenChestEvent.java index 9d6059226..05f440733 100644 --- a/src/main/java/emu/grasscutter/server/event/player/PlayerOpenChestEvent.java +++ b/src/main/java/emu/grasscutter/server/event/player/PlayerOpenChestEvent.java @@ -6,10 +6,12 @@ import emu.grasscutter.game.world.ChestReward; import emu.grasscutter.server.event.Cancellable; import emu.grasscutter.server.event.types.PlayerEvent; import lombok.Getter; +import lombok.Setter; @Getter public final class PlayerOpenChestEvent extends PlayerEvent implements Cancellable { private final GadgetChest chest; + @Setter private ChestReward reward; public PlayerOpenChestEvent(Player player, GadgetChest chest, ChestReward reward) { @@ -19,8 +21,4 @@ public final class PlayerOpenChestEvent extends PlayerEvent implements Cancellab this.reward = reward; } - public void setReward(ChestReward reward) { - this.reward = reward; - } - } diff --git a/src/main/java/emu/grasscutter/server/event/player/PlayerReceiveMailEvent.java b/src/main/java/emu/grasscutter/server/event/player/PlayerReceiveMailEvent.java index c71ef50f8..7cfe831aa 100644 --- a/src/main/java/emu/grasscutter/server/event/player/PlayerReceiveMailEvent.java +++ b/src/main/java/emu/grasscutter/server/event/player/PlayerReceiveMailEvent.java @@ -5,7 +5,9 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.server.event.Cancellable; import emu.grasscutter.server.event.types.PlayerEvent; import lombok.Getter; +import lombok.Setter; +@Setter @Getter public final class PlayerReceiveMailEvent extends PlayerEvent implements Cancellable { private Mail message; @@ -16,7 +18,4 @@ public final class PlayerReceiveMailEvent extends PlayerEvent implements Cancell this.message = message; } - public void setMessage(Mail message) { - this.message = message; - } } diff --git a/src/main/java/emu/grasscutter/utils/objects/ServerLogEventAppender.java b/src/main/java/emu/grasscutter/utils/objects/ServerLogEventAppender.java index 5bcfbda13..5b6b8abc0 100644 --- a/src/main/java/emu/grasscutter/utils/objects/ServerLogEventAppender.java +++ b/src/main/java/emu/grasscutter/utils/objects/ServerLogEventAppender.java @@ -5,9 +5,11 @@ import ch.qos.logback.core.AppenderBase; import ch.qos.logback.core.encoder.Encoder; import emu.grasscutter.server.event.internal.ServerLogEvent; import lombok.Getter; +import lombok.Setter; import java.nio.charset.StandardCharsets; +@Setter @Getter public final class ServerLogEventAppender extends AppenderBase { private Encoder encoder; @@ -20,7 +22,4 @@ public final class ServerLogEventAppender extends AppenderBase { sle.call(); } - public void setEncoder(Encoder encoder) { - this.encoder = encoder; - } }