From 870085fc9136764d01278819212e18b1d900300b Mon Sep 17 00:00:00 2001 From: "Breno A." Date: Sun, 9 Jun 2024 09:10:48 -0300 Subject: [PATCH] refactor: replace lambda with method reference --- .../java/emu/grasscutter/data/excels/RewardPreviewData.java | 2 +- .../game/props/ItemUseAction/ItemUseGainAvatar.java | 3 ++- .../java/emu/grasscutter/game/systems/InventorySystem.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/excels/RewardPreviewData.java b/src/main/java/emu/grasscutter/data/excels/RewardPreviewData.java index dad51e911..caba57447 100644 --- a/src/main/java/emu/grasscutter/data/excels/RewardPreviewData.java +++ b/src/main/java/emu/grasscutter/data/excels/RewardPreviewData.java @@ -25,7 +25,7 @@ public class RewardPreviewData extends GameResource { Arrays.stream(this.previewItems) .filter(d -> d.getId() > 0 && d.getCount() != null && !d.getCount().isEmpty()) .map(ItemParamStringData::toItemParamData) - .toArray(size -> new ItemParamData[size]); + .toArray(ItemParamData[]::new); } else { this.previewItemsArray = new ItemParamData[0]; } diff --git a/src/main/java/emu/grasscutter/game/props/ItemUseAction/ItemUseGainAvatar.java b/src/main/java/emu/grasscutter/game/props/ItemUseAction/ItemUseGainAvatar.java index 1dae2822d..add08558d 100644 --- a/src/main/java/emu/grasscutter/game/props/ItemUseAction/ItemUseGainAvatar.java +++ b/src/main/java/emu/grasscutter/game/props/ItemUseAction/ItemUseGainAvatar.java @@ -1,5 +1,6 @@ package emu.grasscutter.game.props.ItemUseAction; +import emu.grasscutter.data.excels.avatar.AvatarSkillDepotData; import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.props.ItemUseOp; import emu.grasscutter.game.systems.InventorySystem; @@ -43,7 +44,7 @@ public class ItemUseGainAvatar extends ItemUseInt { int itemId = Optional.ofNullable(params.player.getAvatars().getAvatarById(this.i)) .map(Avatar::getSkillDepot) - .map(depot -> depot.getTalentCostItemId()) + .map(AvatarSkillDepotData::getTalentCostItemId) .orElse((this.i % 1000) + 100); return params.player.getInventory().addItem(itemId); } diff --git a/src/main/java/emu/grasscutter/game/systems/InventorySystem.java b/src/main/java/emu/grasscutter/game/systems/InventorySystem.java index 568872e23..f84ae7078 100644 --- a/src/main/java/emu/grasscutter/game/systems/InventorySystem.java +++ b/src/main/java/emu/grasscutter/game/systems/InventorySystem.java @@ -58,7 +58,7 @@ public class InventorySystem extends BaseGameSystem { } else { avatarId = Optional.ofNullable(GameData.getItemDataMap().get(id)) - .map(itemData -> itemData.getItemUseActions()) + .map(ItemData::getItemUseActions) .flatMap( actions -> actions.stream()