diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index 1f8c87c03..c6735d82d 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -896,10 +896,8 @@ public class Player implements PlayerHook, FieldFetch { } public ShopLimit getGoodsLimit(int goodsId) { - Optional shopLimit = this.shopLimit.stream().filter(x -> x.getShopGoodId() == goodsId).findFirst(); - if (shopLimit.isEmpty()) - return null; - return shopLimit.get(); + Optional limitOptional = this.shopLimit.stream().filter(x -> x.getShopGoodId() == goodsId).findFirst(); + return limitOptional.orElse(null); } public void addShopLimit(int goodsId, int boughtCount, int nextRefreshTime) {