diff --git a/src/main/java/emu/grasscutter/data/GameData.java b/src/main/java/emu/grasscutter/data/GameData.java index a1ef20a8e..1a8597694 100644 --- a/src/main/java/emu/grasscutter/data/GameData.java +++ b/src/main/java/emu/grasscutter/data/GameData.java @@ -569,8 +569,8 @@ public final class GameData { private static final Int2IntMap trialAvatarIndexIdTrialActivityDataDataMap = new Int2IntOpenHashMap(); - private static Map> fetters = new HashMap<>(); - private static Map> shopGoods = new HashMap<>(); + private static final Map> fetters = new HashMap<>(); + private static final Map> shopGoods = new HashMap<>(); // Getters with different names that stay for now public static Int2ObjectMap getMainQuestDataMap() { diff --git a/src/main/java/emu/grasscutter/data/GameDepot.java b/src/main/java/emu/grasscutter/data/GameDepot.java index b3c43bb21..34cfd57ee 100644 --- a/src/main/java/emu/grasscutter/data/GameDepot.java +++ b/src/main/java/emu/grasscutter/data/GameDepot.java @@ -13,17 +13,17 @@ import lombok.*; public class GameDepot { public static final int[] BLOCK_SIZE = new int[] {50, 500}; // Scales - private static Int2ObjectMap> relicRandomMainPropDepot = + private static final Int2ObjectMap> relicRandomMainPropDepot = new Int2ObjectOpenHashMap<>(); - private static Int2ObjectMap> relicMainPropDepot = + private static final Int2ObjectMap> relicMainPropDepot = new Int2ObjectOpenHashMap<>(); - private static Int2ObjectMap> relicAffixDepot = + private static final Int2ObjectMap> relicAffixDepot = new Int2ObjectOpenHashMap<>(); @Getter @Setter private static Map playerAbilities = new HashMap<>(); @Getter - private static HashMap> spawnLists = + private static final HashMap> spawnLists = new HashMap<>(); @Getter @Setter private static BlossomConfig blossomConfig; diff --git a/src/main/java/emu/grasscutter/data/binout/OpenConfigEntry.java b/src/main/java/emu/grasscutter/data/binout/OpenConfigEntry.java index 25f8055bf..6270eb601 100644 --- a/src/main/java/emu/grasscutter/data/binout/OpenConfigEntry.java +++ b/src/main/java/emu/grasscutter/data/binout/OpenConfigEntry.java @@ -51,8 +51,8 @@ public class OpenConfigEntry { } public static class SkillPointModifier { - private int skillId; - private int delta; + private final int skillId; + private final int delta; public SkillPointModifier(int skillId, int delta) { this.skillId = skillId; diff --git a/src/main/java/emu/grasscutter/data/excels/ItemData.java b/src/main/java/emu/grasscutter/data/excels/ItemData.java index de77a4ba6..edce795e1 100644 --- a/src/main/java/emu/grasscutter/data/excels/ItemData.java +++ b/src/main/java/emu/grasscutter/data/excels/ItemData.java @@ -24,7 +24,7 @@ public class ItemData extends GameResource { @Getter(onMethod_ = @Override) private int id; - private int stackLimit = 1; + private final int stackLimit = 1; private int maxUseCount; private int rankLevel; private String effectName; @@ -37,7 +37,7 @@ public class ItemData extends GameResource { private int[] destroyReturnMaterialCount; // Enums - private ItemType itemType = ItemType.ITEM_NONE; + private final ItemType itemType = ItemType.ITEM_NONE; private MaterialType materialType = MaterialType.MATERIAL_NONE; private EquipType equipType = EquipType.EQUIP_NONE; private String effectType; @@ -48,10 +48,10 @@ public class ItemData extends GameResource { private int[] satiationParams; // Usable item - private ItemUseTarget useTarget = ItemUseTarget.ITEM_USE_TARGET_NONE; + private final ItemUseTarget useTarget = ItemUseTarget.ITEM_USE_TARGET_NONE; private List itemUse; private List itemUseActions; - private boolean useOnGain = false; + private final boolean useOnGain = false; // Relic private int mainPropDepotId; @@ -79,7 +79,7 @@ public class ItemData extends GameResource { private int comfort; private List furnType; private List furnitureGadgetID; - private SpecialFurnitureType specialFurnitureType = SpecialFurnitureType.NOT_SPECIAL; + private final SpecialFurnitureType specialFurnitureType = SpecialFurnitureType.NOT_SPECIAL; @SerializedName( value = "roomSceneId", diff --git a/src/main/java/emu/grasscutter/data/excels/PlayerLevelData.java b/src/main/java/emu/grasscutter/data/excels/PlayerLevelData.java index 35632c990..59da00fe7 100644 --- a/src/main/java/emu/grasscutter/data/excels/PlayerLevelData.java +++ b/src/main/java/emu/grasscutter/data/excels/PlayerLevelData.java @@ -9,7 +9,7 @@ public class PlayerLevelData extends GameResource { private int level; private int exp; private int rewardId; - private int expeditionLimitAdd = 0; + private final int expeditionLimitAdd = 0; private int unlockWorldLevel; private long unlockDescTextMapHash; diff --git a/src/main/java/emu/grasscutter/data/excels/ProudSkillData.java b/src/main/java/emu/grasscutter/data/excels/ProudSkillData.java index 51d4ae288..fb17b3594 100644 --- a/src/main/java/emu/grasscutter/data/excels/ProudSkillData.java +++ b/src/main/java/emu/grasscutter/data/excels/ProudSkillData.java @@ -25,7 +25,7 @@ public class ProudSkillData extends GameResource { @Getter private long nameTextMapHash; @Transient private Iterable totalCostItems; - @Transient @Getter private Object2FloatMap paramListMap = new Object2FloatOpenHashMap<>(); + @Transient @Getter private final Object2FloatMap paramListMap = new Object2FloatOpenHashMap<>(); @Override public int getId() { diff --git a/src/main/java/emu/grasscutter/data/excels/achievement/AchievementData.java b/src/main/java/emu/grasscutter/data/excels/achievement/AchievementData.java index 3a3b7836d..d67cab89f 100644 --- a/src/main/java/emu/grasscutter/data/excels/achievement/AchievementData.java +++ b/src/main/java/emu/grasscutter/data/excels/achievement/AchievementData.java @@ -14,7 +14,7 @@ public class AchievementData extends GameResource { private static final AtomicBoolean isDivided = new AtomicBoolean(); private int goalId; private int preStageAchievementId; - private Set groupAchievementIdList = new HashSet<>(); + private final Set groupAchievementIdList = new HashSet<>(); private boolean isParent; private long titleTextMapHash; private long descTextMapHash; diff --git a/src/main/java/emu/grasscutter/data/excels/avatar/AvatarData.java b/src/main/java/emu/grasscutter/data/excels/avatar/AvatarData.java index d897fc4e7..1b0823328 100644 --- a/src/main/java/emu/grasscutter/data/excels/avatar/AvatarData.java +++ b/src/main/java/emu/grasscutter/data/excels/avatar/AvatarData.java @@ -55,7 +55,7 @@ public class AvatarData extends GameResource { @Getter private IntList abilities; @Getter - private List abilitieNames = new ArrayList<>(); + private final List abilitieNames = new ArrayList<>(); @Getter private List fetters; diff --git a/src/main/java/emu/grasscutter/data/excels/tower/TowerLevelData.java b/src/main/java/emu/grasscutter/data/excels/tower/TowerLevelData.java index e9fd62ff6..de36bd3b1 100644 --- a/src/main/java/emu/grasscutter/data/excels/tower/TowerLevelData.java +++ b/src/main/java/emu/grasscutter/data/excels/tower/TowerLevelData.java @@ -30,8 +30,8 @@ public class TowerLevelData extends GameResource { // Just packaging condition parameters for convenience. @Getter public class TowerCondTimeParams { - private int param1; - private int minimumTimeInSeconds; + private final int param1; + private final int minimumTimeInSeconds; public TowerCondTimeParams(int param1, int minimumTimeInSeconds) { this.param1 = param1; @@ -41,9 +41,9 @@ public class TowerLevelData extends GameResource { @Getter public class TowerCondHpParams { - private int sceneId; - private int configId; - private int minimumHpPercentage; + private final int sceneId; + private final int configId; + private final int minimumHpPercentage; public TowerCondHpParams(int sceneId, int configId, int minimumHpPercentage) { this.sceneId = sceneId; diff --git a/src/main/java/emu/grasscutter/data/server/Grid.java b/src/main/java/emu/grasscutter/data/server/Grid.java index 624556d48..25f84559b 100644 --- a/src/main/java/emu/grasscutter/data/server/Grid.java +++ b/src/main/java/emu/grasscutter/data/server/Grid.java @@ -9,7 +9,7 @@ import java.util.*; public class Grid { public transient RTree>, Geometry> gridOptimized = null; - private transient Set nearbyGroups = new HashSet<>(100); + private final transient Set nearbyGroups = new HashSet<>(100); public Map> grid = new LinkedHashMap<>(); diff --git a/src/main/java/emu/grasscutter/game/Account.java b/src/main/java/emu/grasscutter/game/Account.java index c796b9981..e13475705 100644 --- a/src/main/java/emu/grasscutter/game/Account.java +++ b/src/main/java/emu/grasscutter/game/Account.java @@ -24,7 +24,7 @@ public class Account { private String token; private String sessionKey; // Session token for dispatch server - private List permissions; + private final List permissions; private Locale locale; private String banReason; diff --git a/src/main/java/emu/grasscutter/game/ability/Ability.java b/src/main/java/emu/grasscutter/game/ability/Ability.java index 0c7f5337e..76263f87c 100644 --- a/src/main/java/emu/grasscutter/game/ability/Ability.java +++ b/src/main/java/emu/grasscutter/game/ability/Ability.java @@ -12,20 +12,20 @@ import java.util.*; import lombok.Getter; public class Ability { - @Getter private AbilityData data; - @Getter private GameEntity owner; - @Getter private Player playerOwner; + @Getter private final AbilityData data; + @Getter private final GameEntity owner; + @Getter private final Player playerOwner; - @Getter private AbilityManager manager; + @Getter private final AbilityManager manager; - @Getter private Map modifiers = new HashMap<>(); - @Getter private Object2FloatMap abilitySpecials = new Object2FloatOpenHashMap<>(); + @Getter private final Map modifiers = new HashMap<>(); + @Getter private final Object2FloatMap abilitySpecials = new Object2FloatOpenHashMap<>(); @Getter - private static Map> abilitySpecialsModified = new HashMap<>(); + private static final Map> abilitySpecialsModified = new HashMap<>(); - @Getter private int hash; - @Getter private Set avatarSkillStartIds; + @Getter private final int hash; + @Getter private final Set avatarSkillStartIds; public Ability(AbilityData data, GameEntity owner, Player playerOwner) { this.data = data; diff --git a/src/main/java/emu/grasscutter/game/ability/AbilityModifierController.java b/src/main/java/emu/grasscutter/game/ability/AbilityModifierController.java index 370412fe5..a95c4fbda 100644 --- a/src/main/java/emu/grasscutter/game/ability/AbilityModifierController.java +++ b/src/main/java/emu/grasscutter/game/ability/AbilityModifierController.java @@ -4,10 +4,10 @@ import emu.grasscutter.data.binout.*; import lombok.Getter; public class AbilityModifierController { - @Getter private Ability ability; + @Getter private final Ability ability; - @Getter private AbilityData abilityData; - @Getter private AbilityModifier modifierData; + @Getter private final AbilityData abilityData; + @Getter private final AbilityModifier modifierData; public AbilityModifierController( Ability ability, AbilityData abilityData, AbilityModifier modifierData) { diff --git a/src/main/java/emu/grasscutter/game/achievement/Achievement.java b/src/main/java/emu/grasscutter/game/achievement/Achievement.java index 6f3a7dae1..2e935e111 100644 --- a/src/main/java/emu/grasscutter/game/achievement/Achievement.java +++ b/src/main/java/emu/grasscutter/game/achievement/Achievement.java @@ -9,8 +9,8 @@ import lombok.*; @Getter public class Achievement { @Setter private Status status; - private int id; - private int totalProgress; + private final int id; + private final int totalProgress; @Setter private int curProgress; @Setter private int finishTimestampSec; diff --git a/src/main/java/emu/grasscutter/game/avatar/Avatar.java b/src/main/java/emu/grasscutter/game/avatar/Avatar.java index be5774ed0..0bae0a2b4 100644 --- a/src/main/java/emu/grasscutter/game/avatar/Avatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/Avatar.java @@ -61,13 +61,13 @@ public class Avatar { private List fetters; - private Map skillLevelMap = new Int2IntArrayMap(7); // Talent levels + private final Map skillLevelMap = new Int2IntArrayMap(7); // Talent levels @Transient @Getter - private Map skillExtraChargeMap = new Int2IntArrayMap(2); // Charges + private final Map skillExtraChargeMap = new Int2IntArrayMap(2); // Charges @Transient - private Map proudSkillBonusMap = + private final Map proudSkillBonusMap = new Int2IntArrayMap(2); // Talent bonus levels (from const) @Getter private int skillDepotId; diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonEndStats.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonEndStats.java index f22eb78dc..f204860a7 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonEndStats.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonEndStats.java @@ -4,10 +4,10 @@ import emu.grasscutter.game.dungeons.dungeon_results.BaseDungeonResult; import lombok.Getter; public class DungeonEndStats { - @Getter private int killedMonsters; - @Getter private int timeTaken; - @Getter private int openChestCount; - @Getter private BaseDungeonResult.DungeonEndReason dungeonResult; + @Getter private final int killedMonsters; + @Getter private final int timeTaken; + @Getter private final int openChestCount; + @Getter private final BaseDungeonResult.DungeonEndReason dungeonResult; public DungeonEndStats( int killedMonsters, diff --git a/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java b/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java index 8296c09c9..740e46f60 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java @@ -29,13 +29,13 @@ public class EntityClientGadget extends EntityBaseGadget { @Getter private final Player owner; @Getter(onMethod_ = @Override) - private int gadgetId; + private final int gadgetId; - @Getter private int ownerEntityId; - @Getter private int targetEntityId; - @Getter private boolean asyncLoad; + @Getter private final int ownerEntityId; + @Getter private final int targetEntityId; + @Getter private final boolean asyncLoad; - @Getter private int originalOwnerEntityId; + @Getter private final int originalOwnerEntityId; @Getter private final GadgetData gadgetData; private ConfigEntityGadget configGadget; diff --git a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java index f60f17c13..37392a3e8 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java @@ -50,13 +50,13 @@ public class EntityMonster extends GameEntity { @Getter private final Position bornPos; @Getter private final int level; @Getter private EntityWeapon weaponEntity; - @Getter private Map summonTagMap; + @Getter private final Map summonTagMap; @Getter @Setter private int summonedTag; @Getter @Setter private int ownerEntityId; @Getter @Setter private int poseId; @Getter @Setter private int aiId = -1; - @Getter private List playerOnBattle; + @Getter private final List playerOnBattle; @Nullable @Getter @Setter private SceneMonster metaMonster; public EntityMonster( diff --git a/src/main/java/emu/grasscutter/game/entity/EntityTeam.java b/src/main/java/emu/grasscutter/game/entity/EntityTeam.java index 949b003ab..a7b541891 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityTeam.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityTeam.java @@ -10,7 +10,7 @@ import it.unimi.dsi.fastutil.ints.*; public class EntityTeam extends GameEntity { - private Player player; + private final Player player; public EntityTeam(Player player) { super(player.getScene()); diff --git a/src/main/java/emu/grasscutter/game/entity/EntityVehicle.java b/src/main/java/emu/grasscutter/game/entity/EntityVehicle.java index 88db87bfa..78a3df4ee 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityVehicle.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityVehicle.java @@ -36,7 +36,7 @@ public class EntityVehicle extends EntityBaseGadget { @Getter private final int gadgetId; @Getter @Setter private float curStamina; - @Getter private List vehicleMembers; + @Getter private final List vehicleMembers; @Nullable @Getter private ConfigEntityGadget configGadget; public EntityVehicle( diff --git a/src/main/java/emu/grasscutter/game/entity/EntityWorld.java b/src/main/java/emu/grasscutter/game/entity/EntityWorld.java index 50692cd72..da6fbd7ae 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityWorld.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityWorld.java @@ -8,7 +8,7 @@ import it.unimi.dsi.fastutil.ints.*; import lombok.Getter; public class EntityWorld extends GameEntity { - @Getter private World world; + @Getter private final World world; public EntityWorld(World world) { super(null); diff --git a/src/main/java/emu/grasscutter/game/entity/GameEntity.java b/src/main/java/emu/grasscutter/game/entity/GameEntity.java index 7e78dbb10..e3b9003ff 100644 --- a/src/main/java/emu/grasscutter/game/entity/GameEntity.java +++ b/src/main/java/emu/grasscutter/game/entity/GameEntity.java @@ -44,13 +44,13 @@ public abstract class GameEntity { @Getter @Setter private EntityController entityController; @Getter private ElementType lastAttackType = ElementType.None; - @Getter private List instancedAbilities = new ArrayList<>(); + @Getter private final List instancedAbilities = new ArrayList<>(); @Getter - private Int2ObjectMap instancedModifiers = + private final Int2ObjectMap instancedModifiers = new Int2ObjectOpenHashMap<>(); - @Getter private Map globalAbilityValues = new HashMap<>(); + @Getter private final Map globalAbilityValues = new HashMap<>(); public GameEntity(Scene scene) { this.scene = scene; diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetAbility.java b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetAbility.java index 3fc91e587..6775ea4ca 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetAbility.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetAbility.java @@ -8,7 +8,7 @@ import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo; import lombok.val; public class GadgetAbility extends GadgetContent { - private EntityBaseGadget parent; + private final EntityBaseGadget parent; public GadgetAbility(EntityGadget gadget, EntityBaseGadget parent) { super(gadget); diff --git a/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java b/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java index 6d150df5f..509914446 100644 --- a/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java +++ b/src/main/java/emu/grasscutter/game/friends/PlayerProfile.java @@ -24,8 +24,8 @@ public class PlayerProfile { private int worldLevel; private int lastActiveTime; - private boolean isInDuel = false; // TODO: Implement duels. (TCG) - private boolean isDuelObservable = false; // TODO: Implement duels. (TCG) + private final boolean isInDuel = false; // TODO: Implement duels. (TCG) + private final boolean isDuelObservable = false; // TODO: Implement duels. (TCG) @Getter private int enterHomeOption; diff --git a/src/main/java/emu/grasscutter/game/gacha/GachaBanner.java b/src/main/java/emu/grasscutter/game/gacha/GachaBanner.java index b1bdaeef2..7d3405fab 100644 --- a/src/main/java/emu/grasscutter/game/gacha/GachaBanner.java +++ b/src/main/java/emu/grasscutter/game/gacha/GachaBanner.java @@ -39,24 +39,24 @@ public class GachaBanner { @Getter private String previewPrefabPath; @Getter private String titlePath; private int costItemId = 0; - private int costItemAmount = 1; + private final int costItemAmount = 1; private int costItemId10 = 0; - private int costItemAmount10 = 10; - @Getter private int beginTime = 0; - @Getter private int endTime = 1924992000; - @Getter private int gachaTimesLimit = Integer.MAX_VALUE; - @Getter private int[] rateUpItems4 = {}; - @Getter private int[] rateUpItems5 = {}; + private final int costItemAmount10 = 10; + @Getter private final int beginTime = 0; + @Getter private final int endTime = 1924992000; + @Getter private final int gachaTimesLimit = Integer.MAX_VALUE; + @Getter private final int[] rateUpItems4 = {}; + @Getter private final int[] rateUpItems5 = {}; // This now handles default values for the fields below - @Getter private BannerType bannerType = BannerType.STANDARD; + @Getter private final BannerType bannerType = BannerType.STANDARD; // These don't change between banner types (apart from Standard having three extra 4star avatars) @Getter - private int[] fallbackItems3 = { + private final int[] fallbackItems3 = { 11301, 11302, 11306, 12301, 12302, 12305, 13303, 14301, 14302, 14304, 15301, 15302, 15304 }; - @Getter private int[] fallbackItems4Pool1 = DEFAULT_FALLBACK_ITEMS_4_POOL_1; - @Getter private int[] fallbackItems4Pool2 = DEFAULT_FALLBACK_ITEMS_4_POOL_2; + @Getter private final int[] fallbackItems4Pool1 = DEFAULT_FALLBACK_ITEMS_4_POOL_1; + @Getter private final int[] fallbackItems4Pool2 = DEFAULT_FALLBACK_ITEMS_4_POOL_2; // Different banner types have different defaults, see above for default values and the enum for // which are used where. @Getter private int[] fallbackItems5Pool1; @@ -66,33 +66,33 @@ public class GachaBanner { private int eventChance4 = -1; // Chance to win a featured event item private int eventChance5 = -1; // Chance to win a featured event item // - @Getter private boolean removeC6FromPool = false; + @Getter private final boolean removeC6FromPool = false; @Getter - private boolean autoStripRateUpFromFallback = + private final boolean autoStripRateUpFromFallback = true; // Ensures that featured items won't "double dip" into the losing pool - private int[][] poolBalanceWeights4 = { + private final int[][] poolBalanceWeights4 = { {1, 255}, {17, 255}, {21, 10455} }; // Used to ensure that players won't go too many rolls without getting something from pool 1 // (avatar) or pool 2 (weapon) - private int[][] poolBalanceWeights5 = {{1, 30}, {147, 150}, {181, 10230}}; - @Getter private int wishMaxProgress = 2; + private final int[][] poolBalanceWeights5 = {{1, 30}, {147, 150}, {181, 10230}}; + @Getter private final int wishMaxProgress = 2; // Deprecated fields that were tolerated in early May 2022 but have apparently still being // circulating in new custom configs // For now, throw up big scary errors on load telling people that they will be banned outright in // a future version - @Deprecated private int[] rateUpItems1 = {}; - @Deprecated private int[] rateUpItems2 = {}; - @Deprecated private int eventChance = -1; - @Deprecated private int costItem = 0; - @Deprecated private int softPity = -1; - @Deprecated private int hardPity = -1; - @Deprecated private int minItemType = -1; - @Deprecated private int maxItemType = -1; + @Deprecated private final int[] rateUpItems1 = {}; + @Deprecated private final int[] rateUpItems2 = {}; + @Deprecated private final int eventChance = -1; + @Deprecated private final int costItem = 0; + @Deprecated private final int softPity = -1; + @Deprecated private final int hardPity = -1; + @Deprecated private final int minItemType = -1; + @Deprecated private final int maxItemType = -1; @Getter private boolean deprecated = false; - @Getter private boolean disabled = false; + @Getter private final boolean disabled = false; private void warnDeprecated(String name, String replacement) { Grasscutter.getLogger() diff --git a/src/main/java/emu/grasscutter/game/managers/mapmark/MapMark.java b/src/main/java/emu/grasscutter/game/managers/mapmark/MapMark.java index 930737bda..6960a8595 100644 --- a/src/main/java/emu/grasscutter/game/managers/mapmark/MapMark.java +++ b/src/main/java/emu/grasscutter/game/managers/mapmark/MapMark.java @@ -11,9 +11,9 @@ public class MapMark { private int sceneId; private String name; private Position position; - private MapMarkPointType mapMarkPointType; + private final MapMarkPointType mapMarkPointType; private int monsterId; - private MapMarkFromType mapMarkFromType; + private final MapMarkFromType mapMarkFromType; private int questId; @Deprecated // Morhpia diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index 571da1f91..1f8c87c03 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -78,17 +78,17 @@ public class Player implements PlayerHook, FieldFetch { @Getter private String signature; @Getter private int headImage; @Getter private int nameCardId = 210001; - @Getter private Position position; + @Getter private final Position position; @Getter @Setter private Position prevPos; @Getter @Setter private Position prevPosForHome; @Getter @Setter private int prevScene; - @Getter private Position rotation; + @Getter private final Position rotation; @Getter private PlayerBirthday birthday; @Getter private PlayerCodex codex; @Getter @Setter private boolean showAvatars; @Getter @Setter private List showAvatarList; @Getter @Setter private List showNameCardList; - @Getter private Map properties; + @Getter private final Map properties; @Getter @Setter private int currentRealmId; @Getter @Setter private transient boolean isInEditMode; @Getter @Setter private int widgetId; @@ -98,25 +98,25 @@ public class Player implements PlayerHook, FieldFetch { @Getter @Setter private boolean inGodMode; @Getter @Setter private boolean unlimitedStamina; - @Getter private Set nameCardList; - @Getter private Set flyCloakList; - @Getter private Set costumeList; - @Getter private Set personalLineList; + @Getter private final Set nameCardList; + @Getter private final Set flyCloakList; + @Getter private final Set costumeList; + @Getter private final Set personalLineList; @Getter @Setter private Set rewardedLevels; @Getter @Setter private Set homeRewardedLevels; @Getter @Setter private Set realmList; @Getter @Setter private Set seenRealmList; - @Getter private Set unlockedForgingBlueprints; - @Getter private Set unlockedCombines; - @Getter private Set unlockedFurniture; - @Getter private Set unlockedFurnitureSuite; - @Getter private Map expeditionInfo; - @Getter private Map unlockedRecipies; - @Getter private List activeForges; - @Getter private Map activeCookCompounds; - @Getter private Map questGlobalVariables; - @Getter private Map openStates; - @Getter private Map> sceneTags; + @Getter private final Set unlockedForgingBlueprints; + @Getter private final Set unlockedCombines; + @Getter private final Set unlockedFurniture; + @Getter private final Set unlockedFurnitureSuite; + @Getter private final Map expeditionInfo; + @Getter private final Map unlockedRecipies; + @Getter private final List activeForges; + @Getter private final Map activeCookCompounds; + @Getter private final Map questGlobalVariables; + @Getter private final Map openStates; + @Getter private final Map> sceneTags; @Getter @Setter private Map> unlockedSceneAreas; @Getter @Setter private Map> unlockedScenePoints; @Getter @Setter private List chatEmojiIdList; @@ -133,13 +133,13 @@ public class Player implements PlayerHook, FieldFetch { @Transient @Getter private int areaType = 0; // Player managers go here - @Getter private transient AvatarStorage avatars; - @Getter private transient Inventory inventory; - @Getter private transient FriendsList friendsList; - @Getter private transient MailHandler mailHandler; - @Getter private transient AbilityManager abilityManager; - @Getter private transient QuestManager questManager; - @Getter private transient TowerManager towerManager; + @Getter private final transient AvatarStorage avatars; + @Getter private final transient Inventory inventory; + @Getter private final transient FriendsList friendsList; + @Getter private final transient MailHandler mailHandler; + @Getter private final transient AbilityManager abilityManager; + @Getter private final transient QuestManager questManager; + @Getter private final transient TowerManager towerManager; @Getter private transient SotSManager sotsManager; @Getter private transient MapMarksManager mapMarksManager; @Getter private transient StaminaManager staminaManager; @@ -152,10 +152,10 @@ public class Player implements PlayerHook, FieldFetch { @Getter private transient CookingManager cookingManager; @Getter private transient CookingCompoundManager cookingCompoundManager; @Getter private transient ActivityManager activityManager; - @Getter private transient PlayerBuffManager buffManager; + @Getter private final transient PlayerBuffManager buffManager; @Getter private transient PlayerProgressManager progressManager; @Getter private transient SatiationManager satiationManager; - @Getter private transient TalkManager talkManager; + @Getter private final transient TalkManager talkManager; @Getter @Setter private transient Position lastCheckedPosition = null; @@ -164,9 +164,9 @@ public class Player implements PlayerHook, FieldFetch { private PlayerProfile playerProfile; // Getter has null-check @Getter private TeamManager teamManager; private TowerData towerData; // Getter has null-check - @Getter private PlayerGachaInfo gachaInfo; + @Getter private final PlayerGachaInfo gachaInfo; private PlayerCollectionRecords collectionRecordStore; // Getter has null-check - @Getter private ArrayList shopLimit; + @Getter private final ArrayList shopLimit; @Getter private transient GameHome home; @@ -194,11 +194,11 @@ public class Player implements PlayerHook, FieldFetch { @Getter @Setter private int nextResinRefresh; @Getter @Setter private int resinBuyCount; @Getter @Setter private int lastDailyReset; - @Getter private transient MpSettingType mpSetting = MpSettingType.MP_SETTING_TYPE_ENTER_AFTER_APPLY; + @Getter private final transient MpSettingType mpSetting = MpSettingType.MP_SETTING_TYPE_ENTER_AFTER_APPLY; @Getter private long playerGameTime = 540000; // 9 in-game hours. Present at the start of the game. - @Getter private PlayerProgress playerProgress; - @Getter private Set activeQuestTimers; + @Getter private final PlayerProgress playerProgress; + @Getter private final Set activeQuestTimers; @Getter @Setter private ElementType mainCharacterElement = ElementType.None; diff --git a/src/main/java/emu/grasscutter/game/player/PlayerCodex.java b/src/main/java/emu/grasscutter/game/player/PlayerCodex.java index 646ef22d1..4981d4794 100644 --- a/src/main/java/emu/grasscutter/game/player/PlayerCodex.java +++ b/src/main/java/emu/grasscutter/game/player/PlayerCodex.java @@ -14,14 +14,14 @@ public class PlayerCodex { @Transient private Player player; // itemId is not codexId! - @Getter private Set unlockedWeapon; - @Getter private Map unlockedAnimal; - @Getter private Set unlockedMaterial; - @Getter private Set unlockedBook; - @Getter private Set unlockedTip; - @Getter private Set unlockedView; + @Getter private final Set unlockedWeapon; + @Getter private final Map unlockedAnimal; + @Getter private final Set unlockedMaterial; + @Getter private final Set unlockedBook; + @Getter private final Set unlockedTip; + @Getter private final Set unlockedView; @Getter private Set unlockedReliquary; - @Getter private Set unlockedReliquarySuitCodex; + @Getter private final Set unlockedReliquarySuitCodex; public PlayerCodex() { this.unlockedWeapon = new HashSet<>(); diff --git a/src/main/java/emu/grasscutter/game/player/PlayerProgress.java b/src/main/java/emu/grasscutter/game/player/PlayerProgress.java index f66b957ef..43ce48554 100644 --- a/src/main/java/emu/grasscutter/game/player/PlayerProgress.java +++ b/src/main/java/emu/grasscutter/game/player/PlayerProgress.java @@ -14,21 +14,21 @@ import lombok.*; @Entity public class PlayerProgress { @Setter @Transient private Player player; - private Map itemHistory; + private final Map itemHistory; /* * A list of dungeon IDs which have been completed. * This only applies to one-time dungeons. */ - private IntArrayList completedDungeons; + private final IntArrayList completedDungeons; // keep track of EXEC_ADD_QUEST_PROGRESS count, will be used in CONTENT_ADD_QUEST_PROGRESS // not sure where to put this, this should be saved to DB but not to individual quest, since // it will be hard to loop and compare - private Map questProgressCountMap; + private final Map questProgressCountMap; - private Map itemGivings; - private Map bargains; + private final Map itemGivings; + private final Map bargains; public PlayerProgress() { this.questProgressCountMap = new ConcurrentHashMap<>(); diff --git a/src/main/java/emu/grasscutter/game/player/TeamInfo.java b/src/main/java/emu/grasscutter/game/player/TeamInfo.java index 794f36501..397682cde 100644 --- a/src/main/java/emu/grasscutter/game/player/TeamInfo.java +++ b/src/main/java/emu/grasscutter/game/player/TeamInfo.java @@ -10,7 +10,7 @@ import java.util.*; @Entity public final class TeamInfo { private String name; - private List avatars; + private final List avatars; public TeamInfo() { this.name = ""; diff --git a/src/main/java/emu/grasscutter/game/quest/QuestManager.java b/src/main/java/emu/grasscutter/game/quest/QuestManager.java index 2ac3601ab..cdd40945d 100644 --- a/src/main/java/emu/grasscutter/game/quest/QuestManager.java +++ b/src/main/java/emu/grasscutter/game/quest/QuestManager.java @@ -26,7 +26,7 @@ public final class QuestManager extends BasePlayerManager { @Getter private final Player player; @Getter private final Int2ObjectMap mainQuests; - @Getter private Int2ObjectMap acceptProgressLists; + @Getter private final Int2ObjectMap acceptProgressLists; @Getter private final List loggedQuests; private long lastHourCheck = 0; diff --git a/src/main/java/emu/grasscutter/game/world/Scene.java b/src/main/java/emu/grasscutter/game/world/Scene.java index 98047d1fc..65fedff48 100644 --- a/src/main/java/emu/grasscutter/game/world/Scene.java +++ b/src/main/java/emu/grasscutter/game/world/Scene.java @@ -79,7 +79,7 @@ public class Scene { private final List afterLoadedCallbacks = new ArrayList<>(); private final List afterHostInitCallbacks = new ArrayList<>(); - @Getter private GameEntity sceneEntity; + @Getter private final GameEntity sceneEntity; @Getter private final ServerTaskScheduler scheduler; public Scene(World world, SceneData sceneData) { diff --git a/src/main/java/emu/grasscutter/game/world/SceneGroupInstance.java b/src/main/java/emu/grasscutter/game/world/SceneGroupInstance.java index fe443e234..a57dc5830 100644 --- a/src/main/java/emu/grasscutter/game/world/SceneGroupInstance.java +++ b/src/main/java/emu/grasscutter/game/world/SceneGroupInstance.java @@ -19,11 +19,11 @@ public final class SceneGroupInstance { @Getter private transient SceneGroup luaGroup; @Getter @Setter private int targetSuiteId; @Getter @Setter private int activeSuiteId; - @Getter private Set deadEntities; // Config_ids + @Getter private final Set deadEntities; // Config_ids private boolean isCached; - @Getter private Map cachedGadgetStates; - @Getter private Map cachedVariables; + @Getter private final Map cachedGadgetStates; + @Getter private final Map cachedVariables; @Getter @Setter private int lastTimeRefreshed; diff --git a/src/main/java/emu/grasscutter/game/world/SpawnDataEntry.java b/src/main/java/emu/grasscutter/game/world/SpawnDataEntry.java index 27865e1ae..8e903c469 100644 --- a/src/main/java/emu/grasscutter/game/world/SpawnDataEntry.java +++ b/src/main/java/emu/grasscutter/game/world/SpawnDataEntry.java @@ -33,10 +33,10 @@ public class SpawnDataEntry { } public static class GridBlockId { - @Getter private int sceneId; - @Getter private int scale; - @Getter private int x; - @Getter private int z; + @Getter private final int sceneId; + @Getter private final int scale; + @Getter private final int x; + @Getter private final int z; public GridBlockId(int sceneId, int scale, int x, int z) { this.sceneId = sceneId; diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index 434583f6f..f0ca384de 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -48,7 +48,7 @@ public class World implements Iterable { @Getter private final List players; @Getter private final Int2ObjectMap scenes; - @Getter private EntityWorld entity; + @Getter private final EntityWorld entity; private int nextEntityId = 0; private int nextPeerId = 0; private int worldLevel; diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java index 4e5229600..2a9776a1d 100644 --- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java +++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java @@ -55,7 +55,7 @@ public class SceneScriptManager { private final Map sceneGroupsInstances; private final Map cachedSceneGroupsInstances; private ScriptMonsterTideService scriptMonsterTideService; - private ScriptMonsterSpawnService scriptMonsterSpawnService; + private final ScriptMonsterSpawnService scriptMonsterSpawnService; /** blockid - loaded groupSet */ private final Map> loadedGroupSetPerBlock; diff --git a/src/main/java/emu/grasscutter/scripts/ScriptLoader.java b/src/main/java/emu/grasscutter/scripts/ScriptLoader.java index de5e14b5c..eaea56215 100644 --- a/src/main/java/emu/grasscutter/scripts/ScriptLoader.java +++ b/src/main/java/emu/grasscutter/scripts/ScriptLoader.java @@ -29,12 +29,12 @@ public class ScriptLoader { @Getter private static ScriptLib scriptLib; @Getter private static LuaValue scriptLibLua; /** suggest GC to remove it if the memory is less */ - private static Map> scriptSources = new ConcurrentHashMap<>(); + private static final Map> scriptSources = new ConcurrentHashMap<>(); - private static Map> scriptsCache = + private static final Map> scriptsCache = new ConcurrentHashMap<>(); /** sceneId - SceneMeta */ - private static Map> sceneMetaCache = new ConcurrentHashMap<>(); + private static final Map> sceneMetaCache = new ConcurrentHashMap<>(); private static final AtomicReference currentBindings = new AtomicReference<>(null); private static final AtomicReference currentContext = new AtomicReference<>(null); diff --git a/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java b/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java index 82b7c2a65..5256ae952 100644 --- a/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java +++ b/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java @@ -11,8 +11,8 @@ import org.luaj.vm2.*; public class EntityController { private static final Set SERVER_CALLED = Set.of("OnBeHurt", "OnDie", "OnTimer"); - private transient CompiledScript entityController; - private transient Bindings entityControllerBindings; + private final transient CompiledScript entityController; + private final transient Bindings entityControllerBindings; public EntityController(CompiledScript entityController, Bindings entityControllerBindings) { this.entityController = entityController; diff --git a/src/main/java/emu/grasscutter/server/event/game/SceneBlockLoadedEvent.java b/src/main/java/emu/grasscutter/server/event/game/SceneBlockLoadedEvent.java index 1155b018b..2eb711825 100644 --- a/src/main/java/emu/grasscutter/server/event/game/SceneBlockLoadedEvent.java +++ b/src/main/java/emu/grasscutter/server/event/game/SceneBlockLoadedEvent.java @@ -6,7 +6,7 @@ import lombok.*; @Getter public final class SceneBlockLoadedEvent extends ServerEvent { - private SceneBlock block; + private final SceneBlock block; public SceneBlockLoadedEvent(SceneBlock block) { super(Type.GAME); diff --git a/src/main/java/emu/grasscutter/server/event/game/SceneMetaLoadEvent.java b/src/main/java/emu/grasscutter/server/event/game/SceneMetaLoadEvent.java index 0e5768a00..c0ae72ba7 100644 --- a/src/main/java/emu/grasscutter/server/event/game/SceneMetaLoadEvent.java +++ b/src/main/java/emu/grasscutter/server/event/game/SceneMetaLoadEvent.java @@ -6,7 +6,7 @@ import lombok.*; @Getter public final class SceneMetaLoadEvent extends ServerEvent { - private Scene scene; + private final Scene scene; @Setter private boolean override; public SceneMetaLoadEvent(Scene scene) {