mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-04 23:53:20 +08:00
refactor: replace lambda with method reference
This commit is contained in:
parent
8c35c89bf5
commit
870085fc91
@ -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];
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user